Update for API change for handling mips64el.

llvm-svn: 178695
This commit is contained in:
Rafael Espindola 2013-04-03 21:03:19 +00:00
parent 2025e8b820
commit 26cf0b5130
2 changed files with 18 additions and 8 deletions

View File

@ -33,16 +33,18 @@ template <class ELFT> class ELFReference LLVM_FINAL : public Reference {
typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela; typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela;
public: public:
ELFReference(const Elf_Rela *rela, uint64_t offset, const Atom *target) ELFReference(const Elf_Rela *rela, uint64_t offset, const Atom *target,
: _target(target), _targetSymbolIndex(rela->getSymbol()), Kind kind, uint32_t symbol)
: _target(target), _targetSymbolIndex(symbol),
_offsetInAtom(offset), _addend(rela->r_addend) { _offsetInAtom(offset), _addend(rela->r_addend) {
_kind = (Kind) rela->getType(); _kind = kind;
} }
ELFReference(const Elf_Rel *rel, uint64_t offset, const Atom *target) ELFReference(const Elf_Rel *rel, uint64_t offset, const Atom *target,
: _target(target), _targetSymbolIndex(rel->getSymbol()), Kind kind, uint32_t symbol)
: _target(target), _targetSymbolIndex(symbol),
_offsetInAtom(offset), _addend(0) { _offsetInAtom(offset), _addend(0) {
_kind = (Kind) rel->getType(); _kind = kind;
} }
ELFReference(Kind kind) ELFReference(Kind kind)

View File

@ -576,8 +576,12 @@ private:
if (!((rai.r_offset >= symbol->st_value) && if (!((rai.r_offset >= symbol->st_value) &&
(rai.r_offset < symbol->st_value + content.size()))) (rai.r_offset < symbol->st_value + content.size())))
continue; continue;
bool isMips64EL = _objFile->isMips64EL();
Kind kind = (Kind) rai.getType(isMips64EL);
uint32_t symbolIndex = rai.getSymbol(isMips64EL);
auto *ERef = new (_readerStorage) auto *ERef = new (_readerStorage)
ELFReference<ELFT>(&rai, rai.r_offset - symbol->st_value, nullptr); ELFReference<ELFT>(&rai, rai.r_offset - symbol->st_value, nullptr,
kind, symbolIndex);
_references.push_back(ERef); _references.push_back(ERef);
} }
@ -586,8 +590,12 @@ private:
for (auto &ri : rri->second) { for (auto &ri : rri->second) {
if ((ri.r_offset >= symbol->st_value) && if ((ri.r_offset >= symbol->st_value) &&
(ri.r_offset < symbol->st_value + content.size())) { (ri.r_offset < symbol->st_value + content.size())) {
bool isMips64EL = _objFile->isMips64EL();
Kind kind = (Kind) ri.getType(isMips64EL);
uint32_t symbolIndex = ri.getSymbol(isMips64EL);
auto *ERef = new (_readerStorage) auto *ERef = new (_readerStorage)
ELFReference<ELFT>(&ri, ri.r_offset - symbol->st_value, nullptr); ELFReference<ELFT>(&ri, ri.r_offset - symbol->st_value, nullptr,
kind, symbolIndex);
// Read the addend from the section contents // Read the addend from the section contents
// TODO : We should move the way lld reads relocations totally from // TODO : We should move the way lld reads relocations totally from
// ELFObjectFile // ELFObjectFile