aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/MCTargetDesc
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-05 01:33:53 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-05 01:33:53 +0000
commit6c1202c459ffa6d693ad92fa84e43902bc780bca (patch)
tree7b105f95ab50dfb164f274ae463085af780e3262 /lib/Target/X86/MCTargetDesc
parentcc5a6cb0a22736e133a17cf4de23e3d76de8058e (diff)
downloadexternal_llvm-6c1202c459ffa6d693ad92fa84e43902bc780bca.zip
external_llvm-6c1202c459ffa6d693ad92fa84e43902bc780bca.tar.gz
external_llvm-6c1202c459ffa6d693ad92fa84e43902bc780bca.tar.bz2
Handle relocations that don't point to symbols.
In ELF (as in MachO), not all relocations point to symbols. Represent this properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj ELF's dumper to handle relocatios without symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183284 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/MCTargetDesc')
-rw-r--r--lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp8
-rw-r--r--lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp13
2 files changed, 10 insertions, 11 deletions
diff --git a/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp b/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp
index 917c37d..8f4ab46 100644
--- a/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp
+++ b/lib/Target/X86/MCTargetDesc/X86ELFRelocationInfo.cpp
@@ -27,11 +27,11 @@ public:
const MCExpr *createExprForRelocation(RelocationRef Rel) {
uint64_t RelType; Rel.getType(RelType);
- SymbolRef SymRef; Rel.getSymbol(SymRef);
+ symbol_iterator SymI = Rel.getSymbol();
- StringRef SymName; SymRef.getName(SymName);
- uint64_t SymAddr; SymRef.getAddress(SymAddr);
- uint64_t SymSize; SymRef.getSize(SymSize);
+ StringRef SymName; SymI->getName(SymName);
+ uint64_t SymAddr; SymI->getAddress(SymAddr);
+ uint64_t SymSize; SymI->getSize(SymSize);
int64_t Addend; getELFRelocationAddend(Rel, Addend);
MCSymbol *Sym = Ctx.GetOrCreateSymbol(SymName);
diff --git a/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp b/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
index a76cad5..75b5acf 100644
--- a/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
+++ b/lib/Target/X86/MCTargetDesc/X86MachORelocationInfo.cpp
@@ -28,10 +28,10 @@ public:
const MachOObjectFile *Obj = cast<MachOObjectFile>(Rel.getObjectFile());
uint64_t RelType; Rel.getType(RelType);
- SymbolRef SymRef; Rel.getSymbol(SymRef);
+ symbol_iterator SymI = Rel.getSymbol();
- StringRef SymName; SymRef.getName(SymName);
- uint64_t SymAddr; SymRef.getAddress(SymAddr);
+ StringRef SymName; SymI->getName(SymName);
+ uint64_t SymAddr; SymI->getAddress(SymAddr);
RelocationEntry RE = Obj->getRelocation(Rel.getRawDataRefImpl());
bool isPCRel = Obj->getAnyRelocationPCRel(RE);
@@ -86,12 +86,11 @@ public:
const MCExpr *LHS = MCSymbolRefExpr::Create(Sym, Ctx);
- SymbolRef RSymRef;
- RelNext.getSymbol(RSymRef);
+ symbol_iterator RSymI = RelNext.getSymbol();
uint64_t RSymAddr;
- RSymRef.getAddress(RSymAddr);
+ RSymI->getAddress(RSymAddr);
StringRef RSymName;
- RSymRef.getName(RSymName);
+ RSymI->getName(RSymName);
MCSymbol *RSym = Ctx.GetOrCreateSymbol(RSymName);
if (RSym->isVariable() == false)