Linux Archive

Linux Archive (
-   Debian GCC (
-   -   Bug#680292: gnatmake: linker arguments order incompatible with --as-needed (

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.

package Bug is
end Bug;
-- bug.gpr
project Bug is
for Library_Name use "bug";
for Library_Version use "";
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, /tmp/bug/bug.o
$ gnatclean -Pbug
$ gprbuild -v -Pbug
/usr/bin/gcc-4.6 -shared ... -lgnat-4.6 ... -Wl,-soname, /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

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

To UNSUBSCRIBE, email to
with a subject of "unsubscribe". Trouble? Contact

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.