[lld] r285062 - Update for llvm change.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 25 05:02:31 PDT 2016
Author: rafael
Date: Tue Oct 25 07:02:31 2016
New Revision: 285062
URL: http://llvm.org/viewvc/llvm-project?rev=285062&view=rev
Log:
Update for llvm change.
Modified:
lld/trunk/ELF/InputFiles.cpp
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=285062&r1=285061&r2=285062&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Oct 25 07:02:31 2016
@@ -694,8 +694,7 @@ static uint8_t mapVisibility(GlobalValue
}
template <class ELFT>
-static Symbol *createBitcodeSymbol(DenseSet<CachedHashStringRef> &KeptComdats,
- DenseSet<CachedHashStringRef> &ComdatGroups,
+static Symbol *createBitcodeSymbol(const std::vector<bool> &KeptComdats,
const lto::InputFile::Symbol &ObjSym,
StringSaver &Saver, BitcodeFile *F) {
StringRef NameRef = Saver.save(ObjSym.getName());
@@ -706,22 +705,10 @@ static Symbol *createBitcodeSymbol(Dense
uint8_t Visibility = mapVisibility(ObjSym.getVisibility());
bool CanOmitFromDynSym = ObjSym.canBeOmittedFromSymbolTable();
- StringRef C = check(ObjSym.getComdat());
- if (!C.empty()) {
- auto CH = CachedHashStringRef(C);
- bool Keep = KeptComdats.count(CH);
- if (!Keep) {
- StringRef N = Saver.save(C);
- CachedHashStringRef NH(N, CH.hash());
- if (ComdatGroups.insert(NH).second) {
- Keep = true;
- KeptComdats.insert(NH);
- }
- }
- if (!Keep)
- return Symtab<ELFT>::X->addUndefined(NameRef, Binding, Visibility, Type,
- CanOmitFromDynSym, F);
- }
+ int C = check(ObjSym.getComdatIndex());
+ if (C != -1 && !KeptComdats[C])
+ return Symtab<ELFT>::X->addUndefined(NameRef, Binding, Visibility, Type,
+ CanOmitFromDynSym, F);
if (Flags & BasicSymbolRef::SF_Undefined)
return Symtab<ELFT>::X->addUndefined(NameRef, Binding, Visibility, Type,
@@ -750,10 +737,16 @@ void BitcodeFile::parse(DenseSet<CachedH
Obj = check(lto::InputFile::create(MemoryBufferRef(
MB.getBuffer(), Saver.save(ArchiveName + MB.getBufferIdentifier() +
utostr(OffsetInArchive)))));
- DenseSet<CachedHashStringRef> KeptComdats;
+
+ std::vector<bool> KeptComdats;
+ for (StringRef S : Obj->getComdatTable()) {
+ StringRef N = Saver.save(S);
+ KeptComdats.push_back(ComdatGroups.insert(CachedHashStringRef(N)).second);
+ }
+
for (const lto::InputFile::Symbol &ObjSym : Obj->symbols())
- Symbols.push_back(createBitcodeSymbol<ELFT>(KeptComdats, ComdatGroups,
- ObjSym, Saver, this));
+ Symbols.push_back(
+ createBitcodeSymbol<ELFT>(KeptComdats, ObjSym, Saver, this));
}
template <template <class> class T>
More information about the llvm-commits
mailing list