[lld] r183850 - [ELF] Remove unused parameter from ELFReference c'tor.
Rui Ueyama
ruiu at google.com
Wed Jun 12 11:21:36 PDT 2013
Author: ruiu
Date: Wed Jun 12 13:21:36 2013
New Revision: 183850
URL: http://llvm.org/viewvc/llvm-project?rev=183850&view=rev
Log:
[ELF] Remove unused parameter from ELFReference c'tor.
Reviewers: shankarke
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D961
Modified:
lld/trunk/lib/ReaderWriter/ELF/Atoms.h
lld/trunk/lib/ReaderWriter/ELF/File.h
Modified: lld/trunk/lib/ReaderWriter/ELF/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Atoms.h?rev=183850&r1=183849&r2=183850&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Atoms.h Wed Jun 12 13:21:36 2013
@@ -28,22 +28,27 @@ template <typename ELFT> class TargetAto
/// \brief Relocation References: Defined Atoms may contain references that will
/// need to be patched before the executable is written.
+///
+/// Construction of ELFReferences is two pass process. ELFReferences are
+/// instantiated while we are iterating over symbol tables to atomize
+/// symbols. At that time we only know the index of relocation target symbol
+/// (not target atom) about a relocation, so we store the index to
+/// ELFREference. In the second pass, ELFReferences are revisited to update
+/// target atoms by target symbol indexes.
template <class ELFT> class ELFReference LLVM_FINAL : public Reference {
typedef llvm::object::Elf_Rel_Impl<ELFT, false> Elf_Rel;
typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela;
public:
- ELFReference(const Elf_Rela *rela, uint64_t offset, const Atom *target,
- Kind kind, uint32_t symbol)
- : _target(target), _targetSymbolIndex(symbol),
- _offsetInAtom(offset), _addend(rela->r_addend) {
+ ELFReference(const Elf_Rela *rela, uint64_t off, Kind kind, uint32_t idx)
+ : _target(nullptr), _targetSymbolIndex(idx),
+ _offsetInAtom(off), _addend(rela->r_addend) {
_kind = kind;
}
- ELFReference(const Elf_Rel *rel, uint64_t offset, const Atom *target,
- Kind kind, uint32_t symbol)
- : _target(target), _targetSymbolIndex(symbol),
- _offsetInAtom(offset), _addend(0) {
+ ELFReference(const Elf_Rel *rel, uint64_t off, Kind kind, uint32_t idx)
+ : _target(nullptr), _targetSymbolIndex(idx),
+ _offsetInAtom(off), _addend(0) {
_kind = kind;
}
Modified: lld/trunk/lib/ReaderWriter/ELF/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/File.h?rev=183850&r1=183849&r2=183850&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/File.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/File.h Wed Jun 12 13:21:36 2013
@@ -513,7 +513,7 @@ private:
Reference::Kind kind = (Reference::Kind) rai.getType(isMips64EL);
uint32_t symbolIndex = rai.getSymbol(isMips64EL);
auto *ERef = new (_readerStorage)
- ELFReference<ELFT>(&rai, rai.r_offset - symbol->st_value, nullptr,
+ ELFReference<ELFT>(&rai, rai.r_offset - symbol->st_value,
kind, symbolIndex);
_references.push_back(ERef);
}
@@ -530,7 +530,7 @@ private:
Reference::Kind kind = (Reference::Kind) ri.getType(isMips64EL);
uint32_t symbolIndex = ri.getSymbol(isMips64EL);
auto *ERef = new (_readerStorage)
- ELFReference<ELFT>(&ri, ri.r_offset - symbol->st_value, nullptr,
+ ELFReference<ELFT>(&ri, ri.r_offset - symbol->st_value,
kind, symbolIndex);
// Read the addend from the section contents
// TODO : We should move the way lld reads relocations totally from
More information about the llvm-commits
mailing list