Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian GCC (http://www.linux-archive.org/debian-gcc/)
-   -   Bug#680292: gnatmake: linker arguments order incompatible with --as-needed (http://www.linux-archive.org/debian-gcc/680201-bug-680292-gnatmake-linker-arguments-order-incompatible-needed.html)

Nicolas Boulenguez 07-04-2012 08:16 PM

Bug#680292: gnatmake: linker arguments order incompatible with --as-needed
 
Package: gnat-4.6
Version: 4.6.3-4
Severity: minor

Hello. Gnatmake calls gcc -shared in a way incompatible with
--as-needed. Gprbuild uses a better ordering.

-- bug.ads
package Bug is
end Bug;
-- bug.gpr
project Bug is
for Library_Name use "bug";
for Library_Version use "libbug.so.1";
for Library_Kind use "dynamic";
for Library_Dir use "lib";
for Library_Options use ("-lncurses");
end Bug;
$ mkdir lib
$ gnatmake -v -Pbug
...
/usr//bin/gcc-4.6 -shared ... -lncurses ... -lgnat-4.6 -Wl,-soname,libbug.so.1 /tmp/bug/bug.o
...
$ gnatclean -Pbug
...
$ gprbuild -v -Pbug
...
/usr/bin/gcc-4.6 -shared ... -lgnat-4.6 ... -Wl,-soname,libbug.so.1 /tmp/bug/bug.o -lncurses
...

When adding -Wl,--as-needed before -lncurses in Library_Options (or
using GNU gold linker with default options), symbols from -lgnat-4.6
are ignored because they are not used by any object *yet*. In this
minimal example, this is not a problem, but any useful library will
use symbols from -lgnat-4.6.

As a more real-life example, read dpkg_shlibdeps warnings when building
libtexttools-2.1.0-1 with

LDFLAGS += -Wl,--as-needed # or remove the lines stripping it
BUILDER_OPTIONS += -v

-- System Information:
ii gcc-4.6 4.6.3-1



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/20120704201655.GA14911@pegase


All times are GMT. The time now is 02:50 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.