[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / non-abs-reloc.s
blob42b5f8fec1c436149a79b2953bb8bac021acf330
1 // REQUIRES: x86
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:
5 // CHECK: warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_386_PC32 against symbol '_start'
6 // CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_386_PC32 against symbol 'ifunc'
7 // CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0xa): has non-ABS relocation R_386_PC32 against symbol ''
9 // RUN: llvm-objdump -D --no-show-raw-insn a | FileCheck --check-prefix=DISASM %s
10 // DISASM: Disassembly of section .nonalloc:
11 // DISASM-EMPTY:
12 // DISASM-NEXT: <.nonalloc>:
13 // DISASM-NEXT: 0: nop
14 // DISASM-NEXT: 1: call{{.}} 0x0
15 // DISASM-NEXT: 6: call{{.}} 0x5
17 /// There is currently no error for -r. See also https://github.com/ClangBuiltLinux/linux/issues/1937
18 // RUN: ld.lld -T lds -r a.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=REL-R --implicit-check-not=warning:
19 // REL-R: warning: {{.*}}:(.nonalloc1+0xa): has non-ABS relocation R_386_PC32 against symbol ''
21 // RUN: llvm-mc -filetype=obj -triple=x86_64 asm -o b.o
22 // RUN: ld.lld -T lds b.o -o b 2>&1 | FileCheck %s --check-prefix=CHECK2 --implicit-check-not=warning:
23 // RUN: llvm-objdump -D --no-show-raw-insn b | FileCheck --check-prefix=DISASM %s
24 // RUN: ld.lld -T lds -r b.o -o /dev/null --fatal-warnings
25 // CHECK2: warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
26 // CHECK2-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_X86_64_PC32 against symbol 'ifunc'
27 // CHECK2-NEXT: warning: {{.*}}.o:(.nonalloc1+0xa): has non-ABS relocation R_X86_64_PC32 against symbol ''
29 //--- lds
30 SECTIONS {
31 .nonalloc 0 : { *(.nonalloc*) }
33 //--- asm
34 .globl _start
35 _start:
36 .L0:
37 nop
39 resolver: ret
40 .type ifunc, @gnu_indirect_function
41 .set ifunc, resolver
43 .section .nonalloc0
44 nop
46 .section .nonalloc1
47 .byte 0xe8
48 .long _start - . - 4
49 .byte 0xe8
50 .long ifunc - .
51 .long .nonalloc0 - .
53 // GCC may relocate DW_AT_GNU_call_site_value with R_386_GOTOFF.
54 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946
55 .ifdef X86_32
56 .section .debug_random
57 .long .L0@gotoff
58 .endif