GNU bug report logs - #13414
Valid DLL def file mangled by libtool

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: libtool; Reported by: Martin Doucha <doucha@HIDDEN>; dated Fri, 11 Jan 2013 15:54:02 UTC; Maintainer for libtool is bug-libtool@HIDDEN.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 22 Jan 2013 22:31:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 22 17:31:00 2013
Received: from localhost ([127.0.0.1]:45165 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TxmMt-0004Yu-0r
	for submit <at> debbugs.gnu.org; Tue, 22 Jan 2013 17:31:00 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:42478)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peda@HIDDEN>) id 1TxmMq-0004Ym-E5
	for 13414 <at> debbugs.gnu.org; Tue, 22 Jan 2013 17:30:57 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 6E89F40015;
	Tue, 22 Jan 2013 23:29:43 +0100 (CET)
Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com
	[90.227.119.137])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id E53F54000F;
	Tue, 22 Jan 2013 23:29:42 +0100 (CET)
Message-ID: <50FF12D5.6080200@HIDDEN>
Date: Tue, 22 Jan 2013 23:29:41 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: Erik van Pienbroek <erik@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<50F9D2E1.9040403@HIDDEN>
	<404BC785-1F93-49D9-9E8A-E07A958B90C4@HIDDEN>
	<50FB9D99.2060701@HIDDEN>
	<1358693673.21239.8.camel@HIDDEN>
	<1358880352.6455.7.camel@erik-laptop>
In-Reply-To: <1358880352.6455.7.camel@erik-laptop>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 13414
Cc: Martin Doucha <doucha@HIDDEN>,
	"13414 <at> debbugs.gnu.org" <13414 <at> debbugs.gnu.org>,
	Libtool Patches List <libtool-patches@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: 0.8 (/)

close 13414
thanks

Hi!

On 2013-01-22 19:45, Erik van Pienbroek wrote:
> Erik van Pienbroek schreef op zo 20-01-2013 om 15:54 [+0100]:
>> Peter Rosin schreef op zo 20-01-2013 om 08:32 [+0100]:
>>> But I will hold off the push a couple of days pending feedback from
>>> those actually using .def files for real things.
>>
>> Thanks for the patch. To help out with testing I can perform a test mass
>> rebuild of all mingw packages which are currently in Fedora (about 135)
>> against a libtool package which contains this patch. With this mass
>> rebuild we can at least find out whether the patch introduces
>> regressions or not. Running such a test mass rebuild will take about 36
>> hours to complete, so I'll give an update in about 2 days.
> 
> The test mass rebuild of all Fedora MinGW packages against the latest
> libtool with the proposed patches was successful. The packages which
> required workarounds in order to get built can now be built without
> these workarounds, so the original issue is resolved with the proposed
> patches. All other packages were rebuilt successfully as well, so from
> my point of view I'm +1 to the proposed patches.

Ok, that's good enough for me!  Thanks again for testing.

The patches tested by Erik where slightly different from the ones I
posted. I did the whitespace changes in a separate patch and fixed the
copyright year thing spotted by Gary. I also changed

	IFS=' ''
'

into

	IFS="$sp$nl"

The patches tested where also slightly different from the ones I
actually pushed. The pushed version does not have the unneeded quotes
in the above assignment and I changed one instance of

	if ! foo; then
		...
	fi

into

	foo || {
		...
	}

since "if ! foo" isn't as portable according to Autoconf docs.

Anyway, those last changes are all harmless, I'm just putting all
cards on the table just in case...

Cheers,
Peter




Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 22 Jan 2013 18:47:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 22 13:47:10 2013
Received: from localhost ([127.0.0.1]:44977 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TxisI-0007ib-9K
	for submit <at> debbugs.gnu.org; Tue, 22 Jan 2013 13:47:10 -0500
Received: from mail.vanpienbroek.nl ([77.243.228.227]:45551)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <erik@HIDDEN>) id 1TxisG-0007iR-2o
	for 13414 <at> debbugs.gnu.org; Tue, 22 Jan 2013 13:47:09 -0500
Received: from localhost (unknown [127.0.0.1])
	by mail.vanpienbroek.nl (Postfix) with ESMTP id B5AD56CDB9;
	Tue, 22 Jan 2013 18:47:04 +0000 (UTC)
