summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-07-20 19:36:11 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-07-20 19:36:11 +0000
commita4d0bd84f7bdc78784e44b623ded448988022e4b (patch)
tree88d3cf02907fb6d0b7990fa12e57f3e6edbcdaea
parent88d1bc832ca5b458c8460929227be8eae6c6bdc3 (diff)
downloadllvm-a4d0bd84f7bdc78784e44b623ded448988022e4b.tar.gz
llvm-a4d0bd84f7bdc78784e44b623ded448988022e4b.tar.bz2
llvm-a4d0bd84f7bdc78784e44b623ded448988022e4b.tar.xz
Extend the hack for _GLOBAL_OFFSET_TABLE_ slightly; PR10389.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135607 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86MCCodeEmitter.cpp4
-rw-r--r--test/MC/ELF/global-offset.s5
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/Target/X86/X86MCCodeEmitter.cpp b/lib/Target/X86/X86MCCodeEmitter.cpp
index 53d7fb01d6..0ff375b98d 100644
--- a/lib/Target/X86/X86MCCodeEmitter.cpp
+++ b/lib/Target/X86/X86MCCodeEmitter.cpp
@@ -205,7 +205,9 @@ EmitImmediate(const MCOperand &DispOp, unsigned Size, MCFixupKind FixupKind,
}
// If we have an immoffset, add it to the expression.
- if (FixupKind == FK_Data_4 && StartsWithGlobalOffsetTable(Expr)) {
+ if ((FixupKind == FK_Data_4 ||
+ FixupKind == MCFixupKind(X86::reloc_signed_4byte)) &&
+ StartsWithGlobalOffsetTable(Expr)) {
assert(ImmOffset == 0);
FixupKind = MCFixupKind(X86::reloc_global_offset_table);
diff --git a/test/MC/ELF/global-offset.s b/test/MC/ELF/global-offset.s
index 77f7267710..8cc5dbb8d8 100644
--- a/test/MC/ELF/global-offset.s
+++ b/test/MC/ELF/global-offset.s
@@ -1,9 +1,10 @@
// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
// We test that _GLOBAL_OFFSET_TABLE_ will account for the two bytes at the
-// start of the addl.
+// start of the addl/leal.
addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ leal _GLOBAL_OFFSET_TABLE_(%ebx), %ebx
// CHECK: ('sh_name', 0x00000005) # '.text'
// CHECK-NEXT: ('sh_type',
@@ -15,4 +16,4 @@
// CHECK-NEXT: ('sh_info',
// CHECK-NEXT: ('sh_addralign',
// CHECK-NEXT: ('sh_entsize',
-// CHECK-NEXT: ('_section_data', '81c30200 0000')
+// CHECK-NEXT: ('_section_data', '81c30200 00008d9b 02000000')