RFC: Add STB_GNU_SECONDARY
Ian Lance Taylor
Fri Apr 20 23:51:00 GMT 2012
"H.J. Lu" <firstname.lastname@example.org> writes:
> On Fri, Apr 20, 2012 at 3:59 PM, Ian Lance Taylor <email@example.com> wrote:
>> "H.J. Lu" <firstname.lastname@example.org> writes:
>>> On Fri, Apr 20, 2012 at 3:10 PM, Cary Coutant <email@example.com> wrote:
>>>>> We only have very few bits to in STB_XXX field.
>>>> This is exactly why I'm not in favor of this extension. The feature
>>>> doesn't seem compelling enough to use up one of these precious
>>>> reserved values (in fact, you're using the next-to-last one that's
>>>> reserved for OS use).
>>>> You want a backup definition? Put a weak def at the end of the link line.
>>> It doesn't work for us since the backup definition is
>>> always used even if there is a normal definition in
>>> a shared library or an archive.
>> Can you expand on that? How can you refer to the backup definition if
>> there is a normal definition?
> We need a definition for symbol, foo. Since we don't know if there
> is a definition of foo at the final link time. We provide the backup
> definition for foo. The backup one is ignored if there is a normal one in
> an archive or DSO at link time.
That use case would be satisfied by Cary's suggestion of adding a weak
definition of the symbol in an object included at the end of the link
More information about the Binutils