Change to DSO-linking semantics of the compiler

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

----- "Jussi Lehtola" <jussilehtola at> 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 

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

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


More information about the devel mailing list