Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / hexagon-shared.s
blob747822039e839af89ad5f29abfcf2cb3d6efe189
1 # REQUIRES: hexagon
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
14 .hidden hidden_symbol
15 _start:
16 # When -Bsymbolic is specified calls to locally resolvables should
17 # not generate a plt.
18 call ##foo
19 # Calls to hidden_symbols should not trigger a plt.
20 call ##hidden_symbol
22 # _HEX_32_PCREL
23 .word _DYNAMIC - .
24 call ##bar
26 # R_HEX_PLT_B22_PCREL
27 call bar@PLT
28 # R_HEX_B15_PCREL_X
29 if (p0) jump bar
30 # R_HEX_B9_PCREL_X
31 { r0 = #0; jump bar }
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)
36 jumpr r0
38 # R_HEX_GOT_16_X
39 r0 = add(r1,##bar@GOT)
41 # R_HEX_GOT_16_X, duplex
42 { r0 = add(r0,##bar@GOT)
43 memw(r0) = r2 }
46 # foo is local so no plt will be generated
47 foo:
48 jumpr lr
50 hidden_symbol:
51 jumpr lr
53 # R_HEX_32
54 .data
55 .global var
56 .type var,@object
57 .p2align 2
58 var:
59 .word 10
60 .size var, 4
61 .global pvar
62 .type pvar,@object
63 pvar:
64 .word var
65 .size pvar, 4
68 # PLT: { immext(#131264
69 # PLT-NEXT: r28 = add(pc,##131268) }
70 # PLT-NEXT: { r14 -= add(r28,#16)
71 # PLT-NEXT: r15 = memw(r28+#8)
72 # PLT-NEXT: r28 = memw(r28+#4) }
73 # PLT-NEXT: { r14 = asr(r14,#2)
74 # PLT-NEXT: jumpr r28 }
75 # PLT-NEXT: { trap0(#219) }
76 # PLT-NEXT: immext(#131200)
77 # PLT-NEXT: r14 = add(pc,##131252) }
78 # PLT-NEXT: r28 = memw(r14+#0) }
79 # PLT-NEXT: jumpr r28 }
81 # TEXT: 8c 00 01 00 0001008c
82 # TEXT: { call 0x102d0 }
83 # TEXT: if (p0) jump:nt 0x102d0
84 # TEXT: r0 = #0 ; jump 0x102d0
85 # TEXT: r0 = add(r1,##-65548)
86 # TEXT: r0 = add(r0,##-65548); memw(r0+#0) = r2 }
88 # GOT: .got:
89 # GOT: 00 00 00 00 00000000 <unknown>
91 # RELO: R_HEX_GLOB_DAT
92 # RELO: R_HEX_32
93 # RELO: Relocation section '.rela.plt' at offset 0x22c contains 2 entries:
94 # RELO: R_HEX_JMP_SLOT {{.*}} foo
95 # RELO-NEXT: R_HEX_JMP_SLOT {{.*}} bar
96 # RELO-NOT: R_HEX_JMP_SLOT {{.*}} hidden
98 # Make sure that no PLT is generated for a local call.
99 # SYMBOLIC: Relocation section '.rela.plt' at offset 0x22c contains 1 entries:
100 # SYMBOLIC: R_HEX_JMP_SLOT {{.*}} bar
101 # SYMBOLIC-NOT: R_HEX_JMP_SLOT {{.*}} foo