[devel] Q: --no-copy-dt-needed-entries

Kirill A. Shutemov kirill на shutemov.name
Пн Мар 22 18:31:59 UTC 2010


2010/3/22 Alexey Tourbin <at на altlinux.ru>:
> 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.

Currently, valid changing of linking in a library may break building
of a package which links to it (directly or indirectly). And cause of
breakage will not be obvious..

> 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?

See Layout::finish_dynamic_section() at layout.cc. I guess it's what you want.

> And is there an option like --no-as-needed then?

Yes. See General_options::as_needed.

>
> 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.

Reading the bug that you have specified, I have the impression that
--copy-dt-needed-entries is a hack in GNU ld to workaround buggy
software. Do you know a linker, except GNU ld, which provides simmilar
fuctionallity?

>
> _______________________________________________
> Devel mailing list
> Devel на lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel
>


Подробная информация о списке рассылки Devel