[PATCH] D13564: [ELF2] Make sure symbol-less relocations make it to the target's handler
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 8 10:55:30 PDT 2015
ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.
LGTM with nits
================
Comment at: ELF/InputSection.cpp:39
@@ -38,3 +38,3 @@
uintX_t GotVA = Out<ELFT>::Got->getVA();
uintX_t SymVA;
----------------
uintX_t SymVA = 0;
================
Comment at: ELF/InputSection.cpp:46-53
@@ -45,5 +45,10 @@
const Elf_Sym *Sym = File.getObj().getRelocationSymbol(&RI, SymTab);
- if (!Sym)
- continue;
- SymVA = getLocalSymVA(Sym, File);
+ if (!Sym) {
+ // Some targets have special relocations that don't correspond to
+ // particular symbols (for example, R_PPC64_TOC). SymVA is unused for
+ // these.
+ SymVA = 0;
+ } else {
+ SymVA = getLocalSymVA(Sym, File);
+ }
} else {
----------------
// getRelocationSymbol may return a null for some relocations such as R_PPC64_TOC.
if (const Elf_Sym *Sym = File.getObj().getRelocationSymbol(&RI, SymTab))
SymVA = getLocalSymVA(Sym, File);
http://reviews.llvm.org/D13564
More information about the llvm-commits
mailing list