[LLVMdev] Sorting relocation entries

Akira Hatanaka ahatanak at gmail.com
Mon Mar 19 13:39:33 PDT 2012


What would be the best way to sort relocation entries before they are
written out in ELFObjectWriter::WriteRelocationsFragment?

According to the Mips ABI documents I have, there are certain
restrictions on the order relocations appear in the table (e.g.
R_MIPS_HI16 and R_MIPS_GOT16 must be followed immediately by a
R_MIPS_LO16). When I enable post RA scheduling, some of the
restrictions are violated in the generated object code, which results
in incorrect relocation values generated by the linker.

I am considering imitating what gas does in function mips_frob_file
(line 15522 of tc-mips.c) to fix this problem:

http://repo.or.cz/w/binutils.git/blob/master:/gas/config/tc-mips.c

Are there any other targets that have similar restrictions or requirements?



More information about the llvm-dev mailing list