33// RUN: llvm-mc -filetype=obj -triple=i386 --defsym X86_32=1 asm -o a.o
44// 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'
6- // CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): 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 ''
78
89// RUN: llvm-objdump -D --no-show-raw-insn a | FileCheck --check-prefix=DISASM %s
910// DISASM: Disassembly of section .nonalloc:
1011// DISASM-EMPTY:
1112// DISASM-NEXT: <.nonalloc>:
1213// DISASM-NEXT: 0: nop
1314// DISASM-NEXT: 1: call{{.}} 0x0
14- // DISASM-NEXT: 6: call{{.}} 0x0
15+ // DISASM-NEXT: 6: call{{.}} 0x5
1516
1617/// There is currently no error for -r. See also https://github.com/ClangBuiltLinux/linux/issues/1937
1718// RUN: ld.lld -T lds -r a.o -o /dev/null --fatal-warnings
2122// RUN: llvm-objdump -D --no-show-raw-insn b | FileCheck --check-prefix=DISASM %s
2223// RUN: ld.lld -T lds -r b.o -o /dev/null --fatal-warnings
2324// 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'
25+ // CHECK2-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_X86_64_PC32 against symbol 'ifunc'
26+ // CHECK2-NEXT: warning: {{.*}}.o:(.nonalloc1+0xa): has non-ABS relocation R_X86_64_PC32 against symbol ''
2527
2628//--- lds
2729SECTIONS {
@@ -33,14 +35,19 @@ _start:
3335.L0:
3436 nop
3537
38+ resolver: ret
39+ .type ifunc, @gnu_indirect_function
40+ .set ifunc, resolver
41+
3642.section .nonalloc0
3743 nop
3844
3945.section .nonalloc1
4046 .byte 0xe8
4147 .long _start - . - 4
4248 .byte 0xe8
43- .long _start - . - 4
49+ .long ifunc - .
50+ .long .nonalloc0 - .
4451
4552// GCC may relocate DW_AT_GNU_call_site_value with R_386_GOTOFF.
4653// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946
0 commit comments