2 # RUN: llvm-mc -mno-fixup -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
3 # RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %S/Inputs/hexagon-shared.s -o %t2.o
4 # RUN: ld.lld -shared %t2.o -soname so -o %t3.so
5 # RUN: ld.lld -shared %t.o %t3.so -o %t4.so
6 # RUN: ld.lld -Bsymbolic -shared %t.o %t3.so -o %t5.so
7 # RUN: llvm-objdump --no-print-imm-hex -d -j .plt %t4.so | FileCheck --check-prefix=PLT %s
8 # RUN: llvm-objdump --no-print-imm-hex -d -j .text %t4.so | FileCheck --check-prefix=TEXT %s
9 # RUN: llvm-objdump --no-print-imm-hex -D -j .got %t4.so | FileCheck --check-prefix=GOT %s
10 # RUN: llvm-readelf -r %t4.so | FileCheck --check-prefix=RELO %s
11 # RUN: llvm-readelf -r %t5.so | FileCheck --check-prefix=SYMBOLIC %s
13 .global _start, foo, hidden_symbol
16 # When -Bsymbolic is specified calls to locally resolvables should
19 # Calls to hidden_symbols should not trigger a plt.
33 # R_HEX_GOT_11_X and R_HEX_GOT_32_6_X
34 r2=add(pc
,##_GLOBAL_OFFSET_TABLE_@PCREL)
35 r0 = memw
(r2+
##bar@GOT)
39 r0 = add(r1,##bar@GOT)
41 # R_HEX_GOT_16_X, duplex
42 { r0 = add(r0,##bar@GOT)
45 # R_HEX_GOT_16_X, pred add
46 if
(p0
) r0 = add(r0,##bar@GOT)
47 if
(!p0
) r0 = add(r0,##bar@GOT)
48 { p0
= cmp.gtu
(r0, r1)
49 if
(p0.new
) r0 = add(r0,##bar@GOT) }
50 { p0
= cmp.gtu
(r0, r1)
51 if
(!p0.new
) r0 = add(r0,##bar@GOT) }
53 # foo is local so no plt will be generated
75 # PLT: { immext(#131264
76 # PLT-NEXT: r28 = add(pc,##131268) }
77 # PLT-NEXT: { r14 -= add(r28,#16)
78 # PLT-NEXT: r15 = memw(r28+#8)
79 # PLT-NEXT: r28 = memw(r28+#4) }
80 # PLT-NEXT: { r14 = asr(r14,#2)
81 # PLT-NEXT: jumpr r28 }
82 # PLT-NEXT: { trap0(#219) }
83 # PLT-NEXT: immext(#131200)
84 # PLT-NEXT: r14 = add(pc,##131252) }
85 # PLT-NEXT: r28 = memw(r14+#0) }
86 # PLT-NEXT: jumpr r28 }
88 # TEXT: bc 00 01 00 000100bc
89 # TEXT: { call 0x10300 }
90 # TEXT: if (p0) jump:nt 0x10300
91 # TEXT: r0 = #0 ; jump 0x10300
92 # TEXT: r0 = add(r1,##-65548)
93 # TEXT: r0 = add(r0,##-65548); memw(r0+#0) = r2 }
94 # TEXT: if (p0) r0 = add(r0,##-65548)
95 # TEXT: if (!p0) r0 = add(r0,##-65548)
96 # TEXT: if (p0.new) r0 = add(r0,##-65548)
97 # TEXT: if (!p0.new) r0 = add(r0,##-65548)
100 # GOT: 00 00 00 00 00000000 <unknown>
102 # RELO: R_HEX_GLOB_DAT
104 # RELO: Relocation section '.rela.plt' at offset 0x22c contains 2 entries:
105 # RELO: R_HEX_JMP_SLOT {{.*}} foo
106 # RELO-NEXT: R_HEX_JMP_SLOT {{.*}} bar
107 # RELO-NOT: R_HEX_JMP_SLOT {{.*}} hidden
109 # Make sure that no PLT is generated for a local call.
110 # SYMBOLIC: Relocation section '.rela.plt' at offset 0x22c contains 1 entries:
111 # SYMBOLIC: R_HEX_JMP_SLOT {{.*}} bar
112 # SYMBOLIC-NOT: R_HEX_JMP_SLOT {{.*}} foo