RFC: Add STB_GNU_SECONDARY
Fri Apr 20 19:51:00 GMT 2012
We have a need to define a secondary symbol as backup in
case there isn't a primary one. Here is a proposal for
STB_GNU_SECONDARY. Any comments?
Secondary symbols are similar to weak symbols, but their definitions
have even lower precedence. Secondary symbols can only appear in a
relocatable object. They must be either removed or converted to
global or local symbols once it has become part of an executable or
shared object. The difference between secondary symbols and weak
1. When the link editor searches an archive library, it must
extracts archive members that contain the global, weak or common
definition of the secondary symbol with the same name and ignore
the secondary one.
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.
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.
STB_GNU_SECONDARY is defined in OS-specific range:
#define STB_LOOS 10 /* OS-specific semantics */
#define STB_GNU_UNIQUE 10 /* Symbol is unique in namespace */
#define STB_GNU_SECONDARY 11 /* Secondary symbol */
#define STB_LOOS 12 /* OS-specific semantics */
More information about the Binutils