X-Virus-Scanned: amavisd-new at vanpienbroek.nl
Received: from mail.vanpienbroek.nl ([127.0.0.1])
	by localhost (mail.vanpienbroek.nl [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id msrY59VCo-fB; Tue, 22 Jan 2013 19:47:03 +0100 (CET)
Received: from [IPv6:2001:980:2a0d:1:868f:69ff:fec7:e232] (unknown
	[IPv6:2001:980:2a0d:1:868f:69ff:fec7:e232])
	by mail.vanpienbroek.nl (Postfix) with ESMTPSA id EF9396CDB7;
	Tue, 22 Jan 2013 19:47:02 +0100 (CET)
Message-ID: <1358880352.6455.7.camel@erik-laptop>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
From: Erik van Pienbroek <erik@HIDDEN>
To: Peter Rosin <peda@HIDDEN>
Date: Tue, 22 Jan 2013 19:45:52 +0100
In-Reply-To: <1358693673.21239.8.camel@HIDDEN>
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<50F9D2E1.9040403@HIDDEN>
	<404BC785-1F93-49D9-9E8A-E07A958B90C4@HIDDEN>
	<50FB9D99.2060701@HIDDEN>
	<1358693673.21239.8.camel@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.6.2 (3.6.2-3.fc18.1) 
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 13414
Cc: Martin Doucha <doucha@HIDDEN>,
	"13414 <at> debbugs.gnu.org" <13414 <at> debbugs.gnu.org>,
	Libtool Patches List <libtool-patches@HIDDEN>,
	"Gary V. Vaughan" <gary@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -0.0 (/)

Erik van Pienbroek schreef op zo 20-01-2013 om 15:54 [+0100]:
> Peter Rosin schreef op zo 20-01-2013 om 08:32 [+0100]:
> > But I will hold off the push a couple of days pending feedback from
> > those actually using .def files for real things.
> 
> Thanks for the patch. To help out with testing I can perform a test mass
> rebuild of all mingw packages which are currently in Fedora (about 135)
> against a libtool package which contains this patch. With this mass
> rebuild we can at least find out whether the patch introduces
> regressions or not. Running such a test mass rebuild will take about 36
> hours to complete, so I'll give an update in about 2 days.

Hi,

The test mass rebuild of all Fedora MinGW packages against the latest
libtool with the proposed patches was successful. The packages which
required workarounds in order to get built can now be built without
these workarounds, so the original issue is resolved with the proposed
patches. All other packages were rebuilt successfully as well, so from
my point of view I'm +1 to the proposed patches.

Regards,

Erik van Pienbroek
Fedora MinGW SIG






Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 20 Jan 2013 20:06:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 20 15:06:24 2013
Received: from localhost ([127.0.0.1]:41833 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Tx19q-0001fS-4x
	for submit <at> debbugs.gnu.org; Sun, 20 Jan 2013 15:06:24 -0500
Received: from mail.vanpienbroek.nl ([77.243.228.227]:44499)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <erik@HIDDEN>) id 1TwwJ5-0002iZ-0B
	for 13414 <at> debbugs.gnu.org; Sun, 20 Jan 2013 09:55:36 -0500
Received: from localhost (unknown [127.0.0.1])
	by mail.vanpienbroek.nl (Postfix) with ESMTP id 8D6CA6CD53;
	Sun, 20 Jan 2013 14:55:41 +0000 (UTC)
X-Virus-Scanned: amavisd-new at vanpienbroek.nl
Received: from mail.vanpienbroek.nl ([127.0.0.1])
	by localhost (mail.vanpienbroek.nl [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id nYQWLKwbi-uD; Sun, 20 Jan 2013 15:55:40 +0100 (CET)
Received: from [IPv6:2001:980:1802:4:868f:69ff:fec7:e232] (unknown
	[IPv6:2001:980:1802:4:868f:69ff:fec7:e232])
	by mail.vanpienbroek.nl (Postfix) with ESMTPSA id 74D8C6CD51;
	Sun, 20 Jan 2013 15:55:40 +0100 (CET)
Message-ID: <1358693673.21239.8.camel@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
From: Erik van Pienbroek <erik@HIDDEN>
To: Peter Rosin <peda@HIDDEN>
Date: Sun, 20 Jan 2013 15:54:33 +0100
In-Reply-To: <50FB9D99.2060701@HIDDEN>
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<50F9D2E1.9040403@HIDDEN>
	<404BC785-1F93-49D9-9E8A-E07A958B90C4@HIDDEN>
	<50FB9D99.2060701@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.6.2 (3.6.2-3.fc18.1) 
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 13414
X-Mailman-Approved-At: Sun, 20 Jan 2013 15:06:20 -0500
Cc: Martin Doucha <doucha@HIDDEN>,
	"13414 <at> debbugs.gnu.org" <13414 <at> debbugs.gnu.org>,
	Libtool Patches List <libtool-patches@HIDDEN>,
	"Gary V. Vaughan" <gary@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -0.0 (/)

Peter Rosin schreef op zo 20-01-2013 om 08:32 [+0100]:
> But I will hold off the push a couple of days pending feedback from
> those actually using .def files for real things.

Thanks for the patch. To help out with testing I can perform a test mass
rebuild of all mingw packages which are currently in Fedora (about 135)
against a libtool package which contains this patch. With this mass
rebuild we can at least find out whether the patch introduces
regressions or not. Running such a test mass rebuild will take about 36
hours to complete, so I'll give an update in about 2 days.

Kind regards,

Erik van Pienbroek
Fedora MinGW SIG






Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 20 Jan 2013 07:33:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 20 02:33:46 2013
Received: from localhost ([127.0.0.1]:40998 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TwpPV-0008KZ-8p
	for submit <at> debbugs.gnu.org; Sun, 20 Jan 2013 02:33:46 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:32785)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peda@HIDDEN>) id 1TwpPR-0008KQ-RS
	for 13414 <at> debbugs.gnu.org; Sun, 20 Jan 2013 02:33:43 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id EB8D74000C;
	Sun, 20 Jan 2013 08:32:43 +0100 (CET)
Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com
	[90.227.119.137])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id 2F1E540009;
	Sun, 20 Jan 2013 08:32:42 +0100 (CET)
Message-ID: <50FB9D99.2060701@HIDDEN>
Date: Sun, 20 Jan 2013 08:32:41 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: "Gary V. Vaughan" <gary@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<50F9D2E1.9040403@HIDDEN>
	<404BC785-1F93-49D9-9E8A-E07A958B90C4@HIDDEN>
In-Reply-To: <404BC785-1F93-49D9-9E8A-E07A958B90C4@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 13414
Cc: "erik-gnu@HIDDEN" <erik-gnu@HIDDEN>,
	Martin Doucha <doucha@HIDDEN>,
	"13414 <at> debbugs.gnu.org" <13414 <at> debbugs.gnu.org>,
	Libtool Patches List <libtool-patches@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: 0.8 (/)

On 2013-01-19 06:12, Gary V. Vaughan wrote:
> Hi Peter,
> 
> Thanks for working on this.
> 
> On 19 Jan 2013, at 05:55, Peter Rosin <peda@HIDDEN> wrote:
>> On 2013-01-12 01:26, Peter Rosin wrote:
>>> On 2013-01-11 12:34, Martin Doucha wrote:
>>>> I'd like to report a bug in libtool 2.4 (including the latest git revision) which mangles valid DLL def files under MinGW and makes the linker barf.
>>>
>>> This issue has been reported before [1].
>>
>> So, as hinted above, I'm following up with a pair of patches that
>> appear to mend this.
>>
>> Ok to push?
> 
> By inspection, these patches look good to me - presuming there are no regressions, please go ahead.

I have found no regressions, and thanks for the speedy review!

> One nit: your new test has a Copyright notice starting at 2007 followed by "written in 2013". The new code doesn't look derivative of existing tests, so I'd suggest deleting the years prior to 2013 before pushing.

Done.

>> Or are the white-space changes in the first patch too intrusive?
> 
> If you would like to separate those into a separate patch then please feel free; but I'd rather see functional progress in Libtool development than being overly anal about changeset minutiae for potential future git archaeology at the expense of using your Libtool hacking time more wisely :)

Splitting the commit in two is simple enough, takes little time to do
and I don't feel obliged to test the intermediate state, so I just did
it.

But I will hold off the push a couple of days pending feedback from
those actually using .def files for real things.

Cheers,
Peter





Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 19 Jan 2013 05:13:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 19 00:13:23 2013
Received: from localhost ([127.0.0.1]:39439 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TwQk6-0001KY-Qb
	for submit <at> debbugs.gnu.org; Sat, 19 Jan 2013 00:13:23 -0500
Received: from caiajhbdcaib.dreamhost.com ([208.97.132.81]:40944
	helo=homiemail-a23.g.dreamhost.com)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <gary@HIDDEN>) id 1TwQk1-0001KM-6e
	for 13414 <at> debbugs.gnu.org; Sat, 19 Jan 2013 00:13:21 -0500
Received: from homiemail-a23.g.dreamhost.com (localhost [127.0.0.1])
	by homiemail-a23.g.dreamhost.com (Postfix) with ESMTP id 0522C4B006D;
	Fri, 18 Jan 2013 21:12:26 -0800 (PST)
Received: from [192.168.1.12] (unknown [183.89.58.65])
	(using TLSv1 with cipher AES128-SHA (128/128 bits))
	(No client certificate requested)
	(Authenticated sender: gary@HIDDEN)
	by homiemail-a23.g.dreamhost.com (Postfix) with ESMTPSA id 985764B0063; 
	Fri, 18 Jan 2013 21:12:25 -0800 (PST)
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<50F9D2E1.9040403@HIDDEN>
Mime-Version: 1.0 (1.0)
In-Reply-To: <50F9D2E1.9040403@HIDDEN>
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Message-Id: <404BC785-1F93-49D9-9E8A-E07A958B90C4@HIDDEN>
X-Mailer: iPad Mail (10A8500)
From: "Gary V. Vaughan" <gary@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
Date: Sat, 19 Jan 2013 12:12:22 +0700
To: Peter Rosin <peda@HIDDEN>
X-Spam-Score: 1.5 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
	has
	identified this incoming email as possible spam. The original message
	has been attached to this so you can view it (if it isn't spam) or
	label similar future email.  If you have any questions, see
	the administrator of that system for details.
	Content preview:  Hi Peter, Thanks for working on this. On 19 Jan 2013,
	at 05:55, 
	Peter Rosin <peda@HIDDEN> wrote: > On 2013-01-12 01:26,
	Peter Rosin wrote: >> On 2013-01-11 12:34,
	Martin Doucha wrote: >>> I'd like to report
	a bug in libtool 2.4 (including the latest git revision) which mangles
	valid
	DLL def files under MinGW and makes the linker barf. >> >> This issue
	has
	been reported before [1]. > > So, as hinted above, I'm following up with
	a pair of patches that > appear to mend this. > > Ok to push? [...] 
	Content analysis details:   (1.5 points, 10.0 required)
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,
	no trust [208.97.132.81 listed in list.dnswl.org]
	0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail)
	0.8 BAYES_50               BODY: Bayes spam probability is 40 to 60%
	[score: 0.5000]
	0.0 MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 chars
X-Debbugs-Envelope-To: 13414
Cc: "erik-gnu@HIDDEN" <erik-gnu@HIDDEN>,
	Martin Doucha <doucha@HIDDEN>,
	"13414 <at> debbugs.gnu.org" <13414 <at> debbugs.gnu.org>,
	Libtool Patches List <libtool-patches@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: 1.5 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has
 identified this incoming email as possible spam.  The original message
 has been attached to this so you can view it (if it isn't spam) or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Hi Peter, Thanks for working on this. On 19 Jan 2013, at 05:55,
    Peter Rosin <peda@HIDDEN> wrote: > On 2013-01-12 01:26, Peter Rosin
    wrote: >> On 2013-01-11 12:34, Martin Doucha wrote: >>> I'd like to report
    a bug in libtool 2.4 (including the latest git revision) which mangles valid
    DLL def files under MinGW and makes the linker barf. >> >> This issue has
    been reported before [1]. > > So, as hinted above, I'm following up with
   a pair of patches that > appear to mend this. > > Ok to push? [...] 
 
 Content analysis details:   (1.5 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
                             trust
                             [208.97.132.81 listed in list.dnswl.org]
  0.7 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
  0.8 BAYES_50               BODY: Bayes spam probability is 40 to 60%
                             [score: 0.5000]
  0.0 MIME_QP_LONG_LINE      RAW: Quoted-printable line longer than 76 chars

Hi Peter,

Thanks for working on this.

On 19 Jan 2013, at 05:55, Peter Rosin <peda@HIDDEN> wrote:
> On 2013-01-12 01:26, Peter Rosin wrote:
>> On 2013-01-11 12:34, Martin Doucha wrote:
>>> I'd like to report a bug in libtool 2.4 (including the latest git revisi=
on) which mangles valid DLL def files under MinGW and makes the linker barf.=

>>=20
>> This issue has been reported before [1].
>=20
> So, as hinted above, I'm following up with a pair of patches that
> appear to mend this.
>=20
> Ok to push?

By inspection, these patches look good to me - presuming there are no regres=
sions, please go ahead.

One nit: your new test has a Copyright notice starting at 2007 followed by "=
written in 2013". The new code doesn't look derivative of existing tests, so=
 I'd suggest deleting the years prior to 2013 before pushing.

> Or are the white-space changes in the first patch too intrusive?

If you would like to separate those into a separate patch then please feel f=
ree; but I'd rather see functional progress in Libtool development than bein=
g overly anal about changeset minutiae for potential future git archaeology a=
t the expense of using your Libtool hacking time more wisely :)

Cheers,
--=20
Gary V. Vaughan (gary AT gnu DOT org)=




Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 18 Jan 2013 22:59:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 18 17:59:25 2013
Received: from localhost ([127.0.0.1]:39232 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TwKuC-0000sm-Q2
	for submit <at> debbugs.gnu.org; Fri, 18 Jan 2013 17:59:25 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:40218)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peda@HIDDEN>) id 1TwKu8-0000sc-9f
	for 13414 <at> debbugs.gnu.org; Fri, 18 Jan 2013 17:59:23 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 07CEB4000A;
	Fri, 18 Jan 2013 23:58:31 +0100 (CET)
Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com
	[90.227.119.137])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id A946240008;
	Fri, 18 Jan 2013 23:58:30 +0100 (CET)
