[LLVMdev] [lld] Relocation reading refactoring
Simon Atanasyan
simon at atanasyan.com
Wed Feb 26 02:56:02 PST 2014
Hi Shankar,
On Tue, Feb 12, 2013 at 10:46 PM, Shankar Easwaran
<shankare at codeaurora.org> wrote:
> Author: shankare
> Date: Tue Feb 12 12:46:53 2013
> New Revision: 174990
>
> URL: http://llvm.org/viewvc/llvm-project?rev=174990&view=rev
[...]
> ELFDefinedAtom<ELFT> *createDefinedAtomAndAssignRelocations(
> StringRef symbolName, StringRef sectionName, const Elf_Sym *symbol,
> const Elf_Shdr *section, ArrayRef<uint8_t> content) {
> @@ -380,6 +534,11 @@ private:
> (ri->r_offset < symbol->st_value + content.size())) {
> auto *ERef = new (_readerStorage)
> ELFReference<ELFT>(ri, ri->r_offset - symbol->st_value, nullptr);
> + // Read the addend from the section contents
> + // TODO : We should move the way lld reads relocations totally from
> + // ELFObjectFile
> + int32_t addend = *(content.data() + ri->r_offset - symbol->st_value);
> + ERef->setAddend(addend);
> _references.push_back(ERef);
> }
What do you mean by removing relocation reading from the
ELFObjectFile? I considered to customize the relocation reading for
MIPS targets and my first idea was to factor out ELFReference creation
into a couple of virtual functions. The first one is for Elf_Rel, the
second one is for Elf_Rela. Then I planned to override these functions
in the MipsELFFile class. But it looks like you have more profound
idea. Could you share it?
Thanks.
--
Simon
More information about the llvm-dev
mailing list