11// REQUIRES: x86
2- // RUN: split-file %s %t
3- // RUN: llvm-mc -filetype=obj -triple=i386 %t/ asm -o %t .o
4- // RUN: ld.lld -T %t/ lds %t .o -o %t.exe 2>&1 | FileCheck %s --implicit-check-not=warning: --implicit-check-not=error :
2+ // RUN: rm -rf %t && split-file %s %t && cd %t
3+ // RUN: llvm-mc -filetype=obj -triple=i386 --defsym X86_32=1 asm -o a .o
4+ // RUN: ld.lld -T lds a .o -o a 2>&1 | FileCheck %s --implicit-check-not=warning:
55// CHECK: warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_386_PC32 against symbol '_start'
66// CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_386_PC32 against symbol '_start'
77
8- // RUN: llvm-objdump -D --no-show-raw-insn %t.exe | FileCheck --check-prefix=DISASM %s
8+ // RUN: llvm-objdump -D --no-show-raw-insn a | FileCheck --check-prefix=DISASM %s
99// DISASM: Disassembly of section .nonalloc:
1010// DISASM-EMPTY:
1111// DISASM-NEXT: <.nonalloc>:
1212// DISASM-NEXT: 0: nop
13- // DISASM-NEXT: 1: calll 0x0
14- // DISASM-NEXT: 6: calll 0x0
13+ // DISASM-NEXT: 1: call{{.}} 0x0
14+ // DISASM-NEXT: 6: call{{.}} 0x0
15+
16+ /// There is currently no error for -r. See also https://github.com/ClangBuiltLinux/linux/issues/1937
17+ // RUN: ld.lld -T lds -r a.o -o /dev/null --fatal-warnings
18+
19+ // RUN: llvm-mc -filetype=obj -triple=x86_64 asm -o b.o
20+ // RUN: ld.lld -T lds b.o -o b 2>&1 | FileCheck %s --check-prefix=CHECK2 --implicit-check-not=warning:
21+ // RUN: llvm-objdump -D --no-show-raw-insn b | FileCheck --check-prefix=DISASM %s
22+ // RUN: ld.lld -T lds -r b.o -o /dev/null --fatal-warnings
23+ // CHECK2: warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
24+ // CHECK2-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
1525
1626//--- lds
1727SECTIONS {
@@ -34,5 +44,7 @@ _start:
3444
3545// GCC may relocate DW_AT_GNU_call_site_value with R_386_GOTOFF.
3646// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946
47+ .ifdef X86_32
3748.section .debug_random
3849 .long .L0@gotoff
50+ .endif
0 commit comments