[PATCH] Handle crazy mips 64 little endian case.

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Tue Apr 2 17:16:19 PDT 2013


Hi Bigcheese,

Normally r_info is just a 32 of 64 bit number matching the endian of the rest of the file. Unfortunately, mips 64 bit little endian is special: The top 32 bits are a little endian number and the following 32 are big endian one.

I considered 3 ways of solving this

* Adding a isMips boolean to the  ELFT template. This is somewhat easy to implement, but would cause a lot of code to be duplicated (instantiated twice).

*Adding a isMips boolean parameter only where needed. This worked OK for llvm itself. I split the bits not handling relocations in ELFObjectFile to a base class and most users could use the base class. The problem was lld. Since it has to handle relocations, a "isMips" parameter would end up in most parts of the ELF code :-(

* Do a dynamic check. This is what this patch does.


http://llvm-reviews.chandlerc.com/D615

Files:
  include/llvm/Object/ELF.h
  test/Object/Inputs/trivial-object-test.elf-mips64el
  test/Object/objdump-relocations.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D615.1.patch
Type: text/x-patch
Size: 9382 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130402/90b44a35/attachment.bin>


More information about the llvm-commits mailing list