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.
23 # RELOC-NEXT: 0x40078 R_HEX_JMP_SLOT bar 0x0
24 # RELOC-NEXT: 0x4007C R_HEX_JMP_SLOT weak 0x0
26 # GOTPLT: section '.got.plt'
27 # GOTPLT-NEXT: 0x00040068 00000000 00000000 00000000 00000000
28 # GOTPLT-NEXT: 0x00040078 00000000 00000000
33 # DIS-NEXT: { call 0x2003c }
35 # DIS-NEXT: { call 0x20060 }
37 # DIS-NEXT: { call 0x20070 }
38 # DIS-NEXT: { immext(#0)
41 # DIS-NEXT: if (p0) jump:nt 0x2003c }
42 # DIS-NEXT: { immext(#64)
44 # DIS-NEXT: if (p0) jump:nt 0x20060 }
45 # DIS-NEXT: { immext(#64)
47 # DIS-NEXT: if (p0) jump:nt 0x20070 }
48 # DIS-NEXT: { immext(#0)
51 # DIS-NEXT: r0 = #0 ; jump 0x2003c }
52 # DIS-NEXT: { immext(#0)
54 # DIS-NEXT: r0 = #0 ; jump 0x20060 }
55 # DIS-NEXT: { immext(#0)
57 # DIS-NEXT: r0 = #0 ; jump 0x20070 }
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) }
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 }
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
98 { r0 = #0; jump weak }
100 ## foo is local and non-preemptale, no PLT is generated.