[lld] r178815 - [ELF] fix atom order
Shankar Easwaran
shankare at codeaurora.org
Thu Apr 4 16:51:36 PDT 2013
Author: shankare
Date: Thu Apr 4 18:51:36 2013
New Revision: 178815
URL: http://llvm.org/viewvc/llvm-project?rev=178815&view=rev
Log:
[ELF] fix atom order
Modified:
lld/trunk/lib/ReaderWriter/ELF/File.h
Modified: lld/trunk/lib/ReaderWriter/ELF/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/File.h?rev=178815&r1=178814&r2=178815&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/File.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/File.h Thu Apr 4 18:51:36 2013
@@ -127,6 +127,8 @@ public:
if (EC)
return;
+ int ordinal = 0;
+
// Point Obj to correct class and bitwidth ELF object
_objFile.reset(
llvm::dyn_cast<llvm::object::ELFObjectFile<ELFT> >(binaryFile.get()));
@@ -334,10 +336,11 @@ public:
sym->st_size = 0;
ArrayRef<uint8_t> content((const uint8_t *)sectionContents.data(),
sectionContents.size());
- _definedAtoms._atoms.push_back(
- new (_readerStorage)
+ auto newAtom = new (_readerStorage)
ELFDefinedAtom<ELFT>(*this, sectionName, sectionName, sym, i.first,
- content, 0, 0, _references));
+ content, 0, 0, _references);
+ newAtom->setOrdinal(++ordinal);
+ _definedAtoms._atoms.push_back(newAtom);
}
ELFDefinedAtom<ELFT> *previous_atom = nullptr;
@@ -410,8 +413,10 @@ public:
sym->setBinding(llvm::ELF::STB_GLOBAL);
anonAtom = createDefinedAtomAndAssignRelocations(
"", sectionName, sym, i.first,
- ArrayRef<uint8_t>((uint8_t *)sectionContents.data() +
- (*si)->st_value, contentSize));
+ ArrayRef<uint8_t>(
+ (uint8_t *)sectionContents.data() + (*si)->st_value,
+ contentSize));
+ anonAtom->setOrdinal(++ordinal);
// If this is the last atom, lets not create a followon
// reference
@@ -454,6 +459,8 @@ public:
auto newAtom = createDefinedAtomAndAssignRelocations(
symbolName, sectionName, *si, i.first, symbolData);
+ newAtom->setOrdinal(++ordinal);
+
// If the atom was a weak symbol, lets create a followon
// reference to the anonymous atom that we created
if ((*si)->getBinding() == llvm::ELF::STB_WEAK && anonAtom) {
More information about the llvm-commits
mailing list