[lld] r242112 - Revert "Make COFF linker work when it's built by clang again."
Rui Ueyama
ruiu at google.com
Mon Jul 13 20:09:59 PDT 2015
Author: ruiu
Date: Mon Jul 13 22:09:59 2015
New Revision: 242112
URL: http://llvm.org/viewvc/llvm-project?rev=242112&view=rev
Log:
Revert "Make COFF linker work when it's built by clang again."
This reverts commit r242006. The original issue in Clang was fixed in r242009,
so we can now safely use std::atomic_flag.
Modified:
lld/trunk/COFF/InputFiles.cpp
lld/trunk/COFF/InputFiles.h
Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=242112&r1=242111&r2=242112&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Mon Jul 13 22:09:59 2015
@@ -71,6 +71,12 @@ std::error_code ArchiveFile::parse() {
if (B->getName() != "__NULL_IMPORT_DESCRIPTOR")
LazySymbols.push_back(B);
}
+
+ // Seen is a map from member files to boolean values. Initially
+ // all members are mapped to false, which indicates all these files
+ // are not read yet.
+ for (const Archive::Child &Child : File->children())
+ Seen[Child.getBuffer().data()].clear();
return std::error_code();
}
@@ -84,8 +90,7 @@ ErrorOr<MemoryBufferRef> ArchiveFile::ge
// Return an empty buffer if we have already returned the same buffer.
const char *StartAddr = It->getBuffer().data();
- auto Pair = Seen.insert(StartAddr);
- if (!Pair.second)
+ if (Seen[StartAddr].test_and_set())
return MemoryBufferRef();
return It->getMemoryBufferRef();
}
Modified: lld/trunk/COFF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.h?rev=242112&r1=242111&r2=242112&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.h (original)
+++ lld/trunk/COFF/InputFiles.h Mon Jul 13 22:09:59 2015
@@ -107,7 +107,7 @@ private:
std::unique_ptr<Archive> File;
std::string Filename;
std::vector<Lazy *> LazySymbols;
- std::set<const char *> Seen;
+ std::map<const char *, std::atomic_flag> Seen;
llvm::MallocAllocator Alloc;
};
More information about the llvm-commits
mailing list