aboutsummaryrefslogtreecommitdiff
path: root/bolt/test/X86/unclaimed-pc-rel.s
diff options
context:
space:
mode:
Diffstat (limited to 'bolt/test/X86/unclaimed-pc-rel.s')
-rw-r--r--bolt/test/X86/unclaimed-pc-rel.s24
1 files changed, 24 insertions, 0 deletions
diff --git a/bolt/test/X86/unclaimed-pc-rel.s b/bolt/test/X86/unclaimed-pc-rel.s
new file mode 100644
index 0000000..5292ccc
--- /dev/null
+++ b/bolt/test/X86/unclaimed-pc-rel.s
@@ -0,0 +1,24 @@
+## Check that unclaimed PC-relative relocation from data to code is detected
+## and reported to the user.
+
+# REQUIRES: system-linux
+
+# RUN: %clang %cflags -no-pie %s -o %t.exe -Wl,-q -nostartfiles
+# RUN: not llvm-bolt %t.exe -o %t.bolt --strict 2>&1 | FileCheck %s
+
+# CHECK: BOLT-ERROR: 1 unclaimed PC-relative relocation(s) left in data
+
+ .text
+ .globl _start
+ .type _start, %function
+_start:
+ movl $42, %eax
+.L0:
+ ret
+ .size _start, .-_start
+
+## Force relocation mode.
+ .reloc 0, R_X86_64_NONE
+
+ .section .rodata
+ .long .L0-.