discarding rules for duplicate ELF comdat groups

48 views
Skip to first unread message

Jan Beulich

unread,
Feb 1, 2011, 4:14:00 AM2/1/11
to gener...@googlegroups.com, binu...@sourceware.org
I had originally brought this up on the binutils mailing list, but it
was suggested to bring this up in this more generic forum:

It seems like currently the rule simply is to pick the first instance the
linker gets to see. Wouldn't it make sense to honor the group
signature's attributes (namely its binding), and prefer keeping an
instance with a global group signature over a weak or local one?
That would allow the programmer some control over which
instance to keep: My main motivation is to find a way to discard
the various weak fallback functions Linux has to cover cases where
e.g. some architectures implement certain functionality, while
others that don't can all use a generic implementation.

I cannot see other mechanisms that would allow ld to discard
sections (not to speak of individual functions within sections).

Thanks, Jan

Jan Beulich

unread,
Feb 8, 2011, 3:20:17 AM2/8/11
to Jim Dehnert, gener...@googlegroups.com
>>> On 08.02.11 at 03:42, Jim Dehnert <deh...@google.com> wrote:
> Did you ever get an answer to this? It's been a long time since

Not so far, no. Thus - thanks for responding!

> I've been involved, so take the following with that in mind...
>
> ELF comdat groups are intended to allow removal of equivalent
> sections _without_ forcing the compilers and linkers to play games
> with weak symbols and such, e.g., for things like C++ virtual function
> tables, trampoline functions, etc. The entire point is to make the
> processing in the linker absolutely trivial -- take the first one and
> eliminate the rest -- without burdening compilers.

Hmm, this is only about removal of (equivalent) duplicates, but
what I'm asking about is a mechanism by which a weak function
could be removed once its symbol got overridden by a strong
one.

> So yes, your interpretation of the rule is correct, and no, it wouldn't
> make sense to turn it into something more complex. That would
> be at odds with the rationale for the feature in the first place.

I understand that the feature should make the linker's job as
simple as possible, but I'm nevertheless wondering whether
some flexibility could be added - whether that's through the
use of weak symbols or a new group flag or yet something
else would be secondary to me.

Jan

>> --
>> You received this message because you are subscribed to the Google Groups
>> "Generic System V Application Binary Interface" group.
>> To post to this group, send email to gener...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> generic-abi...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/generic-abi?hl=en.
>>
>>
>


Reply all
Reply to author
Forward
0 new messages