3
3
// RUN: llvm-mc -filetype=obj -triple=i386 --defsym X86_32=1 asm -o a.o
4
4
// RUN: ld.lld -T lds a.o -o a 2>&1 | FileCheck %s --implicit-check-not=warning:
5
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 '_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 ''
7
8
8
9
// RUN: llvm-objdump -D --no-show-raw-insn a | FileCheck --check-prefix=DISASM %s
9
10
// DISASM: Disassembly of section .nonalloc:
10
11
// DISASM-EMPTY:
11
12
// DISASM-NEXT: <.nonalloc>:
12
13
// DISASM-NEXT: 0: nop
13
14
// DISASM-NEXT: 1: call{{.}} 0x0
14
- // DISASM-NEXT: 6: call{{.}} 0x0
15
+ // DISASM-NEXT: 6: call{{.}} 0x5
15
16
16
17
/// There is currently no error for -r. See also https://github.com/ClangBuiltLinux/linux/issues/1937
17
18
// RUN: ld.lld -T lds -r a.o -o /dev/null --fatal-warnings
21
22
// RUN: llvm-objdump -D --no-show-raw-insn b | FileCheck --check-prefix=DISASM %s
22
23
// RUN: ld.lld -T lds -r b.o -o /dev/null --fatal-warnings
23
24
// 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 ''
25
27
26
28
//--- lds
27
29
SECTIONS {
@@ -33,14 +35,19 @@ _start:
33
35
.L0:
34
36
nop
35
37
38
+ resolver: ret
39
+ .type ifunc, @gnu_indirect_function
40
+ .set ifunc, resolver
41
+
36
42
.section .nonalloc0
37
43
nop
38
44
39
45
.section .nonalloc1
40
46
.byte 0xe8
41
47
.long _start - . - 4
42
48
.byte 0xe8
43
- .long _start - . - 4
49
+ .long ifunc - .
50
+ .long .nonalloc0 - .
44
51
45
52
// GCC may relocate DW_AT_GNU_call_site_value with R_386_GOTOFF.
46
53
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946
0 commit comments