This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: Add STB_SECONDARY to gABI
- From: "Lowell, Randy" <Randy dot Lowell at hp dot com>
- To: "generic-abi at googlegroups dot com" <generic-abi at googlegroups dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>,"GNU C Library" <libc-alpha at sourceware dot org>, "Ansari, Zia"<zia dot ansari at intel dot com>
- Date: Thu, 28 Jun 2012 13:43:57 +0000
- Subject: RE: Add STB_SECONDARY to gABI
- References: <CAMe9rOp5KkoVJV52nRO_X5ek-hSScttSZFgJgQNAHnYVybCKHQ@mail.gmail.com><F4135B89B3F3E8418F97AC4644C7678D3AE913E6@G9W0750.americas.hpqcorp.net><000101cd31f0$43af5ad0$cb0e1070$@gmail.com><F4135B89B3F3E8418F97AC4644C7678D3AE914D0@G9W0750.americas.hpqcorp.net><CAMe9rOpkTfoR1-0nDquDQsm96yp0YzghfDNc_sRm62J47X1Z-Q@mail.gmail.com>
This looks good. I just have one wordsmithing comment.
I would have listed the STB_SECONDARY differences in a different
order -- maybe (3 1 2 4). That puts the most general difference
first, and it matches the order used for the description of
STB_WEAK.
Randy
> -----Original Message-----
> From: generic-abi@googlegroups.com [mailto:generic-
> abi@googlegroups.com] On Behalf Of H.J. Lu
> Sent: Wednesday, June 27, 2012 12:06 PM
> To: generic-abi@googlegroups.com
> Cc: GCC Development; Binutils; GNU C Library; Ansari, Zia
> Subject: Re: Add STB_SECONDARY to gABI
>
> Hi,
>
> Resending with plain text.
>
> Here is the final proposal to add STB_SECONDARY to gABI.
> Any comments?
>
> Thanks.
>
> --
> H.J.
> ---
> We want to provide a relocatable object which can take advantage of all
> versions of a supported OS. For a function, foo, in the C library, we
> can use it only if it is available on all versions of the C library or
> we provide our own implementation of foo. With our own foo, the one in
> the C library will never be used. Here is a proposal to add STB_SECONDARY
> to gABI to support the secondary definition so that a software vendor
> can provide an alternative implementation in case it isn't available
> in the C library.
>
> STB_SECONDARY
>
> Secondary symbols are similar to weak symbols, but their definitions
> have lower precedence than global and week symbols. The difference
> between secondary symbols and weak symbols are
>
> 1. The link editor must search archive library and extract
> archive members to resolve defined and undefined secondary symbol.
> 2. When the link editor searches a shared object, it must honor
> the global or weak definition in the shared object and ignore the
> secondary one with the same name.
> 3. The link editor ignores the secondary definition if there is
> a global, weak or common definition with the same name. Multiple
> secondary definitions with the same name will not cause an error.
> The first appearance of the secondary definition should be honored
> and the rest are ignored.
> 4. The link editor may treat the secondary definition in the
> shared object as a global definition.
>
> The purpose of this symbol binding is to provide the primary
> definition as a global, weak or common symbol in an archive library
> or a shared object while keeping a secondary definition in a
> relocatable object. If there is no primary definition, the
> secondary definition will be used.
>
> When secondary definitions become part of an executable or shared
> object, linker may convert them to global or local definitions.
>
> At run-time, when resolving a symbol, after seeing a secondary
> definition, the dynamic linker must keep searching until a
> global or weak definition is found. If a global or weak
> definition is found, it will be used to satisfy the symbol lookup.
> Otherwise, the secondary definition will be used.
>
> If the dlopen loads a global or weak definition after the program
> has already resolved references to a secondary definition, those
> references remain bound to the secondary definition. Any
> references resolved after the dlopen, for which the dlopened
> module is included in the module search list, would be resolved
> to the global or weak definition.
>
> STB_SECONDARY is defined as:
>
> #define STB_SECONDARY 3 /* Secondary symbol */
>
> NOTE:
> The behavior of secondary symbols in areas not specified by this
> proposal is implementation defined.
>
> --
> 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 generic-abi@googlegroups.com.
> To unsubscribe from this group, send email to generic-
> abi+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/generic-abi?hl=en.