Message-ID: <50F9D396.40900@HIDDEN>
Date: Fri, 18 Jan 2013 23:58:30 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: Martin Doucha <doucha@HIDDEN>
Subject: [PATCH 2/2] libtool: factor out the dll .def file test and improve it
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<50F9D2E1.9040403@HIDDEN>
In-Reply-To: <50F9D2E1.9040403@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 13414
Cc: 13414 <at> debbugs.gnu.org, erik-gnu@HIDDEN,
	Libtool Patches List <libtool-patches@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Resolves bug#13414. Problem reported by Erik van Pienbroek
and Martin Doucha.

build-aux/ltmain.in (func_mode_link): Factor out the test if a
given symbol file is a module-definition (.def) file into...
(func_dll_def_p): ...this function, which also improves the check.
m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG)
<cygwin, mingw, pw32, cegcc>: Similarly, factor out the test if
a given symbol file is a module-definition (.def) file into...
(_LT_DLL_DEF_P): ...this macro, which also improves the check.
tests/export-def.at: New test.
Makefile.am (TESTSUITE_AT): Add above test.
NEWS: Update.
THANKS: Update.

Signed-off-by: Peter Rosin <peda@HIDDEN>

# Conflicts:
#
# 	m4/libtool.m4
---
 Makefile.am         |    1 +
 NEWS                |    3 +
 THANKS              |    2 +
 build-aux/ltmain.in |   19 +++++++-
 m4/libtool.m4       |   31 ++++++++---
 tests/export-def.at |  139 +++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 186 insertions(+), 9 deletions(-)
 create mode 100755 tests/export-def.at

diff --git a/Makefile.am b/Makefile.am
index a3e3c7d..e5f3805 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -627,6 +627,7 @@ TESTSUITE_AT	= tests/testsuite.at \
 		  tests/runpath-in-lalib.at \
 		  tests/static.at \
 		  tests/export.at \
+		  tests/export-def.at \
 		  tests/search-path.at \
 		  tests/indirect_deps.at \
 		  tests/archive-in-archive.at \
diff --git a/NEWS b/NEWS
index c202c43..514768b 100644
--- a/NEWS
+++ b/NEWS
@@ -66,6 +66,9 @@ NEWS - list of user-visible changes between releases of GNU Libtool
     the Microsoft Visual C/C++ linker via the -export-symbols argument to
     the libtool script, thus matching how .def files are handled when
     using GNU tools.
+  - Recognize more variants (e.g. those starting with a LIBRARY statement)
+    of module-definitions (.def) files when using them instead of a raw
+    list of symbols to export.
 
 ** Important incompatible changes:
 
diff --git a/THANKS b/THANKS
index d4c1f1b..92e6dff 100644
--- a/THANKS
+++ b/THANKS
@@ -98,6 +98,7 @@
   Edouard G. Parmelan		Edouard.Parmelan@HIDDEN
   Erez Zadok			ezk@HIDDEN
   Eric Estievenart		eric@HIDDEN
+  Erik van Pienbroek		erik-gnu@HIDDEN
   Ethan Mallove			ethan.mallove@HIDDEN
   Frank Ch. Eigler		fche@HIDDEN
   Fred Cox			sailorfred@HIDDEN
@@ -140,6 +141,7 @@
   Marcel Loose			loose@HIDDEN
   Mark Kettenis			kettenis@HIDDEN
   Markus Duft			markus.duft@HIDDEN
+  Martin Doucha			doucha@HIDDEN
   Matthijs Kooijman		matthijs@HIDDEN
   Micheal E. Faenza		mfaenza@HIDDEN
   Michael Haubenwallner		michael.haubenwallner@HIDDEN
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index eb224e3..f0168da 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -1316,6 +1316,23 @@ func_convert_path_nix_to_cygwin ()
 # end func_convert_path_nix_to_cygwin
 
 
+# func_dll_def_p FILE
+# True iff FILE is a Windows DLL '.def' file.
+# Keep in sync with _LT_DLL_DEF_P in libtool.m4
+func_dll_def_p ()
+{
+  $debug_cmd
+
+  func_dll_def_p_tmp=`$SED -n \
+    -e 's/^[ 	]*//' \
+    -e '/^\(;.*\)*$/d' \
+    -e 's/^\(EXPORTS\|LIBRARY\)\([ 	].*\)*$/DEF/p' \
+    -e q \
+    "$1"`
+  test DEF = "$func_dll_def_p_tmp"
+}
+
+
 # func_mode_compile arg...
 func_mode_compile ()
 {
@@ -7572,7 +7589,7 @@ EOF
 	cygwin* | mingw* | cegcc*)
 	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
 	    # exporting using user supplied symfile
-	    if test EXPORTS != "`$SED 1q $export_symbols`"; then
+	    if ! func_dll_def_p "$export_symbols"; then
 	      # and it's NOT already a .def file. Must figure out
 	      # which of the given symbols are data symbols and tag
 	      # them as such. So, trigger use of export_symbols_cmds.
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 4bc9e98..0a6c334 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3530,6 +3530,21 @@ _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
 ])# _LT_PATH_MANIFEST_TOOL
 
 
