[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/13710] New: [Regression] .def files containing LIBRARY statement

From: erik-sources-redhat-bugzilla at vanpienbroek dot nl
Subject: [Bug ld/13710] New: [Regression] .def files containing LIBRARY statement can't be parsed any more
Date: Sun, 19 Feb 2012 22:30:44 +0000


             Bug #: 13710
           Summary: [Regression] .def files containing LIBRARY statement
                    can't be parsed any more
           Product: binutils
           Version: 2.23 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
                CC: address@hidden
    Classification: Unclassified
            Target: i686-w64-mingw32, x86_64-w64-mingw32

In the last couple of days a change was applied to binutils which makes the
behaviour of the processing of .def files more strict. Due to this change some
libraries fail to compile, for example cairo.

The .def file which is used by cairo contains something along the lines of

LIBRARY mylib.dll

This used to work fine with binutils, but when using binutils this results in the following error:

a.def:3: syntax error
file format not recognized; treating as linker script
syntax error
collect2: error: ld returned 1 exit status

After some discussion with Kai Tietz we came to the conclusion that these type
of .def files are invalid according to MSDN:

This documentation indicates that .def files must start with the 'LIBRARY
xxx.dll' statement followed by the 'EXPORTS' statement, so in this regard the
more strict behaviour of binutils is correct.

So I tried fixing cairo so that it uses a .def file which looks like this:

LIBRARY mylib.dll

While doing so I noticed that libtool also tries to do some funny things with
the .def file:

libtool: link: if test "x`/bin/sed 1q .libs/libcairo.def`" = xEXPORTS; then cp
.libs/libcairo.def .libs/libcairo-2.dll.def; else echo EXPORTS >
.libs/libcairo-2.dll.def; cat .libs/libcairo.def >> .libs/libcairo-2.dll.def;

It looks like libtool always checks the first line of the given .def file. If
this first line isn't 'EXPORTS' then it will be automatically added to the
resulting .def file. Given the .def file above, the resulting .def file will

LIBRARY mylib.dll

This .def file isn't accepted by binutils as well.

So to fix all this, changes have to be applied to both cairo and libtool.
However, the annoying thing with libtool is that every libtool-using piece of
software is bundling their own copy of libtool so it will take quite some time
before a patched version of libtool is really in use. While I agree that
binutils should be as compliant and strict as possible I think that the damage
here is worse than the benefits. So I would like to suggest that this change in
behaviour in binutils is reverted to the old behaviour (for now) and that we
also try to get this fixed properly in libtool, cairo and perhaps several other
pieces of software.

Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]