1 # This reproduces a bug triggered by a relocation referencing a section symbol
2 # plus a negative reloc. BOLT handles such cases specially, but while doing so,
3 # it was failing to sign extend a negative result for the relocation (encoded
4 # in the immediate operand of an LEA instruction).
5 # Originally triggered by https://fossies.org/linux/glib/glib/guniprop.c
6 # Line 550: const gchar *p = special_case_table + val - 0x1000000;
8 # REQUIRES: system-linux
10 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
12 # Delete our BB symbols so BOLT doesn't mark them as entry points
13 # RUN: llvm-strip --strip-unneeded %t.o
14 # RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
16 # RUN: llvm-bolt %t.exe --print-finalized --print-only=main -o %t.out \
17 # RUN: 2>&1 | FileCheck %s
19 # RUN: %t.out 1 2 | FileCheck --check-prefix=CHECK-RT %s
34 # CHECK-SAME: {{.*}}-{{.*}}
35 leaq mystring-
0x1000000, %rsi
# Use a large negative addend to cause a
36 # negative result to be encoded in LEA
37 addq $
0x1000000, %rsi
# Eventually program logic compensates to get
55 # CHECK-RT: {{.*}} is rbx mod 10 contents in decimal
56 mystring
: .asciz "0 is rbx mod 10 contents in decimal\n"