summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--lld/ELF/InputFiles.cpp11
-rw-r--r--lld/ELF/InputFiles.h3
2 files changed, 10 insertions, 4 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)) {
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index d9f996aa2aa..adbb0be6a71 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -126,7 +126,8 @@ template <class ELFT> class ObjectFile : public ELFFileBase<ELFT> {
typedef typename ELFT::Word Elf_Word;
typedef typename ELFT::uint uintX_t;
- StringRef getShtGroupSignature(const Elf_Shdr &Sec);
+ StringRef getShtGroupSignature(ArrayRef<Elf_Shdr> Sections,
+ const Elf_Shdr &Sec);
ArrayRef<Elf_Word> getShtGroupEntries(const Elf_Shdr &Sec);
public:
OpenPOWER on IntegriCloud