On Mon, Mar 22, 2010 at 05:41:07PM +0200, Kirill A. Shutemov wrote: > > Do they?  https://fedoraproject.org/wiki/GoldLinking - > > "may make it default linker in the future", with no schedule. > Do you think they rebuild packages with gold just for fun? ;) This does not look solid: https://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking "Dangerous default behaviour", blah-blah-blah. I hope they have fun, though. :-) > > By the way, I'm not sure if gold(1) can do the --as-needed thing. > > Probably we need to implement it, too. > > Yes, it can. It's default behavior. And it's not necessary to specify > libraries you want to link with at the end of command line. Can you please refer to a piece of source code where --as-needed logic is implemented? And is there an option like --no-as-needed then? You see, generally there can be two ld modes. 1) Dumb mode: just do what you see on the command line. You're just a special cat(1) for object files. Resolving symbols is none of your business. 2) Smart mode: try to do the right thing. Find implicit dependencies and remove unused libraries, based on how symbols are resolved. So the hallmark is whether a link editor should involve into resolving symbols (at all). The problem is that any implementation which supports symbol versioning _has_ to resolve symbols (to make versioned references). And since support for symbols is already there, it is hard to resist the temptation to implement "smart options"... I believe that "--as-need" + "--copy-dt-needed-entries" makes sense - it's a smart mode, and it does the right thing, most of the time.