This is the mail archive of the
mailing list for the binutils project.
RE: Add STB_SECONDARY to gABI
> -----Original Message-----
> From: firstname.lastname@example.org [mailto:generic-
> email@example.com] On Behalf Of H.J. Lu
> Sent: 28 June 2012 07:55 PM
> To: firstname.lastname@example.org
> Cc: GCC Development; Binutils; GNU C Library; Ansari, Zia
> Subject: Re: Add STB_SECONDARY to gABI
> On Thu, Jun 28, 2012 at 7:12 AM, Suprateeka R Hegde
> <email@example.com> wrote:
> > The write-up looks good.
> > Two typos:
> > 1. An instance of "week" instead of "weak"
> > 2. Some text mention "linker" and some other mention "link
> Fixed in the revised proposal.
> > Question: will this be part of the current gABI draft soon?
> That is a good question. I don't know if the gABI draft is
> being actively maintained at the moment.
Then we have to get it active. What is the process? Or else,
these standards might get accumulated either over emails or
as comments in the tool chain's sources.
> We want to provide a relocatable object which can take advantage of
> versions of a supported OS. For a function, foo, in the C library,
> can use it only if it is available on all versions of the C library
> we provide our own implementation of foo. With our own foo, the one
> the C library will never be used. Here is a proposal to add
> to gABI to support the secondary definition so that a software
> can provide an alternative implementation in case it isn't available
> in the C library.
> Secondary symbols are similar to weak symbols, but their
> have lower precedence than global and weak symbols. The
> between secondary symbols and weak symbols are
> 1. The link editor ignores the secondary definition if there is
> a global, weak or common definition with the same name.
> secondary definitions with the same name will not cause an
> The first appearance of the secondary definition should be
> and the rest are ignored.
> 2. The link editor must search archive library and extract
> archive members to resolve defined and undefined secondary
> 3. When the link editor searches a shared object, it must
> the global or weak definition in the shared object and ignore
> secondary one with the same name.
> 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
> 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
> object, the link editor may convert them to global or local
> 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
> Otherwise, the secondary definition will be used.
> If the dlopen loads a global or weak definition after the
> has already resolved references to a secondary definition,
> 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
> to the global or weak definition.
> STB_SECONDARY is defined as:
> #define STB_SECONDARY 3 /* Secondary symbol */
> The behavior of secondary symbols in areas not specified by
> 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 firstname.lastname@example.org.
> To unsubscribe from this group, send email to generic-
> For more options, visit this group at