Hi Cary and Everyone,
Now that we're about to have a living gABI again, I have
a piece of old unfinished business that I'd like to add to the
backlog for discussion.
Almost 13 years ago, in August of 2007, Rod made a proposal to this
list, to widen the visibility mask for st_other from 2 to 3 bits,
and to add new STV_ definitions. You can find that thread here:
https://groups.google.com/forum/#!topic/generic-abi/AahK3BVmYWQ
That thread didn't get wild support, nor angry rejection. Instead,
there's an amicable discussion about what it means, and of
alternatives, and then, of reasons not to chase those alternatives.
Finally, there was a wrap up that restated the proposal, and no
further discussion. The process for gABI additions was sort of fuzzy
in those days, so we thought that it had been accepted, and went
on to implement those changes. However, they didn't get added
to the gABI document, and so, we have a long standing divergence,
and the potential for a future conflict.
The Solaris <sys/elf.h> contains these details:
#define ELF32_ST_VISIBILITY(other) ((other)&0x7)
#define ELF64_ST_VISIBILITY(other) ((other)&0x7)
#define STV_DEFAULT 0
#define STV_INTERNAL 1
#define STV_HIDDEN 2
#define STV_PROTECTED 3
#define STV_EXPORTED 4
#define STV_SINGLETON 5
#define STV_ELIMINATE 6
#define STV_NUM 7
while <elf.h> on a Linux system still shows
#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
/* For ELF64 the definitions are the same. */
#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
/* Symbol visibility specification encoded in the st_other field. */
#define STV_DEFAULT 0 /* Default symbol visibility rules */
#define STV_INTERNAL 1 /* Processor specific hidden class */
#define STV_HIDDEN 2 /* Sym unavailable in other modules */
#define STV_PROTECTED 3 /* Not preemptible, not exported */
Unlike most of ELF, st_other has no OSABI or platform ranges, so
there's no OSABI area that could have been used instead, hence the
form of Rod's proposal. We would have made these OSABI specific
if that had been an option, and yet, I can't argue that st_other
should be carved up that way. The unused bits in st_other are
reserved against unknown future need, and there's just not a
lot of wasted space to play with. The real estate is just too
precious to carve up in this way. And so, we have to work out
these details, case by case. Thankfully, this isn't an area
where lots of changes occur.
I'd appreciate it if the gABI could recognize the existing
definitions from Rod's 2007 proposal. As Rod pointed out
back then, this is mainly a namespace issue. There's no
need for any other ELF implementations to implement them.
The primary goal is to reserve values 4-6 against being
assigned other meanings.
Thanks.
- Ali