[lld] r175481 - Switch a vector<pair<const T &, const U &>> to a vector<pair<const T *,
Chandler Carruth
chandlerc at gmail.com
Mon Feb 18 17:58:11 PST 2013
Author: chandlerc
Date: Mon Feb 18 19:58:11 2013
New Revision: 175481
URL: http://llvm.org/viewvc/llvm-project?rev=175481&view=rev
Log:
Switch a vector<pair<const T &, const U &>> to a vector<pair<const T *,
const U *>>. Even in C++11 it doesn't seem this is valid as vector's
emplace support requires move assignment, and there is no way to move
assign a reference.
The real motivation however is that this fixes the build of lld with
libstdc++ 4.6.
Modified:
lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=175481&r1=175480&r2=175481&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Mon Feb 18 19:58:11 2013
@@ -690,7 +690,7 @@ public:
}
void addRelocation(const DefinedAtom &da, const Reference &r) {
- _relocs.emplace_back(da, r);
+ _relocs.emplace_back(&da, &r);
this->_fsize = _relocs.size() * sizeof(Elf_Rela);
this->_msize = this->_fsize;
}
@@ -700,21 +700,21 @@ public:
uint8_t *dest = chunkBuffer + this->fileOffset();
for (const auto &rel : _relocs) {
Elf_Rela *r = reinterpret_cast<Elf_Rela *>(dest);
- r->setSymbolAndType(0, rel.second.kind());
+ r->setSymbolAndType(0, rel.second->kind());
r->r_offset =
- writer->addressOfAtom(&rel.first) + rel.second.offsetInAtom();
+ writer->addressOfAtom(rel.first) + rel.second->offsetInAtom();
r->r_addend =
- writer->addressOfAtom(rel.second.target()) + rel.second.addend();
+ writer->addressOfAtom(rel.second->target()) + rel.second->addend();
dest += sizeof(Elf_Rela);
DEBUG_WITH_TYPE("ELFRelocationTable", llvm::dbgs()
- << "IRELATIVE relocation at " << rel.first.name() << "@"
- << r->r_offset << " to " << rel.second.target()->name()
+ << "IRELATIVE relocation at " << rel.first->name() << "@"
+ << r->r_offset << " to " << rel.second->target()->name()
<< "@" << r->r_addend << "\n");
}
}
private:
- std::vector<std::pair<const DefinedAtom &, const Reference &>> _relocs;
+ std::vector<std::pair<const DefinedAtom *, const Reference *>> _relocs;
};
} // end namespace elf
} // end namespace lld
More information about the llvm-commits
mailing list