This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Add STB_SECONDARY support
On Tue, Jul 3, 2012 at 7:31 AM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Jul 03, 2012 at 04:38:29AM -0700, H.J. Lu wrote:
>> This is not transparent to programmers. Programmers shouldn't
>> need to make any changes to their build environment other than
>> installing a new binutils.
>
> What on earth are you talking about?
>
> You gave me your main usage requirement involving a library provided
> by an ISV. I showed how your hypothetical ISV can provide a library
> as a specially marked archive containing the backup functions/data,
> and have your hypothetical user link this, without any change other
> than installing a new linker. No ELF ABI changes needed. Sounds
> pretty simple to me. Easy for the ISV too. In fact, you wouldn't
> even need to use weak symbols in the archive.
>
> Now if your ISV wants to provide a "normal" library as well as a
> "backup" one, but for some reason wants this to be available to the
> linker in a single -lisv option, then just use a linker script as we
> do for libc.so. Packaging problem solved. Hmm, and that leads to
> another idea. Simply invent a linker script keyword that says to link
> a file last, and then you don't even need specially marked archives.
>
> User links with -lisv as he always has. ISV provides libisv.so (or
> libisv.a), a script containing
> INPUT ( -lisvnormal )
> INPUT_AT_END ( -lisvbackup )
>
> Remember also that I don't have to convince you that your ABI
> extension is unnecessary. You have to convince us that it is needed.
>
This scheme works for simple link-time backup. It doesn't
work with backup symbol defined in DSO. You can't override
it at run-time.
Weak symbol spec is very limited and many behaviors are
implementation defined. Secondary symbol provides a better-defined
"weak" symbol, which is the same as dynamic weak symbol in
glibc.
--
H.J.