Change to DSO-linking semantics of the compiler

Charley Wang chwang at redhat.com
Wed Jan 13 15:09:48 UTC 2010


----- "Jussi Lehtola" <jussilehtola at fedoraproject.org> wrote:
> 
> So is --as-needed within the current default flags?

As far as I know, no. The default will still be --no-as-needed.

If anyone reading this is interested/confused, I think the 
difference is:

The --as-needed flag will link libraries if
A) they define symbols required by object files
B) those symbols are still undefined when the library is checked

With the --as-needed option it is possible that libraries 
explicitly specified on the command line will not get
linked. e.g. if I specify '--as-needed -l1 -l2' where the object
files only require -l1 and -l1 depends on -l2, -l2 will not get 
linked.

The default behaviour is (and afaik will remain) --no-as-needed.

The new feature will link libraries explicitly passed on the 
command line, but will not automatically link dependencies. So
if -l1 depends on -l2, I have to pass '-l1 -l2' to the command line.
Having done so, however, I will then know that -l1 and -l2 will be
linked.

This is afaik, please feel free to correct me if I am mistaken :)

-Charley


More information about the devel mailing list