[lld] r285875 - Pass the sections to getShtGroupSignature.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 2 19:28:14 PDT 2016
Author: rafael
Date: Wed Nov 2 21:28:13 2016
New Revision: 285875
URL: http://llvm.org/viewvc/llvm-project?rev=285875&view=rev
Log:
Pass the sections to getShtGroupSignature.
This avoids fetching it again from the object.
Modified:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/InputFiles.h
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=285875&r1=285874&r2=285875&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Nov 2 21:28:13 2016
@@ -202,9 +202,12 @@ void elf::ObjectFile<ELFT>::parse(DenseS
// 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>::initializeSe
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)) {
Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=285875&r1=285874&r2=285875&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Wed Nov 2 21:28:13 2016
@@ -126,7 +126,8 @@ template <class ELFT> class ObjectFile :
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:
More information about the llvm-commits
mailing list