diff options
-rw-r--r-- | lib/Target/X86/X86MCCodeEmitter.cpp | 3 | ||||
-rw-r--r-- | test/MC/ELF/relocation.s | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Target/X86/X86MCCodeEmitter.cpp b/lib/Target/X86/X86MCCodeEmitter.cpp index f195a67a30..55aceba9f2 100644 --- a/lib/Target/X86/X86MCCodeEmitter.cpp +++ b/lib/Target/X86/X86MCCodeEmitter.cpp @@ -1015,7 +1015,8 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS, } 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; diff --git a/test/MC/ELF/relocation.s b/test/MC/ELF/relocation.s index 4df09e13fc..2760232a5a 100644 --- a/test/MC/ELF/relocation.s +++ b/test/MC/ELF/relocation.s @@ -17,6 +17,7 @@ bar: 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 @@ bar: // 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) |