[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / hexagon-plt.s
blob9eca0e83afe6f4ba6b5d8a8ab007d8c7ca650834
1 # REQUIRES: hexagon
2 # RUN: echo '.globl bar, weak; .type bar,@function; .type weak,@function; bar: weak:' > %t1.s
4 # RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %t1.s -o %t1.o
5 # RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so
6 # RUN: llvm-mc -mno-fixup -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
7 # RUN: ld.lld %t.o %t1.so -z separate-code -o %t
8 # RUN: llvm-readelf -S -s %t | FileCheck --check-prefixes=SEC,NM %s
9 # RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
10 # RUN: llvm-readelf -x .got.plt %t | FileCheck --check-prefix=GOTPLT %s
11 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t | FileCheck --check-prefixes=DIS %s
13 # SEC: .plt PROGBITS {{0*}}00020040
15 ## A canonical PLT has a non-zero st_value. bar and weak are called but their
16 ## addresses are not taken, so a canonical PLT is not necessary.
17 # NM: {{0*}}00000000 0 FUNC GLOBAL DEFAULT UND bar
18 # NM: {{0*}}00000000 0 FUNC WEAK DEFAULT UND weak
20 ## The .got.plt slots relocated by .rela.plt point to .plt
21 ## This is required by glibc.
22 # RELOC: .rela.plt {
23 # RELOC-NEXT: 0x40078 R_HEX_JMP_SLOT bar 0x0
24 # RELOC-NEXT: 0x4007C R_HEX_JMP_SLOT weak 0x0
25 # RELOC-NEXT: }
26 # GOTPLT: section '.got.plt'
27 # GOTPLT-NEXT: 0x00040068 00000000 00000000 00000000 00000000
28 # GOTPLT-NEXT: 0x00040078 00000000 00000000
30 # DIS: <_start>:
31 ## Direct call
32 ## Call foo directly
33 # DIS-NEXT: { call 0x2003c }
34 ## Call bar via plt
35 # DIS-NEXT: { call 0x20060 }
36 ## Call weak via plt
37 # DIS-NEXT: { call 0x20070 }
38 # DIS-NEXT: { immext(#0)
40 ## Call foo directly
41 # DIS-NEXT: if (p0) jump:nt 0x2003c }
42 # DIS-NEXT: { immext(#64)
43 ## Call bar via plt
44 # DIS-NEXT: if (p0) jump:nt 0x20060 }
45 # DIS-NEXT: { immext(#64)
46 ## Call weak via plt
47 # DIS-NEXT: if (p0) jump:nt 0x20070 }
48 # DIS-NEXT: { immext(#0)
50 ## Call foo directly
51 # DIS-NEXT: r0 = #0 ; jump 0x2003c }
52 # DIS-NEXT: { immext(#0)
53 ## Call bar via plt
54 # DIS-NEXT: r0 = #0 ; jump 0x20060 }
55 # DIS-NEXT: { immext(#0)
56 ## Call weak via plt
57 # DIS-NEXT: r0 = #0 ; jump 0x20070 }
59 # DIS: <foo>:
60 # DIS-NEXT: 2003c:
63 # DIS: Disassembly of section .plt:
65 # DIS: 00020040 <.plt>:
66 # DIS-NEXT: 20040: { immext(#131072)
67 # DIS-NEXT: 20044: r28 = add(pc,##131112) }
68 # DIS-NEXT: 20048: { r14 -= add(r28,#16)
69 # DIS-NEXT: 2004c: r15 = memw(r28+#8)
70 # DIS-NEXT: 20050: r28 = memw(r28+#4) }
71 # DIS-NEXT: 20054: { r14 = asr(r14,#2)
72 # DIS-NEXT: 20058: jumpr r28 }
73 # DIS-NEXT: 2005c: { trap0(#219) }
74 ## bar's plt slot
75 # DIS-NEXT: 20060: { immext(#131072)
76 # DIS-NEXT: 20064: r14 = add(pc,##131096) }
77 # DIS-NEXT: 20068: { r28 = memw(r14+#0) }
78 # DIS-NEXT: 2006c: { jumpr r28 }
79 ## weak's plt slot
80 # DIS-NEXT: 20070: { immext(#131072)
81 # DIS-NEXT: 20074: r14 = add(pc,##131084) }
82 # DIS-NEXT: 20078: { r28 = memw(r14+#0) }
83 # DIS-NEXT: 2007c: { jumpr r28 }
86 .global _start, foo, bar
87 .weak weak
89 _start:
90 call foo
91 call bar
92 call weak
93 if (p0) jump foo
94 if (p0) jump bar
95 if (p0) jump weak
96 { r0 = #0; jump foo }
97 { r0 = #0; jump bar }
98 { r0 = #0; jump weak }
100 ## foo is local and non-preemptale, no PLT is generated.
101 foo:
102 jumpr r31