[ada] [patch] gnatlink's order of options interfers with --as-needed
Matthias Klose
doko@ubuntu.com
Fri Apr 19 15:35:00 GMT 2013
Am 19.04.2013 14:14, schrieb Arnaud Charlet:
> Can you clarify what problem you are trying to solve (e.g. by providing
> a testcase, explaining what you are doing and you would expect)?
from http://bugs.debian.org/680292
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.
More information about the Gcc-patches
mailing list