On Thu, 2010-02-11 at 11:06 +0100, yersinia wrote:
On Tue, Feb 9, 2010 at 3:38 PM, Adam Jackson ajax@redhat.com wrote:
--no-add-needed is quite different. Your binary a.out uses symbols from libfoo and libbar. libfoo is linked against libbar. But your link line only says -lfoo. --add-needed behaviour, the old default, would implicitly add a "-lbar" as well. --no-add-needed, the new default, will not, and therefore your link will probably fail.
This is the case described in the libtool manual
http://www.gnu.org/software/libtool/manual/html_node/Inter_002dlibrary-depen...
Nice to know that Fedora will have the same behavior of the AIX libraries in this area, if I understood correctly the topic under discussion.
This change does not imply AIX linker semantics.
Note that _libraries_ generally do not have a problem building in a --no-add-needed world. ELF does not require that all references in a DSO be resolvable at ld time, and this linking change does not change that. If your library libfoo uses symbols from libbar but does not itself link against libbar, that's still legal (although probably impolite).
Executables, however, must be fully resolved at link time. You can ask for this to be true for libraries as well with the --no-allow-shlib-undefined option to ld. This plus --no-add-needed is much closer to the AIX linker behaviour,
Also note that the runtime linker will still do recursive lookups. If you have a binary that did not link against some needed library, but one of its dependencies did link against it, the binary will still work.
- ajax