This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RFC: Add STB_GNU_SECONDARY
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "Ansari, Zia" <zia dot ansari at intel dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>, GNU C Library <libc-alpha at sourceware dot org>, Binutils <binutils at sourceware dot org>
- Date: Fri, 20 Apr 2012 12:47:15 -0700
- Subject: RFC: Add STB_GNU_SECONDARY
Hi,
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?
Thanks.
--
H.J.
---
STB_GNU_SECONDARY
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
symbols are
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 */