mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
Don't get confused with sections whose section number is reserved.
It is perfectly possible for SHNDX to contain indexes that have the same value as reserved st_shndx values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -401,7 +401,7 @@ public:
|
||||
|
||||
uint64_t getNumSections() const;
|
||||
uintX_t getStringTableIndex() const;
|
||||
ELF::Elf64_Word getSymbolTableIndex(const Elf_Sym *symb) const;
|
||||
ELF::Elf64_Word getExtendedSymbolTableIndex(const Elf_Sym *symb) const;
|
||||
const Elf_Ehdr *getHeader() const { return Header; }
|
||||
const Elf_Shdr *getSection(const Elf_Sym *symb) const;
|
||||
const Elf_Shdr *getSection(uint32_t Index) const;
|
||||
@@ -510,10 +510,10 @@ void ELFFile<ELFT>::LoadVersionMap() const {
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
ELF::Elf64_Word ELFFile<ELFT>::getSymbolTableIndex(const Elf_Sym *symb) const {
|
||||
if (symb->st_shndx == ELF::SHN_XINDEX)
|
||||
return ExtendedSymbolTable.lookup(symb);
|
||||
return symb->st_shndx;
|
||||
ELF::Elf64_Word
|
||||
ELFFile<ELFT>::getExtendedSymbolTableIndex(const Elf_Sym *symb) const {
|
||||
assert(symb->st_shndx == ELF::SHN_XINDEX);
|
||||
return ExtendedSymbolTable.lookup(symb);
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
|
||||
@@ -278,7 +278,7 @@ template <class ELFT>
|
||||
std::error_code ELFObjectFile<ELFT>::getSymbolAddress(DataRefImpl Symb,
|
||||
uint64_t &Result) const {
|
||||
const Elf_Sym *ESym = getSymbol(Symb);
|
||||
switch (EF.getSymbolTableIndex(ESym)) {
|
||||
switch (ESym->st_shndx) {
|
||||
case ELF::SHN_COMMON:
|
||||
case ELF::SHN_UNDEF:
|
||||
Result = UnknownAddress;
|
||||
@@ -383,11 +383,10 @@ uint32_t ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Symb) const {
|
||||
EIter == EF.begin_symbols() || EIter == EF.begin_dynamic_symbols())
|
||||
Result |= SymbolRef::SF_FormatSpecific;
|
||||
|
||||
if (EF.getSymbolTableIndex(ESym) == ELF::SHN_UNDEF)
|
||||
if (ESym->st_shndx == ELF::SHN_UNDEF)
|
||||
Result |= SymbolRef::SF_Undefined;
|
||||
|
||||
if (ESym->getType() == ELF::STT_COMMON ||
|
||||
EF.getSymbolTableIndex(ESym) == ELF::SHN_COMMON)
|
||||
if (ESym->getType() == ELF::STT_COMMON || ESym->st_shndx == ELF::SHN_COMMON)
|
||||
Result |= SymbolRef::SF_Common;
|
||||
|
||||
if (isExportedToOtherDSO(ESym))
|
||||
|
||||
Reference in New Issue
Block a user