summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-04-24 01:03:57 +0000
committerDavide Italiano <davide@freebsd.org>2016-04-24 01:03:57 +0000
commitf59b0da654cdb80a138063f681045f40069765e7 (patch)
tree73c96f48ad245ea8830a68c1a3c816df2de85af4 /llvm/test
parent02fa65209cc7f5803ea409365c87d9863838b996 (diff)
downloadbcm5719-llvm-f59b0da654cdb80a138063f681045f40069765e7.tar.gz
bcm5719-llvm-f59b0da654cdb80a138063f681045f40069765e7.zip
[MC/ELF] Implement support for GOTPCRELX/REX_GOTPCRELX.
The option to control the emission of the new relocations is -relax-relocations (blatantly copied from GNU as). It can't be enabled by default because it breaks relatively recent versions of ld.bfd/ld.gold (late 2015). llvm-svn: 267307
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/MC/ELF/got-relaxed.s18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/MC/ELF/got-relaxed.s b/llvm/test/MC/ELF/got-relaxed.s
new file mode 100644
index 00000000000..2a9969e29c6
--- /dev/null
+++ b/llvm/test/MC/ELF/got-relaxed.s
@@ -0,0 +1,18 @@
+// RUN: llvm-mc -filetype=obj -relax-relocations -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -r -t | FileCheck %s
+
+// Test that this produces the correct relaxed relocations.
+
+ movl foo@GOT, %eax
+ movl foo@GOTPCREL(%rip), %eax
+ movq foo@GOTPCREL(%rip), %rax
+
+// CHECK: Relocations [
+// CHECK: Section ({{[^ ]+}}) .rela.text {
+// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_GOT32 foo 0x{{[^ ]+}}
+// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_GOTPCRELX foo 0x{{[^ ]+}}
+// CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_REX_GOTPCRELX foo 0x{{[^ ]+}}
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
+
+// CHECK: Symbols [
+// CHECK-NOT: _GLOBAL_OFFSET_TABLE_
OpenPOWER on IntegriCloud