[PATCH] D17813: [ELF] - add support for relocations against local symbols when producing relocatable output.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 2 10:01:26 PST 2016
ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: ELF/InputSection.cpp:139
@@ +138,3 @@
+ const Elf_Sym *Sym = this->File->getLocalSymbol(SymIndex);
+ uint32_t Idx = Out<ELFT>::SymTab->Locals[Sym];
+ P->r_offset = RelocatedSection->getOffset(Rel.r_offset);
----------------
If it's a concern, you can add an assert here to check that the key always exists, but I think it is probably a bit too overly cautious.
================
Comment at: ELF/OutputSections.h:245
@@ +244,3 @@
+ // Local symbol -> ID
+ llvm::DenseMap<const Elf_Sym *, uint32_t> Locals;
+
----------------
Why I wrote that comment is because we have this piece of code in copyRelocations() and want to be consistent.
uint32_t SymIndex = Rel.getSymbol(Config->Mips64EL);
================
Comment at: ELF/Writer.cpp:581
@@ -573,2 +580,3 @@
++Out<ELFT>::SymTab->NumLocals;
+ Out<ELFT>::SymTab->Locals[&Sym] = Out<ELFT>::SymTab->NumLocals;
F->KeptLocalSyms.push_back(std::make_pair(
----------------
Please guard this line with "if (Config->Relocatable)"
http://reviews.llvm.org/D17813
More information about the llvm-commits
mailing list