[PATCH] MCJIT honor symbol visibility settings when populating the global symbol table
Rafael EspĂndola
rafael.espindola at gmail.com
Fri Aug 22 13:54:06 PDT 2014
if (ESym->getVisibility() == ELF::STV_DEFAULT &&
+ (ESym->getBinding() == ELF::STB_GLOBAL || ESym->getBinding() ==
ELF::STB_WEAK))
+ Result |= SymbolRef::SF_Exported;
ELF::STV_PROTECTED should also be exported.
On 22 August 2014 16:15, Lang Hames <lhames at gmail.com> wrote:
> The RuntimeDyld side of this looks good to me.
>
> Rafael - I'd appreciate your take on the ELF changes. If the "st_other"
> field in Elf_Sym_Base is going to be used solely for visibility (as it seems
> in this patch), should it be renamed to "st_visibility" ?
No, st_other is the name used in the spec. The low 2 bits are the
visibility, the others are 0. Maybe expand the comment a bit?
+ unsigned char getVisibility() const { return st_other; }
Add a " & 3 " to get only the low bits. If you want, assert that the
high bits are zero.
+ SF_Exported = 1U << 6, // Symbol is visible by other modules
Modules is ambiguous. A hidden symbol is visible from another .o. DSO
is probably a better description.
+ void setVisibility(unsigned char v) { st_other = v; }
assert that v has only two bits set. Only set the last two bits or
assert the rest is zero.
Cheers,
Rafael
More information about the llvm-commits
mailing list