Skip to content

Commit 04cf411

Browse files
committed
[ELF][test] Test unreferenced non-preemptible ifunc
Add missing coverage exposed by D114783. There should be no associated IRELATIVE, otherwise (a) glibc ld.so may crash (b) it wastes space (c) unused IPLT causes confusion.
1 parent 51776ec commit 04cf411

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

lld/test/ELF/gnu-ifunc-nonpreemptible.s

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
33
# RUN: ld.lld %t.o -o %t
4-
# RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DISASM
4+
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefix=DISASM
55
# RUN: llvm-readelf -r -s %t | FileCheck %s
66

77
# RUN: ld.lld --export-dynamic %t.o -o %t
@@ -26,22 +26,21 @@
2626
# DISASM: Disassembly of section .text:
2727
# DISASM-EMPTY:
2828
# DISASM-NEXT: <foo>:
29-
# DISASM-NEXT: 201188: {{.*}} retq
3029
# DISASM: <bar>:
31-
# DISASM-NEXT: 201189: {{.*}} retq
30+
# DISASM: <unused>:
3231
# DISASM: <_start>:
33-
# DISASM-NEXT: 20118a: {{.*}} callq 0x2011a0
34-
# DISASM-NEXT: 20118f: {{.*}} callq 0x2011b0
32+
# DISASM-NEXT: callq 0x[[#%x,foo:]]
33+
# DISASM-NEXT: callq 0x[[#%x,bar:]]
3534
# DISASM-EMPTY:
3635
# DISASM-NEXT: Disassembly of section .iplt:
3736
# DISASM-EMPTY:
3837
# DISASM-NEXT: <.iplt>:
39-
# DISASM-NEXT: 2011a0: {{.*}} jmpq *{{.*}}(%rip) # 0x2021d0
40-
# DISASM-NEXT: 2011a6: {{.*}} pushq $0
41-
# DISASM-NEXT: 2011ab: {{.*}} jmp 0x0
42-
# DISASM-NEXT: 2011b0: {{.*}} jmpq *{{.*}}(%rip) # 0x2021d8
43-
# DISASM-NEXT: 2011b6: {{.*}} pushq $1
44-
# DISASM-NEXT: 2011bb: {{.*}} jmp 0x0
38+
# DISASM-NEXT: [[#foo]]: jmpq *{{.*}}(%rip)
39+
# DISASM-NEXT: pushq $0
40+
# DISASM-NEXT: jmp 0x0
41+
# DISASM-NEXT: [[#bar]]: jmpq *{{.*}}(%rip)
42+
# DISASM-NEXT: pushq $1
43+
# DISASM-NEXT: jmp 0x0
4544

4645
.text
4746
.type foo STT_GNU_IFUNC
@@ -54,6 +53,11 @@ foo:
5453
bar:
5554
ret
5655

56+
.type unused, @gnu_indirect_function
57+
.globl unused
58+
unused:
59+
ret
60+
5761
.weak __rela_iplt_start
5862
.weak __rela_iplt_end
5963

0 commit comments

Comments
 (0)