[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / gnu-ifunc-plt-i386.s
blobe2d4e2744bbfe335393cbf1ae89270b71a80bd8c
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/shared2-x86-64.s -o %t1.o
3 // RUN: ld.lld %t1.o --shared --soname=t.so -o %t.so
4 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
5 // RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout
6 // RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %tout | FileCheck %s --check-prefix=DISASM
7 // RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT
8 // RUN: llvm-readobj -r --dynamic-table %tout | FileCheck %s
10 /// Check that the PLTRELSZ tag does not include the IRELATIVE relocations
11 // CHECK: DynamicSection [
12 // CHECK: 0x00000012 RELSZ 24 (bytes)
13 // CHECK: 0x00000002 PLTRELSZ 16 (bytes)
15 /// Check that the IRELATIVE relocations are placed to the .rel.dyn section after
16 /// other regular relocations (e.g. GLOB_DAT).
17 // CHECK: Relocations [
18 // CHECK-NEXT: Section (4) .rel.dyn {
19 // CHECK-NEXT: 0x4022C8 R_386_GLOB_DAT bar3
20 // CHECK-NEXT: 0x4032E0 R_386_IRELATIVE -
21 // CHECK-NEXT: 0x4032E4 R_386_IRELATIVE -
22 // CHECK-NEXT: }
23 // CHECK-NEXT: Section (5) .rel.plt {
24 // CHECK-NEXT: 0x4032D8 R_386_JUMP_SLOT bar2
25 // CHECK-NEXT: 0x4032DC R_386_JUMP_SLOT zed2
26 // CHECK-NEXT: }
28 // Check that IRELATIVE .got.plt entries point to ifunc resolver and not
29 // back to the plt entry + 6.
30 // GOTPLT: Contents of section .got.plt:
31 // GOTPLT: 4032cc 50224000 00000000 00000000 16124000
32 // GOTPLT-NEXT: 4032dc 26124000 dc114000 dd114000
33 // ^ ^-- <bar> (0x4011dd)
34 // -- <foo> (0x4011dcd)
36 /// Check that we have 2 PLT sections: one regular .plt section and one
37 /// .iplt section for ifunc entries.
38 // DISASM: Disassembly of section .text:
39 // DISASM-EMPTY:
40 // DISASM-NEXT: <foo>:
41 // DISASM-NEXT: 4011dc: retl
42 // DISASM: <bar>:
43 // DISASM-NEXT: 4011dd: retl
44 // DISASM: <_start>:
45 // DISASM-NEXT: 4011de: calll 0x401230
46 // DISASM-NEXT: calll 0x401240
47 // DISASM-NEXT: calll 0x401210 <bar2@plt>
48 // DISASM-NEXT: calll 0x401220 <zed2@plt>
49 // DISASM-NEXT: movl -0x1004(%eax), %eax
50 // DISASM-EMPTY:
51 // DISASM-NEXT: Disassembly of section .plt:
52 // DISASM-EMPTY:
53 // DISASM-NEXT: <.plt>:
54 // DISASM-NEXT: 401200: pushl 0x4032d0
55 // DISASM-NEXT: jmpl *0x4032d4
56 // DISASM-NEXT: nop
57 // DISASM-NEXT: nop
58 // DISASM-NEXT: nop
59 // DISASM-NEXT: nop
60 // DISASM-EMPTY:
61 // DISASM-NEXT: <bar2@plt>:
62 // DISASM-NEXT: 401210: jmpl *0x4032d8
63 // DISASM-NEXT: pushl $0x0
64 // DISASM-NEXT: jmp 0x401200 <.plt>
65 // DISASM-EMPTY:
66 // DISASM-NEXT: <zed2@plt>:
67 // DISASM-NEXT: 401220: jmpl *0x4032dc
68 // DISASM-NEXT: pushl $0x8
69 // DISASM-NEXT: jmp 0x401200 <.plt>
70 // DISASM-EMPTY:
71 // DISASM-NEXT: Disassembly of section .iplt:
72 // DISASM-EMPTY:
73 // DISASM-NEXT: <.iplt>:
74 // DISASM-NEXT: jmpl *0x4032e0
75 // DISASM-NEXT: pushl $0x0
76 // DISASM-NEXT: jmp 0x401200 <.plt>
77 // DISASM-NEXT: jmpl *0x4032e4
78 // DISASM-NEXT: pushl $0x8
79 // DISASM-NEXT: jmp 0x401200 <.plt>
81 .text
82 .type foo STT_GNU_IFUNC
83 .globl foo
84 foo:
85 ret
87 .type bar STT_GNU_IFUNC
88 .globl bar
89 bar:
90 ret
92 .globl _start
93 _start:
94 call foo@plt
95 call bar@plt
96 call bar2@plt
97 call zed2@plt
98 movl bar3@GOT(%eax), %eax