[LLVMdev] [lld] Relocation sections format: .rela / .rel

Simon Atanasyan simon at atanasyan.com
Sun Jan 19 13:01:30 PST 2014


Hi,

Now lld writes relocations to the ".rela" sections only. Mips requires
to use the "rel" format. So we need to be able to select format and
names of relocation section, names of symbols like __rela_iplt_* /
__rel_iplt_*, dynamic table tag DT_RELA / DT_REL.

My current idea:
- Add two virtual functions
DefaultLayout::createDynamicRelocationTable() and
DefaultLayout::getPLTRelocationTable(). Call these functions when we
need to create relocation tables. By default these function create
.rela.* sections.
- Override createDynamicRelocationTable() and getPLTRelocationTable()
in the MipsTargetLayout to create .rel.* sections.
- Add support for writing Elf_Rel entries to the RelocationTable
class. Maybe it's better to inherit form RelocationTable two separate
classes deal with lf_Rela / Elf_Rel entries.
- It's unclear to me how to select names of symbols like __rela_iplt_*
/ __rel_iplt_* and dynamic table tag DT_RELA / DT_REL.

Is it an appropriate solution? Any objections or suggestions?

Thanks.

-- 
Simon Atanasyan



More information about the llvm-dev mailing list