mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
[MCJIT] Make MCJIT honor symbol visibility settings when populating the global
symbol table. Patch by Anthony Pesch. Thanks Anthony! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220245 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1458,25 +1458,29 @@ struct Elf32_Sym {
|
||||
Elf32_Addr st_value; // Value or address associated with the symbol
|
||||
Elf32_Word st_size; // Size of the symbol
|
||||
unsigned char st_info; // Symbol's type and binding attributes
|
||||
unsigned char st_other; // Must be zero; reserved
|
||||
unsigned char st_other; // Visibility in the lower 2 bits, the rest is zero
|
||||
Elf32_Half st_shndx; // Which section (header table index) it's defined in
|
||||
|
||||
// These accessors and mutators correspond to the ELF32_ST_BIND,
|
||||
// ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
|
||||
unsigned char getBinding() const { return st_info >> 4; }
|
||||
unsigned char getType() const { return st_info & 0x0f; }
|
||||
unsigned char getVisibility() const { return st_other & 0x3; }
|
||||
void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
|
||||
void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
|
||||
void setBindingAndType(unsigned char b, unsigned char t) {
|
||||
st_info = (b << 4) + (t & 0x0f);
|
||||
}
|
||||
void setVisibility(unsigned char v) {
|
||||
st_other = (st_other & ~0x3) | (v & 0x3);
|
||||
}
|
||||
};
|
||||
|
||||
// Symbol table entries for ELF64.
|
||||
struct Elf64_Sym {
|
||||
Elf64_Word st_name; // Symbol name (index into string table)
|
||||
unsigned char st_info; // Symbol's type and binding attributes
|
||||
unsigned char st_other; // Must be zero; reserved
|
||||
unsigned char st_other; // Visibility in the lower 2 bits, the rest is zero
|
||||
Elf64_Half st_shndx; // Which section (header tbl index) it's defined in
|
||||
Elf64_Addr st_value; // Value or address associated with the symbol
|
||||
Elf64_Xword st_size; // Size of the symbol
|
||||
@@ -1485,11 +1489,15 @@ struct Elf64_Sym {
|
||||
// symbol table entries.
|
||||
unsigned char getBinding() const { return st_info >> 4; }
|
||||
unsigned char getType() const { return st_info & 0x0f; }
|
||||
unsigned char getVisibility() const { return st_other & 0x3; }
|
||||
void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
|
||||
void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
|
||||
void setBindingAndType(unsigned char b, unsigned char t) {
|
||||
st_info = (b << 4) + (t & 0x0f);
|
||||
}
|
||||
void setVisibility(unsigned char v) {
|
||||
st_other = (st_other & ~0x3) | (v & 0x3);
|
||||
}
|
||||
};
|
||||
|
||||
// The size (in bytes) of symbol table entries.
|
||||
|
Reference in New Issue
Block a user