[llvm-commits] [patch][RFC] Correctly produce R_X86_64_32 or R_X86_64_32S

Rafael Espindola espindola at google.com
Tue Sep 21 15:10:41 PDT 2010

When processing
movq    $foo, foo(%rip)
.long   foo

llvm-mc should produce two relocations. This first one for movq should
be signed (R_X86_64_32S) as the cpu will sign extend the value. The
second one should be unsigned (R_X86_64_32) since that is used to
encode the eh_frame (when using DW_EH_PE_udata4).

I could not the necessary information in
ELFObjectWriterImpl::RecordRelocation. On IRC Daniel mentioned that it
might be necessary to record in the MCFixup if the relocation is
signed or not. Hopefully there is a simpler way to do this, but the
attached patch does produce the correct output for the above
test case.

If this is really the way to fix this, I will give this patch some
extra testing on OS X to update any missing code paths that can get
surprised by the new FixupKind.

Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reloc.patch
Type: text/x-patch
Size: 7800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100921/39a4cb67/attachment.bin>

More information about the llvm-commits mailing list