[llvm-commits] [llvm] r131669 - in /llvm/trunk: lib/Target/X86/X86MCCodeEmitter.cpp test/MC/ELF/relocation.s
Rafael Espindola
rafael.espindola at gmail.com
Thu May 19 13:32:34 PDT 2011
Author: rafael
Date: Thu May 19 15:32:34 2011
New Revision: 131669
URL: http://llvm.org/viewvc/llvm-project?rev=131669&view=rev
Log:
ADD64ri32 sign extends its argument, so we need to use a R_X86_64_32S.
Fixes PR9934.
We really need to start tblgening the relocation info :-(
Modified:
llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
llvm/trunk/test/MC/ELF/relocation.s
Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=131669&r1=131668&r2=131669&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Thu May 19 15:32:34 2011
@@ -1015,7 +1015,8 @@
} else {
unsigned FixupKind;
// FIXME: Is there a better way to know that we need a signed relocation?
- if (MI.getOpcode() == X86::MOV64ri32 ||
+ if (MI.getOpcode() == X86::ADD64ri32 ||
+ MI.getOpcode() == X86::MOV64ri32 ||
MI.getOpcode() == X86::MOV64mi32 ||
MI.getOpcode() == X86::PUSH64i32)
FixupKind = X86::reloc_signed_4byte;
Modified: llvm/trunk/test/MC/ELF/relocation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation.s?rev=131669&r1=131668&r2=131669&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation.s (original)
+++ llvm/trunk/test/MC/ELF/relocation.s Thu May 19 15:32:34 2011
@@ -17,6 +17,7 @@
pushq $bar
movq foo(%rip), %rdx
leaq foo-bar(%r14),%r14
+ addq $bar,%rax # R_X86_64_32S
// CHECK: # Section 0x00000001
@@ -106,6 +107,12 @@
// CHECK-NEXT: ('r_type', 0x00000002)
// CHECK-NEXT: ('r_addend', 0x0000005c)
+// CHECK: # Relocation 0x0000000e
+// CHECK-NEXT: (('r_offset', 0x00000063)
+// CHECK-NEXT: ('r_sym', 0x00000002)
+// CHECK-NEXT: ('r_type', 0x0000000b)
+// CHECK-NEXT: ('r_addend', 0x00000000)
+
// CHECK: # Symbol 0x00000002
// CHECK: (('st_name', 0x00000000) # ''
// CHECK: ('st_bind', 0x00000000)
More information about the llvm-commits
mailing list