summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-11-03 02:28:13 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-11-03 02:28:13 +0000
commit7c7abafd81df5a67c2cd30009b39abc692389504 (patch)
treec01400942d0f70fb6f8635d12ce778e0dd5a8a54 /lld/ELF/InputFiles.cpp
parent203ff0d3c953f4802c6a89376991457b43ad099c (diff)
downloadbcm5719-llvm-7c7abafd81df5a67c2cd30009b39abc692389504.tar.gz
bcm5719-llvm-7c7abafd81df5a67c2cd30009b39abc692389504.zip
Pass the sections to getShtGroupSignature.
This avoids fetching it again from the object. llvm-svn: 285875
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
-rw-r--r--lld/ELF/InputFiles.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 3e55dbb4655..bce506eb8ef 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -202,9 +202,12 @@ void elf::ObjectFile<ELFT>::parse(DenseSet<CachedHashStringRef> &ComdatGroups) {
// They are identified and deduplicated by group name. This function
// returns a group name.
template <class ELFT>
-StringRef elf::ObjectFile<ELFT>::getShtGroupSignature(const Elf_Shdr &Sec) {
+StringRef
+elf::ObjectFile<ELFT>::getShtGroupSignature(ArrayRef<Elf_Shdr> Sections,
+ const Elf_Shdr &Sec) {
const ELFFile<ELFT> &Obj = this->ELFObj;
- const Elf_Shdr *Symtab = check(Obj.getSection(Sec.sh_link));
+ const Elf_Shdr *Symtab =
+ check(object::getSection<ELFT>(Sections, Sec.sh_link));
const Elf_Sym *Sym = Obj.getSymbol(Symtab, Sec.sh_info);
StringRef Strtab = check(Obj.getStringTableForSymtab(*Symtab));
return check(Sym->getName(Strtab));
@@ -299,7 +302,9 @@ void elf::ObjectFile<ELFT>::initializeSections(
switch (Sec.sh_type) {
case SHT_GROUP:
Sections[I] = &InputSection<ELFT>::Discarded;
- if (ComdatGroups.insert(CachedHashStringRef(getShtGroupSignature(Sec)))
+ if (ComdatGroups
+ .insert(
+ CachedHashStringRef(getShtGroupSignature(ObjSections, Sec)))
.second)
continue;
for (uint32_t SecIndex : getShtGroupEntries(Sec)) {
OpenPOWER on IntegriCloud