[lld] r177554 - Set ordinals correctly.
Michael J. Spencer
bigcheesegs at gmail.com
Wed Mar 20 11:56:57 PDT 2013
Author: mspencer
Date: Wed Mar 20 13:56:57 2013
New Revision: 177554
URL: http://llvm.org/viewvc/llvm-project?rev=177554&view=rev
Log:
Set ordinals correctly.
This actually doesn't change behavior with the current LinkerInvocation, but
it's needed when you make reading parallel.
Modified:
lld/trunk/lib/Driver/LinkerInvocation.cpp
lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
lld/trunk/lib/ReaderWriter/ELF/File.h
lld/trunk/lib/ReaderWriter/ReaderArchive.cpp
Modified: lld/trunk/lib/Driver/LinkerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/LinkerInvocation.cpp?rev=177554&r1=177553&r2=177554&view=diff
==============================================================================
--- lld/trunk/lib/Driver/LinkerInvocation.cpp (original)
+++ lld/trunk/lib/Driver/LinkerInvocation.cpp Wed Mar 20 13:56:57 2013
@@ -74,6 +74,7 @@ void LinkerInvocation::operator()() {
}
inputs.appendFiles(files);
}
+ inputs.assignFileOrdinals();
auto writer = targetInfo->getWriter();
Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h?rev=177554&r1=177553&r2=177554&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h Wed Mar 20 13:56:57 2013
@@ -26,10 +26,6 @@ public:
const ELFTargetInfo &ti, std::unique_ptr<llvm::MemoryBuffer> mb) {
std::unique_ptr<DynamicFile> file(
new DynamicFile(ti, mb->getBufferIdentifier()));
-
- static uint32_t lastOrdinal = 0;
- file->_ordinal = lastOrdinal++;
-
llvm::OwningPtr<llvm::object::Binary> binaryFile;
if (error_code ec = createBinary(mb.release(), binaryFile))
return ec;
Modified: lld/trunk/lib/ReaderWriter/ELF/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/File.h?rev=177554&r1=177553&r2=177554&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/File.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/File.h Wed Mar 20 13:56:57 2013
@@ -123,9 +123,6 @@ public:
ELFFile(const ELFTargetInfo &ti, std::unique_ptr<llvm::MemoryBuffer> MB,
llvm::error_code &EC)
: File(MB->getBufferIdentifier()), _elfTargetInfo(ti) {
- static uint32_t lastOrdinal = 0;
- _ordinal = lastOrdinal++;
-
llvm::OwningPtr<llvm::object::Binary> binaryFile;
EC = createBinary(MB.release(), binaryFile);
if (EC)
Modified: lld/trunk/lib/ReaderWriter/ReaderArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ReaderArchive.cpp?rev=177554&r1=177553&r2=177554&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ReaderArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ReaderArchive.cpp Wed Mar 20 13:56:57 2013
@@ -52,7 +52,7 @@ public:
assert(result.size() == 1);
- // TO DO: set ordinal of child just loaded
+ result[0]->setOrdinalAndIncrement(_curChildOrd);
// give up the pointer so that this object no longer manages it
return result[0].release();
@@ -60,6 +60,7 @@ public:
virtual void setOrdinalAndIncrement(uint64_t &ordinal) const {
_ordinal = ordinal++;
+ _curChildOrd = _ordinal;
// Leave space in ordinal range for all children
for (auto mf = _archive->begin_children(),
me = _archive->end_children(); mf != me; ++mf) {
@@ -126,6 +127,7 @@ private:
atom_collection_vector<UndefinedAtom> _undefinedAtoms;
atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms;
atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
+ mutable uint64_t _curChildOrd;
public:
/// only subclasses of ArchiveLibraryFile can be instantiated
More information about the llvm-commits
mailing list