aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-07-15 11:47:54 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-07-15 11:47:54 +0000
commit15d21983bc257655e8cc6b0bd33ca630f09da550 (patch)
tree774373902708d91453b70f23bccca771ac478c9d
parent1bf9ab1ee1563db627574f8ed5b0b5f34721b881 (diff)
[LLD][ELF] - Minor simplification. NFC.
This removes a call to `object::getSymbol<ELFT>`. We used this function in a next way: it was given an array of symbols and index and returned either a symbol at the index given or a error. This function was removed in D64631. (rL366052, but was reverted because of LLD compilation error that I didn't know about). It does not make much sense to keep this function on LLVM side only for LLD, because having only a list of symbols and the index it is not able to produce a valueable error message about context anyways. git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@366057 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--ELF/InputFiles.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/ELF/InputFiles.cpp b/ELF/InputFiles.cpp
index 919012fd2..470d877f3 100644
--- a/ELF/InputFiles.cpp
+++ b/ELF/InputFiles.cpp
@@ -466,9 +466,11 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
template <class ELFT>
StringRef ObjFile<ELFT>::getShtGroupSignature(ArrayRef<Elf_Shdr> sections,
const Elf_Shdr &sec) {
- const Elf_Sym *sym =
- CHECK(object::getSymbol<ELFT>(this->getELFSyms<ELFT>(), sec.sh_info), this);
- StringRef signature = CHECK(sym->getName(this->stringTable), this);
+ typename ELFT::SymRange symbols = this->getELFSyms<ELFT>();
+ if (sec.sh_info >= symbols.size())
+ fatal(toString(this) + ": invalid symbol index");
+ const typename ELFT::Sym &sym = symbols[sec.sh_info];
+ StringRef signature = CHECK(sym.getName(this->stringTable), this);
// As a special case, if a symbol is a section symbol and has no name,
// we use a section name as a signature.
@@ -477,7 +479,7 @@ StringRef ObjFile<ELFT>::getShtGroupSignature(ArrayRef<Elf_Shdr> sections,
// standard, but GNU gold 1.14 (the newest version as of July 2017) or
// older produce such sections as outputs for the -r option, so we need
// a bug-compatibility.
- if (signature.empty() && sym->getType() == STT_SECTION)
+ if (signature.empty() && sym.getType() == STT_SECTION)
return getSectionName(sec);
return signature;
}