This is an archive of the discontinued LLVM Phabricator instance.

support for directive .reloc
AbandonedPublic

Authored by ahatanak on Dec 11 2013, 10:14 PM.

Details

Summary

The attached patch adds support for .reloc directives, which I believe hasn't been implemented yet.

https://sourceware.org/binutils/docs/as/Reloc.html#Reloc

The initial motivation for adding this support was to enable linker optimization for mips. .reloc serves as a hint to the linker to turn a function call using jalr (jump and link register) into a pc-relative bal (branch and link), if the callee is close enough to the jalr.

(before optimization)
lw $25,%call16(foo2)($28)
.reloc $L1,R_MIPS_JALR,foo2
$L1: jalr $25

(after optimization)
lw $25,%call16(foo2)($28)
bal foo2

I also made a change in ELFObjectFile.h that was necessary for mips to print the symbol against which a relocation is applied (needed this for the test case).

Diff Detail

Event Timeline

joerg added a subscriber: joerg.Aug 13 2015, 6:41 AM

Can you update the patch to apply against trunk, please?

espindola edited reviewers, added: espindola; removed: rafael.Mar 15 2018, 11:07 AM

I think this patch is no longer needed after rL252888 and recently rL347398 and rL348760.

ahatanak abandoned this revision.Jan 22 2019, 11:13 AM