+# _LT_DLL_DEF_P([FILE])
+# ---------------------
+# True iff FILE is a Windows DLL '.def' file.
+# Keep in sync with func_dll_def_p in the libtool script
+AC_DEFUN([_LT_DLL_DEF_P],
+[dnl
+  test DEF = "`$SED -n dnl
+    -e '\''s/^[[ 	]]*//'\'' dnl Strip leading whitespace
+    -e '\''/^\(;.*\)*$/d'\'' dnl      Delete empty lines and comments
+    -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ 	]].*\)*$/DEF/p'\'' dnl
+    -e q dnl                          Only consider the first "real" line
+    $1`" dnl
+])# _LT_DLL_DEF_P
+
+
 # LT_LIB_M
 # --------
 # check for math library
@@ -4782,9 +4797,9 @@ _LT_EOF
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	# If the export-symbols file already is a .def file, use it as
+	# is; otherwise, prepend EXPORTS...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
           cp $export_symbols $output_objdir/$soname.def;
         else
           echo EXPORTS > $output_objdir/$soname.def;
@@ -5162,7 +5177,7 @@ _LT_EOF
 	shrext_cmds=.dll
 	# FIXME: Setting linknames here is a bad hack.
 	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
             cp "$export_symbols" "$output_objdir/$soname.def";
             echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
           else
@@ -6154,7 +6169,7 @@ if test yes != "$_lt_caught_CXX_error"; then
 	  shrext_cmds=.dll
 	  # FIXME: Setting linknames here is a bad hack.
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
               cp "$export_symbols" "$output_objdir/$soname.def";
               echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
             else
@@ -6194,9 +6209,9 @@ if test yes != "$_lt_caught_CXX_error"; then
 
 	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	    # If the export-symbols file already is a .def file (1st line
-	    # is EXPORTS), use it as is; otherwise, prepend...
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	    # If the export-symbols file already is a .def file, use it as
+	    # is; otherwise, prepend EXPORTS...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
               cp $export_symbols $output_objdir/$soname.def;
             else
               echo EXPORTS > $output_objdir/$soname.def;
diff --git a/tests/export-def.at b/tests/export-def.at
new file mode 100755
index 0000000..b8dfa55
--- /dev/null
+++ b/tests/export-def.at
@@ -0,0 +1,139 @@
+# export-def.at -- test module-definition files              -*- Autotest -*-
+
+#   Copyright (C) 2007-2008, 2011-2013 Free Software Foundation, Inc.
+#   Written by Peter Rosin, 2013
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+AT_SETUP([export from a DLL with a .def file])
+AT_KEYWORDS([libtool])
+
+AT_CHECK([$LIBTOOL --features | grep 'disable shared libraries' && (exit 77)],
+	 [1], [ignore])
+eval `$LIBTOOL --config | $EGREP '^(shrext_cmds|libname_spec|soname_spec)='`
+
+eval shared_ext=\"$shrext_cmds\"
+
+# skip if not building a .dll
+AT_CHECK([test .dll = "$shared_ext" || (exit 77)])
+
+LDFLAGS="$LDFLAGS -no-undefined"
+libdir=`pwd`/inst/lib
+mkdir inst inst/lib
+
+AT_DATA([a.c],
+[[/* a */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int v1 = -1;
+int v2 (void) { return -2; }
+
+#ifdef __cplusplus
+}
+#endif
+]])
+
+AT_DATA([syms],
+[[v1
+v2
+]])
+
+AT_DATA([def1],
+[[EXPORTS
+v1 DATA
+v2
+]])
+
+AT_DATA([def2],
+[[; Def file
+    ; with some very important comments
+EXPORTS
+v1 DATA
+v2
+]])
+
+AT_DATA([def3],
+[[
+   EXPORTS v1 DATA
+   v2
+]])
+
+AT_DATA([def4],
+[[	LIBRARY %soname%
+EXPORTS
+v1 DATA
+v2
+]])
+
+AT_DATA([main.c],
+[[
+/* w32 fun.  With GCC, you can have auto-import, which will work for
+ * functions and non-const variables.  With MSVC, you have to explicitly
+ * import all variables.
+ *
+ * For users, it's best to realize that they should not provide any
+ * non-function API at all.
+ */
+#if defined LIBA_DLL_IMPORT
+#  if defined _WIN32 && defined _MSC_VER
+#    define LIBA_SCOPE_VAR extern __declspec(dllimport)
+#  endif
+#endif
+#if !defined LIBA_SCOPE_VAR
+#  define LIBA_SCOPE_VAR extern
+#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+LIBA_SCOPE_VAR int v1;
+extern int v2(void);
+#ifdef __cplusplus
+}
+#endif
+
+int main (void)
+{
+  return v1 + v2() + 3;
+}
+]])
+
+name=a
+eval libname=\"$libname_spec\"
+major=0
+versuffix=-$major
+eval soname=\"$soname_spec\"
+
+AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c],[0],[ignore],[ignore])
+AT_CHECK([$CC $CPPFLAGS -DLIBA_DLL_IMPORT $CFLAGS -c main.c],[0],[ignore],[ignore])
+
+for exportsyms in syms def1 def2 def3 def4
+do
+  $SED "s/%soname%/$soname/" -i $exportsyms
+
+  LT_AT_CHECK([eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o liba.la a.lo \
+	       -rpath $libdir' -export-symbols $exportsyms], [], [ignore], [ignore])
+  AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT liba.la],
+	   [], [ignore], [ignore])
+  LT_AT_EXEC_CHECK([./main])
+done
+
+AT_CLEANUP
-- 
1.7.9






Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 18 Jan 2013 22:58:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 18 17:58:21 2013
Received: from localhost ([127.0.0.1]:39227 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TwKtA-0000r4-8i
	for submit <at> debbugs.gnu.org; Fri, 18 Jan 2013 17:58:21 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:33560)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peda@HIDDEN>) id 1TwKt6-0000qw-H6
	for 13414 <at> debbugs.gnu.org; Fri, 18 Jan 2013 17:58:19 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 4085F4000A;
	Fri, 18 Jan 2013 23:57:27 +0100 (CET)
Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com
	[90.227.119.137])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id DD41E40008;
	Fri, 18 Jan 2013 23:57:26 +0100 (CET)
Message-ID: <50F9D356.4070804@HIDDEN>
Date: Fri, 18 Jan 2013 23:57:26 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: Martin Doucha <doucha@HIDDEN>
Subject: [PATCH 1/2] libtool: allow tabs in $cmds variables
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<50F9D2E1.9040403@HIDDEN>
In-Reply-To: <50F9D2E1.9040403@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 13414
Cc: 13414 <at> debbugs.gnu.org, erik-gnu@HIDDEN,
	Libtool Patches List <libtool-patches@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

build-aux/ltmain.in (func_execute_cmds, func_mode_link): Don't collapse
tabs and surrounding whitespace into a single space when executing a
tilde-separated cmds construct, instead keep any tabs intact.
m4/libtool.m4: Convert indenting tabs to spaces for all *_cmds
variables affected by the above.

Signed-off-by: Peter Rosin <peda@HIDDEN>
---
 build-aux/ltmain.in |    8 ++-
 m4/libtool.m4       |  170 +++++++++++++++++++++++++-------------------------
 2 files changed, 91 insertions(+), 87 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index c8cdb9c..eb224e3 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -656,8 +656,10 @@ func_execute_cmds ()
 
     save_ifs=$IFS; IFS='~'
     for cmd in $1; do
-      IFS=$save_ifs
+      IFS=' ''
+'
       eval cmd=\"$cmd\"
+      IFS=$save_ifs
       func_show_eval "$cmd" "${2-:}"
     done
     IFS=$save_ifs
@@ -7964,8 +7966,10 @@ EOF
 
 	save_ifs=$IFS; IFS='~'
 	for cmd in $cmds; do
-	  IFS=$save_ifs
+	  IFS=' ''
+'
 	  eval cmd=\"$cmd\"
+	  IFS=$save_ifs
 	  $opt_quiet || {
 	    func_quote_for_expand "$cmd"
 	    eval "func_echo $func_quote_for_expand_result"
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index eb44de6..4bc9e98 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -4785,12 +4785,12 @@ _LT_EOF
 	# If the export-symbols file already is a .def file (1st line
 	# is EXPORTS), use it as is; otherwise, prepend...
 	_LT_TAGVAR(archive_expsym_cmds, $1)='if test EXPORTS = "`$SED 1q $export_symbols`"; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          cp $export_symbols $output_objdir/$soname.def;
+        else
+          echo EXPORTS > $output_objdir/$soname.def;
+          cat $export_symbols >> $output_objdir/$soname.def;
+        fi~
+        $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4868,9 +4868,9 @@ _LT_EOF
 
         if test yes = "$supports_anon_versioning"; then
           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
+            cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+            echo "local: *; };" >> $output_objdir/$libname.ver~
+            $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
         fi
 
 	case $cc_basename in
@@ -4881,9 +4881,9 @@ _LT_EOF
 	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test yes = "$supports_anon_versioning"; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+              echo "local: *; };" >> $output_objdir/$libname.ver~
+              $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -5163,13 +5163,13 @@ _LT_EOF
 	# FIXME: Setting linknames here is a bad hack.
 	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
 	_LT_TAGVAR(archive_expsym_cmds, $1)='if test EXPORTS = "`$SED 1q $export_symbols`"; then
-	    cp "$export_symbols" "$output_objdir/$soname.def";
-	    echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
-	  else
-	    $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
+            cp "$export_symbols" "$output_objdir/$soname.def";
+            echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+          else
+            $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+          fi~
+          $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+          linknames='
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
 	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -5178,18 +5178,18 @@ _LT_EOF
 	# Don't use ranlib
 	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
 	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile=$lt_outputfile.exe
-	      lt_tool_outputfile=$lt_tool_outputfile.exe
-	      ;;
-	  esac~
-	  if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
+          lt_tool_outputfile="@TOOL_OUTPUT@"~
+          case $lt_outputfile in
+            *.exe|*.EXE) ;;
+            *)
+              lt_outputfile=$lt_outputfile.exe
+              lt_tool_outputfile=$lt_tool_outputfile.exe
+              ;;
+          esac~
+          if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+            $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+            $RM "$lt_outputfile.manifest";
+          fi'
 	;;
       *)
 	# Assume MSVC wrapper
@@ -5445,7 +5445,7 @@ _LT_EOF
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
 	_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
+          $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -5460,20 +5460,20 @@ _LT_EOF
 	wlarc='$wl'
 	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+          $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
 	  wlarc=''
 	  _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
 	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+            $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
 	  ;;
 	*)
 	  wlarc='$wl'
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
 	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+            $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
 	  ;;
 	esac
       fi
@@ -6155,32 +6155,32 @@ if test yes != "$_lt_caught_CXX_error"; then
 	  # FIXME: Setting linknames here is a bad hack.
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
 	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test EXPORTS = "`$SED 1q $export_symbols`"; then
-	      cp "$export_symbols" "$output_objdir/$soname.def";
-	      echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
-	    else
-	      $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
+              cp "$export_symbols" "$output_objdir/$soname.def";
+              echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+            else
+              $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+            fi~
+            $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+            linknames='
 	  # The linker will not automatically build a static lib if we build a DLL.
 	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
 	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
 	  # Don't use ranlib
 	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
 	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile=$lt_outputfile.exe
-		lt_tool_outputfile=$lt_tool_outputfile.exe
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
+            lt_tool_outputfile="@TOOL_OUTPUT@"~
+            case $lt_outputfile in
+              *.exe|*.EXE) ;;
+              *)
+                lt_outputfile=$lt_outputfile.exe
+                lt_tool_outputfile=$lt_tool_outputfile.exe
+                ;;
+            esac~
+            func_to_tool_file "$lt_outputfile"~
+            if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+              $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+              $RM "$lt_outputfile.manifest";
+            fi'
 	  ;;
 	*)
 	  # g++
@@ -6197,12 +6197,12 @@ if test yes != "$_lt_caught_CXX_error"; then
 	    # If the export-symbols file already is a .def file (1st line
 	    # is EXPORTS), use it as is; otherwise, prepend...
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test EXPORTS = "`$SED 1q $export_symbols`"; then
-	      cp $export_symbols $output_objdir/$soname.def;
-	    else
-	      echo EXPORTS > $output_objdir/$soname.def;
-	      cat $export_symbols >> $output_objdir/$soname.def;
-	    fi~
-	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+              cp $export_symbols $output_objdir/$soname.def;
+            else
+              echo EXPORTS > $output_objdir/$soname.def;
+              cat $export_symbols >> $output_objdir/$soname.def;
+            fi~
+            $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
 	  else
 	    _LT_TAGVAR(ld_shlibs, $1)=no
 	  fi
@@ -6465,22 +6465,22 @@ if test yes != "$_lt_caught_CXX_error"; then
 	    case `$CC -V` in
 	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
-		$RANLIB $oldlib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+                $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+                $RANLIB $oldlib'
 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 	      ;;
 	    *) # Version 6 and above use weak symbols
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
@@ -6518,9 +6518,9 @@ if test yes != "$_lt_caught_CXX_error"; then
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
 	    if test yes = "$supports_anon_versioning"; then
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-		echo "local: *; };" >> $output_objdir/$libname.ver~
-		$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
+                cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+                echo "local: *; };" >> $output_objdir/$libname.ver~
+                $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
 	    fi
 	    ;;
 	  *)
@@ -6643,9 +6643,9 @@ if test yes != "$_lt_caught_CXX_error"; then
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
 	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~
-	          $RM $lib.exp'
+                  echo "-hidden">> $lib.exp~
+                  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~
+                  $RM $lib.exp'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
 		;;
 	    esac
@@ -6722,7 +6722,7 @@ if test yes != "$_lt_caught_CXX_error"; then
 	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	      $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+              $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
 	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -6759,7 +6759,7 @@ if test yes != "$_lt_caught_CXX_error"; then
 	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
 	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+                  $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
@@ -6770,7 +6770,7 @@ if test yes != "$_lt_caught_CXX_error"; then
 	        # platform.
 	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+                  $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
@@ -6830,9 +6830,9 @@ if test yes != "$_lt_caught_CXX_error"; then
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
-	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+              '"$_LT_TAGVAR(old_archive_cmds, $1)"
 	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
-	      '"$_LT_TAGVAR(reload_cmds, $1)"
+              '"$_LT_TAGVAR(reload_cmds, $1)"
 	    ;;
 	  *)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-- 
1.7.9






Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 18 Jan 2013 22:56:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 18 17:56:28 2013
Received: from localhost ([127.0.0.1]:39223 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TwKrL-0000o1-Ap
	for submit <at> debbugs.gnu.org; Fri, 18 Jan 2013 17:56:27 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:39781)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peda@HIDDEN>) id 1TwKrF-0000nm-RR
	for 13414 <at> debbugs.gnu.org; Fri, 18 Jan 2013 17:56:24 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 81F594000A;
	Fri, 18 Jan 2013 23:55:31 +0100 (CET)
Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com
	[90.227.119.137])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id 0301540008;
	Fri, 18 Jan 2013 23:55:29 +0100 (CET)
Message-ID: <50F9D2E1.9040403@HIDDEN>
Date: Fri, 18 Jan 2013 23:55:29 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: Martin Doucha <doucha@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
In-Reply-To: <50F0ADA2.5090102@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 13414
Cc: erik-gnu@HIDDEN, 13414 <at> debbugs.gnu.org,
	Libtool Patches List <libtool-patches@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Hi Martin, Erik,

On 2013-01-12 01:26, Peter Rosin wrote:
> Hi Martin,
> 
> Thanks for the report.
> 
> On 2013-01-11 12:34, Martin Doucha wrote:
>> Hi,
>> I'd like to report a bug in libtool 2.4 (including the latest git revision) which mangles valid DLL def files under MinGW and makes the linker barf.
>>
>> The bug is caused by incorect check for "EXPORTS" keyword in the def file which libtool does this way:
>> if test "x`$SED 1q $export_symbols`" != xEXPORTS; then ... [add another "EXPORTS" line at the beginning of file]
>>
>> This test is incorrect because the "EXPORTS" keyword does not have to appear on the very first line. You should replace the test with this:
>> if test "x`$GREP EXPORTS $export_symbols`" != xEXPORTS; then ...
>>
>> Also note that this test appears on several places throughout libtool sources (both as "xEXPORTS" and just "EXPORTS") so you need to fix all of them.
> 
> This issue has been reported before [1].
> 
> It's been on my back burner for a while, but I've been held up by
> build system issues. At least, that's my excuse :-)
> 
> Anyway, I think your suggested alternative with grep is a bit too
> relaxed, as any symbol involving the substring "EXPORTS" would
> trigger it. Also, it scans the whole file, which is suboptimal.
> 
> I'm looking into a patch that uses
> 
> 	$SED -n \
> 	    -e '/^[ 	]*//' \
> 	    -e '/^;/D' \
> 	    -e '/^$/D' \
> 	    -e 's/^EXPORTS.*/DEF/p' \
> 	    -e 's/^LIBRARY.*/DEF/p' \
> 	    -e q \
> 	    $export_symbols
> 
> instead (coupled with a test for "DEF" instead, naturally). Does
> anybody have any issues with such a beast? Yes, I know that it
> will not catch any valid .def file, but I don't fancy writing a
> full .def file parser for this [2].
> 
> The above steps past initial comment and whitespace lines waiting
> for the first "real" line, and triggers if it starts with EXPORTS
> or LIBRARY (at least, that's the intention...)
> 
> [1] http://lists.gnu.org/archive/html/libtool/2012-02/msg00023.html
> [2] http://msdn.microsoft.com/en-us/library/h41zhe21(v=vs.110).aspx

I'm back, with suggested changes against latest git, and I'm curious
if it is enough to solve your problem?

If you are not able to check for some reason, it might be possible for
you to provide the .def file you had the problem with? (this question
was mainly for Martin, Erik had enough specifics in his report)

Also, while I recognize that my evaluation of Martin's patch was
flawed in that his grep-based patch doesn't trigger on any symbol
with EXPORTS as a substring (which I stated, I was using the
mental model of my patch on his code, and stumbled), it still
reads the whole .def file and doesn't catch .def files with a
symbol on the same line as the EXPORTS keyword...

So, as hinted above, I'm following up with a pair of patches that
appear to mend this.

Ok to push?

Or are the white-space changes in the first patch too intrusive?

Cheers,
Peter





Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 18 Jan 2013 10:30:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 18 05:30:36 2013
Received: from localhost ([127.0.0.1]:37990 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Tw9DY-000601-3e
	for submit <at> debbugs.gnu.org; Fri, 18 Jan 2013 05:30:36 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:49051)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peda@HIDDEN>) id 1Tw9DU-0005zr-GO
	for 13414 <at> debbugs.gnu.org; Fri, 18 Jan 2013 05:30:34 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id D7E1540006;
	Fri, 18 Jan 2013 11:29:44 +0100 (CET)
Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com
	[90.227.119.137])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id 9051040005;
	Fri, 18 Jan 2013 11:29:44 +0100 (CET)
Message-ID: <50F92417.9080809@HIDDEN>
Date: Fri, 18 Jan 2013 11:29:43 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: Earnie Boyd <earnie@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<CA+sc5m=J18w9vFL53HKc01+bdnGSHtXK3Wz5PXO1pSid=s7MMQ@HIDDEN>
	<50F41291.8080509@HIDDEN>
	<CA+sc5mm2j1v3OnFRK_MXaBx0vvKFX0xZMswBkfurAfDEYzCsAg@HIDDEN>
In-Reply-To: <CA+sc5mm2j1v3OnFRK_MXaBx0vvKFX0xZMswBkfurAfDEYzCsAg@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 13414
Cc: 13414 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

On 2013-01-16 16:03, Earnie Boyd wrote:
> On Mon, Jan 14, 2013 at 9:13 AM, Peter Rosin wrote:
>> On 2013-01-13 16:56, Earnie Boyd wrote:
>>> On Fri, Jan 11, 2013 at 7:26 PM, Peter Rosin wrote:
>>>>         $SED -n \
>>>>             -e '/^[     ]*//' \
>>>>             -e '/^;/D' \
>>>>             -e '/^$/D' \
>>>>             -e 's/^EXPORTS.*/DEF/p' \
>>>>             -e 's/^LIBRARY.*/DEF/p' \
>>>>             -e q \
>>>>             $export_symbols

After some experimenting, I now have:

	$SED -n \
	    -e 's/^[ 	]*//' \
	    -e '/^\(;.*\)*$/d' \
	    -e 's/^\(EXPORTS\|LIBRARY\)\([ 	].*\)*$/DEF/p' \
	    -e q \
	    $export_symbols


>> I'm using libtool with MSVC, but I have never used a LIBRARY statement
>> myself.
>>
> 
> This alone is enough for libtool to consider it.

Consider what? Did you forget a negation?

>>> I.E.: The file containing LIBRARY tells the link command to create a
>>> DLL and the import library file (unless a .exp file is also used) but
>>> only if the /DLL switch is used.
>>
>> I don't understand this, I thought the /DLL switch accomplished most of
>> that by itself? I thought LIBRARY only provided the library name, which
>> can also be specified on the command line (using the -Fe option to cl.exe
>> or the -OUT option to link.exe). Since the command line overrides the
>> LIBRARY statement, it seems a bit useless from the libtool p.o.v. as
>> libtool is always providing the library name on the command line. No?
>>
> 
> So even though it exists it should be pretty much meaningless to libtool.

I did some tests to see how LIBRARY affects things and it turns out it
is not meaningless. What the MSDN documentation appears to mean is that
if you do not specify any library name on the command line, the LIBRARY
statements set the name of the DLL file. But the name referred to inside
the import library will always be the name provided with the LIBRARY
statement, regardless of any command line options.

I.e., when libtool is called like this:

	./libtool --mode=link ./compile cl foo.lo -o foo.la \
	-no-undefined -rpath /nowhere

the relevant parts (after going through a bunch of layers) with a
libtool configured for MSVC is:

	cl .libs/foo.obj -Fe.libs/foo-0.dll \
	-link -dll -implib:.libs/foo.dll.lib

(which means, link foo.obj into a -dll named foo-0.dll and also generate
an import library named foo.dll.lib)

If you then mix in a .def file starting with

	LIBRARY bar

you will get the same names of the files (foo-0.dll and foo.dll.lib), but
executables linked with foo.dll.lib will require the non-existing bar.dll
at runtime.

Similarly, the relevant parts with a libtool configured for GNU is:

	gcc -shared .libs/a.o -o .libs/cyga-0.dll \
	-Xlinker --out-implib -Xlinker .libs/liba.dll.a

and mixing in a .def file starting with

	LIBRARY bar

seems to have the same effect here, namely still create a cyga-0.dll
and an import lib liba.dll.a, but executables linked with liba.dll.a
will request bar.dll at runtime.

So, the LIBRARY statement does have an effect (not that you can currently
use it with libtool, I had to patch things to make it work for the
above tests) but I'm not sure how you can make any sane use of the
feature. I mean, whats the point of referring to a non-existant dll?
I guess you can rename the .dll file manually as a post-processing
step so that the import library is pointing to something that exists,
but that seems a bit convoluted.

>> To me, this is only about libtool recognizing preexisting .def files
>> that are written without libtool in mind (or at least, not with only
>> libtool in mind), and not about supporting constructs in .def that are
>> actually needed by libtool. From the libtool side, the .def file needs
>> to (currently) start with EXPORTS, and since LIBRARY (and NAME)
>> statements are of no use to libtool they might just as well be zapped
>> so that EXPORTS actually is first. But if you want to use the same .def
>> file from a non-libtool setting, you might have some very good reason
>> to include LIBRARY (or NAME) in it, and then you'd want to have that
>> as the first statement (according to MSDN). But that kills things in
>> libtool, since it then prepends a faulty EXPORTS to the .def file (it's
>> wrongly assuming that the perfectly fine .def file is a plain symbol
>> list when the file doesn't start with EXPORTS).
> 
> There can be only one LIBRARY statement and it must be on the first
> non-empty line of the file.
> 
> However from http://msdn.microsoft.com/en-us/library/hyx1zcd3(v=vs.71).aspx
> we see:
> 
> The EXPORTS statement introduces a section of one or more definitions
> that are exported functions or data. Each definition must be on a
> separate line. The EXPORTS keyword can be on the same line as the
> first definition or on a preceding line. The .def file can contain one
> or more EXPORTS statements.

This .def file seems to work just fine to export a "v1" data item and
a "v2" function using GNU tools:

	EXPORT v1 DATA v2

But the MSVC linker barf and wants one symbol per line, e.g. like this

	EXPORT v1 DATA
	v2

When reading the MSDN about .def files, I agree with the GNU interpretation,
but I have found MSDN to be lacking in a great many places, so one should
never put more than one symbol on one line I suppose...

> Notice the last sentence of the quote.  Also notice that the first
> definition can be on the same line as the EXPORTS keyword.

Yes, I saw that.

Cheers,
Peter





Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 16 Jan 2013 15:04:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 16 10:04:02 2013
Received: from localhost ([127.0.0.1]:35412 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1TvUX3-00047V-Q7
	for submit <at> debbugs.gnu.org; Wed, 16 Jan 2013 10:04:02 -0500
Received: from mail-qc0-f178.google.com ([209.85.216.178]:56978)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eboyd53sf@HIDDEN>) id 1TvUX1-00047M-Er
	for 13414 <at> debbugs.gnu.org; Wed, 16 Jan 2013 10:04:00 -0500
Received: by mail-qc0-f178.google.com with SMTP id j34so949183qco.9
	for <13414 <at> debbugs.gnu.org>; Wed, 16 Jan 2013 07:03:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:x-received:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type;
	bh=vpiKllQ19zHcDiIC60BG6fSFQg03hyp4JMD0LpyGoKc=;
	b=EVtNbBMDjSYfPsrQ1sjiImkTBN8rABXjItOiFugJAnG3FJGEMQ6noNzKX9XetZBJww
	82BNG6W1l36ILR+IMbhN4yyKwnCV5hC6ScwYWX98P/JrLNwMrsaVeWO1yxawFwAOaCzx
	1ESJyMreYlIhNE9GIj8Z7pxQizhrKQVIFGE3twIOuwb7vuuXGWCuLs0RFARVqItO3Wnf
	OVWg2h3jiPisuBRp6nniu+WjAgfkahkjPKzV98N+hBU5Qd9nKRLQFpuzXWQej5Sdx9/X
	wTUwKRx272kSGzQOao3QtaUDvns0wBnnp/Q7HpUrYq5SUhO1urhpLrmvOSwIuUdtH+yH
	m2NA==
MIME-Version: 1.0
X-Received: by 10.229.195.81 with SMTP id eb17mr353530qcb.93.1358348603379;
	Wed, 16 Jan 2013 07:03:23 -0800 (PST)
Received: by 10.49.116.5 with HTTP; Wed, 16 Jan 2013 07:03:23 -0800 (PST)
In-Reply-To: <50F41291.8080509@HIDDEN>
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<CA+sc5m=J18w9vFL53HKc01+bdnGSHtXK3Wz5PXO1pSid=s7MMQ@HIDDEN>
	<50F41291.8080509@HIDDEN>
Date: Wed, 16 Jan 2013 10:03:23 -0500
X-Google-Sender-Auth: nfX9XMkyNgIU17gj4RcS22r5O2A
Message-ID: <CA+sc5mm2j1v3OnFRK_MXaBx0vvKFX0xZMswBkfurAfDEYzCsAg@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
From: Earnie Boyd <earnie@HIDDEN>
To: Peter Rosin <peda@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: 0.1 (/)
X-Debbugs-Envelope-To: 13414
Cc: 13414 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

On Mon, Jan 14, 2013 at 9:13 AM, Peter Rosin wrote:
> On 2013-01-13 16:56, Earnie Boyd wrote:
>> On Fri, Jan 11, 2013 at 7:26 PM, Peter Rosin wrote:
>>>         $SED -n \
>>>             -e '/^[     ]*//' \
>>>             -e '/^;/D' \
>>>             -e '/^$/D' \
>>>             -e 's/^EXPORTS.*/DEF/p' \
>>>             -e 's/^LIBRARY.*/DEF/p' \
>>>             -e q \
>>>             $export_symbols
>>>
>>> instead (coupled with a test for "DEF" instead, naturally). Does
>>> anybody have any issues with such a beast? Yes, I know that it
>>> will not catch any valid .def file, but I don't fancy writing a
>>> full .def file parser for this [2].
>>>
>>> The above steps past initial comment and whitespace lines waiting
>>> for the first "real" line, and triggers if it starts with EXPORTS
>>> or LIBRARY (at least, that's the intention...)
>>
>> Does GCC DTRT with LIBRARY?  Or is anyone using libtool with MSVC?
>
> A short while binutils required "LIBRARY", if present, to be the first
> statement in the .def file (which is a requirement consistent with
> MSDN). I believe this requirement has been lifted from binutils.
>

Yes, based on the documentation LIBRARY should be the first line of
the file and the name is optional.

> I'm using libtool with MSVC, but I have never used a LIBRARY statement
> myself.
>

This alone is enough for libtool to consider it.

>> I.E.: The file containing LIBRARY tells the link command to create a
>> DLL and the import library file (unless a .exp file is also used) but
>> only if the /DLL switch is used.
>
> I don't understand this, I thought the /DLL switch accomplished most of
> that by itself? I thought LIBRARY only provided the library name, which
> can also be specified on the command line (using the -Fe option to cl.exe
> or the -OUT option to link.exe). Since the command line overrides the
> LIBRARY statement, it seems a bit useless from the libtool p.o.v. as
> libtool is always providing the library name on the command line. No?
>

So even though it exists it should be pretty much meaningless to libtool.

> To me, this is only about libtool recognizing preexisting .def files
> that are written without libtool in mind (or at least, not with only
> libtool in mind), and not about supporting constructs in .def that are
> actually needed by libtool. From the libtool side, the .def file needs
> to (currently) start with EXPORTS, and since LIBRARY (and NAME)
> statements are of no use to libtool they might just as well be zapped
> so that EXPORTS actually is first. But if you want to use the same .def
> file from a non-libtool setting, you might have some very good reason
> to include LIBRARY (or NAME) in it, and then you'd want to have that
> as the first statement (according to MSDN). But that kills things in
> libtool, since it then prepends a faulty EXPORTS to the .def file (it's
> wrongly assuming that the perfectly fine .def file is a plain symbol
> list when the file doesn't start with EXPORTS).

There can be only one LIBRARY statement and it must be on the first
non-empty line of the file.

However from http://msdn.microsoft.com/en-us/library/hyx1zcd3(v=vs.71).aspx
we see:

The EXPORTS statement introduces a section of one or more definitions
that are exported functions or data. Each definition must be on a
separate line. The EXPORTS keyword can be on the same line as the
first definition or on a preceding line. The .def file can contain one
or more EXPORTS statements.

Notice the last sentence of the quote.  Also notice that the first
definition can be on the same line as the EXPORTS keyword.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd




Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 14 Jan 2013 14:14:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 14 09:14:06 2013
Received: from localhost ([127.0.0.1]:59481 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Tukne-0008Hi-FE
	for submit <at> debbugs.gnu.org; Mon, 14 Jan 2013 09:14:06 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:55562)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peda@HIDDEN>) id 1Tuknc-0008HZ-42
	for 13414 <at> debbugs.gnu.org; Mon, 14 Jan 2013 09:14:05 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id D107640022;
	Mon, 14 Jan 2013 15:13:38 +0100 (CET)
Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com
	[90.227.119.137])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id 659EA4001E;
	Mon, 14 Jan 2013 15:13:38 +0100 (CET)
Message-ID: <50F41291.8080509@HIDDEN>
Date: Mon, 14 Jan 2013 15:13:37 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: Earnie Boyd <earnie@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
References: <50EFF8C2.2050505@HIDDEN> <50F0ADA2.5090102@HIDDEN>
	<CA+sc5m=J18w9vFL53HKc01+bdnGSHtXK3Wz5PXO1pSid=s7MMQ@HIDDEN>
In-Reply-To: <CA+sc5m=J18w9vFL53HKc01+bdnGSHtXK3Wz5PXO1pSid=s7MMQ@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 13414
Cc: 13414 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: 0.8 (/)

On 2013-01-13 16:56, Earnie Boyd wrote:
> On Fri, Jan 11, 2013 at 7:26 PM, Peter Rosin wrote:
>>         $SED -n \
>>             -e '/^[     ]*//' \
>>             -e '/^;/D' \
>>             -e '/^$/D' \
>>             -e 's/^EXPORTS.*/DEF/p' \
>>             -e 's/^LIBRARY.*/DEF/p' \
>>             -e q \
>>             $export_symbols
>>
>> instead (coupled with a test for "DEF" instead, naturally). Does
>> anybody have any issues with such a beast? Yes, I know that it
>> will not catch any valid .def file, but I don't fancy writing a
>> full .def file parser for this [2].
>>
>> The above steps past initial comment and whitespace lines waiting
>> for the first "real" line, and triggers if it starts with EXPORTS
>> or LIBRARY (at least, that's the intention...)
> 
> Does GCC DTRT with LIBRARY?  Or is anyone using libtool with MSVC?

A short while binutils required "LIBRARY", if present, to be the first
statement in the .def file (which is a requirement consistent with
MSDN). I believe this requirement has been lifted from binutils.

I'm using libtool with MSVC, but I have never used a LIBRARY statement
myself.

> I.E.: The file containing LIBRARY tells the link command to create a
> DLL and the import library file (unless a .exp file is also used) but
> only if the /DLL switch is used.

I don't understand this, I thought the /DLL switch accomplished most of
that by itself? I thought LIBRARY only provided the library name, which
can also be specified on the command line (using the -Fe option to cl.exe
or the -OUT option to link.exe). Since the command line overrides the
LIBRARY statement, it seems a bit useless from the libtool p.o.v. as
libtool is always providing the library name on the command line. No?

To me, this is only about libtool recognizing preexisting .def files
that are written without libtool in mind (or at least, not with only
libtool in mind), and not about supporting constructs in .def that are
actually needed by libtool. From the libtool side, the .def file needs
to (currently) start with EXPORTS, and since LIBRARY (and NAME)
statements are of no use to libtool they might just as well be zapped
so that EXPORTS actually is first. But if you want to use the same .def
file from a non-libtool setting, you might have some very good reason
to include LIBRARY (or NAME) in it, and then you'd want to have that
as the first statement (according to MSDN). But that kills things in
libtool, since it then prepends a faulty EXPORTS to the .def file (it's
wrongly assuming that the perfectly fine .def file is a plain symbol
list when the file doesn't start with EXPORTS).

I might easily be missing something...

Cheers,
Peter





Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at 13414 <at> debbugs.gnu.org:


Received: (at 13414) by debbugs.gnu.org; 12 Jan 2013 00:26:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 11 19:26:27 2013
Received: from localhost ([127.0.0.1]:55913 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ttova-0002ll-Iy
	for submit <at> debbugs.gnu.org; Fri, 11 Jan 2013 19:26:27 -0500
Received: from mail.lysator.liu.se ([130.236.254.3]:48811)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peda@HIDDEN>) id 1TtovW-0002lZ-Us
	for 13414 <at> debbugs.gnu.org; Fri, 11 Jan 2013 19:26:24 -0500
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id EF56340006;
	Sat, 12 Jan 2013 01:26:11 +0100 (CET)
Received: from [192.168.0.64] (90-227-119-137-no95.business.telia.com
	[90.227.119.137])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id 9904F40005;
	Sat, 12 Jan 2013 01:26:11 +0100 (CET)
Message-ID: <50F0ADA2.5090102@HIDDEN>
Date: Sat, 12 Jan 2013 01:26:10 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version: 1.0
To: Martin Doucha <doucha@HIDDEN>
Subject: Re: bug#13414: Valid DLL def file mangled by libtool
References: <50EFF8C2.2050505@HIDDEN>
In-Reply-To: <50EFF8C2.2050505@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: 0.8 (/)
X-Debbugs-Envelope-To: 13414
Cc: 13414 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: 0.8 (/)

Hi Martin,

Thanks for the report.

On 2013-01-11 12:34, Martin Doucha wrote:
> Hi,
> I'd like to report a bug in libtool 2.4 (including the latest git revision) which mangles valid DLL def files under MinGW and makes the linker barf.
> 
> The bug is caused by incorect check for "EXPORTS" keyword in the def file which libtool does this way:
> if test "x`$SED 1q $export_symbols`" != xEXPORTS; then ... [add another "EXPORTS" line at the beginning of file]
> 
> This test is incorrect because the "EXPORTS" keyword does not have to appear on the very first line. You should replace the test with this:
> if test "x`$GREP EXPORTS $export_symbols`" != xEXPORTS; then ...
> 
> Also note that this test appears on several places throughout libtool sources (both as "xEXPORTS" and just "EXPORTS") so you need to fix all of them.

This issue has been reported before [1].

It's been on my back burner for a while, but I've been held up by
build system issues. At least, that's my excuse :-)

Anyway, I think your suggested alternative with grep is a bit too
relaxed, as any symbol involving the substring "EXPORTS" would
trigger it. Also, it scans the whole file, which is suboptimal.

I'm looking into a patch that uses

	$SED -n \
	    -e '/^[ 	]*//' \
	    -e '/^;/D' \
	    -e '/^$/D' \
	    -e 's/^EXPORTS.*/DEF/p' \
	    -e 's/^LIBRARY.*/DEF/p' \
	    -e q \
	    $export_symbols

instead (coupled with a test for "DEF" instead, naturally). Does
anybody have any issues with such a beast? Yes, I know that it
will not catch any valid .def file, but I don't fancy writing a
full .def file parser for this [2].

The above steps past initial comment and whitespace lines waiting
for the first "real" line, and triggers if it starts with EXPORTS
or LIBRARY (at least, that's the intention...)

[1] http://lists.gnu.org/archive/html/libtool/2012-02/msg00023.html
[2] http://msdn.microsoft.com/en-us/library/h41zhe21(v=vs.110).aspx

Cheers,
Peter





Information forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Jan 2013 15:53:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 11 10:53:11 2013
Received: from localhost ([127.0.0.1]:55678 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Ttgut-0007OL-9B
	for submit <at> debbugs.gnu.org; Fri, 11 Jan 2013 10:53:11 -0500
Received: from eggs.gnu.org ([208.118.235.92]:33172)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <doucha@HIDDEN>) id 1TtdDI-0000ow-2H
	for submit <at> debbugs.gnu.org; Fri, 11 Jan 2013 06:55:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <doucha@HIDDEN>) id 1TtdD1-0000tF-G0
	for submit <at> debbugs.gnu.org; Fri, 11 Jan 2013 06:55:44 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,
	RECEIVED_FROM_WINDOWS_HOST autolearn=no version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:43862)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <doucha@HIDDEN>) id 1TtdD1-0000t9-De
	for submit <at> debbugs.gnu.org; Fri, 11 Jan 2013 06:55:39 -0500
Received: from eggs.gnu.org ([208.118.235.92]:44506)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <doucha@HIDDEN>) id 1TtdCy-00068r-DF
	for bug-libtool@HIDDEN; Fri, 11 Jan 2013 06:55:39 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <doucha@HIDDEN>) id 1TtdCq-0000rP-Sj
	for bug-libtool@HIDDEN; Fri, 11 Jan 2013 06:55:36 -0500
Received: from u121-99.static.grapesc.cz ([78.111.121.99]:59721
	helo=integri.cz) by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <doucha@HIDDEN>) id 1TtdCq-0000qs-Lr
	for bug-libtool@HIDDEN; Fri, 11 Jan 2013 06:55:28 -0500
X-Footer: aW50ZWdyaS5jeg==
Received: from localhost ([127.0.0.1]) by integri.cz (Kerio Connect 7.4.1)
	(using TLSv1/SSLv3 with cipher AES256-SHA (256 bits))
	for bug-libtool@HIDDEN; Fri, 11 Jan 2013 12:41:40 +0100
Message-ID: <50EFF8C2.2050505@HIDDEN>
Date: Fri, 11 Jan 2013 12:34:26 +0100
From: Martin Doucha <doucha@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:16.0) Gecko/20121026 Thunderbird/16.0.2
MIME-Version: 1.0
To: bug-libtool@HIDDEN
Subject: Valid DLL def file mangled by libtool
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 11 Jan 2013 10:53:10 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.2 (----)

Hi,
I'd like to report a bug in libtool 2.4 (including the latest git 
revision) which mangles valid DLL def files under MinGW and makes the 
linker barf.

The bug is caused by incorect check for "EXPORTS" keyword in the def 
file which libtool does this way:
if test "x`$SED 1q $export_symbols`" != xEXPORTS; then ... [add another 
"EXPORTS" line at the beginning of file]

This test is incorrect because the "EXPORTS" keyword does not have to 
appear on the very first line. You should replace the test with this:
if test "x`$GREP EXPORTS $export_symbols`" != xEXPORTS; then ...

Also note that this test appears on several places throughout libtool 
sources (both as "xEXPORTS" and just "EXPORTS") so you need to fix all 
of them.

Regards,
Martin Doucha





Acknowledgement sent to Martin Doucha <doucha@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-libtool@HIDDEN. Full text available.
Report forwarded to bug-libtool@HIDDEN:
bug#13414; Package libtool. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.