|
29 | 29 | # RUN: ld.lld -e 0 -z now a.32.o c.32.so -o a.32.ie
|
30 | 30 | # RUN: llvm-objdump --no-show-raw-insn -M no-aliases -h -d a.32.ie | FileCheck %s --check-prefix=IE32
|
31 | 31 |
|
32 |
| -# RUN: llvm-mc -triple=riscv64 -filetype=obj d.s -o d.64.o |
33 |
| -# RUN: not ld.lld -shared -soname=d.64.so -o d.64.so d.64.o 2>&1 | FileCheck %s --check-prefix=BADTLSLABEL |
| 32 | +## Prior to https://github.com/llvm/llvm-project/pull/85817 the local TLSDESC |
| 33 | +## labels would be marked STT_TLS, resulting in an error "has an STT_TLS symbol but doesn't have an SHF_TLS section" |
34 | 34 |
|
| 35 | +# RUN: llvm-mc -triple=riscv64 -filetype=obj d.s -o d.64.o |
| 36 | +# RUN: ld.lld -shared -soname=d.64.so -o d.64.so d.64.o --fatal-warnings |
35 | 37 | # RUN: llvm-mc -triple=riscv32 -filetype=obj d.s -o d.32.o --defsym ELF32=1
|
36 |
| -# RUN: not ld.lld -shared -soname=d.32.so -o d.32.so d.32.o 2>&1 | FileCheck %s --check-prefix=BADTLSLABEL |
| 38 | +# RUN: ld.lld -shared -soname=d.32.so -o d.32.so d.32.o --fatal-warnings |
37 | 39 |
|
38 | 40 | # GD64-RELA: .rela.dyn {
|
39 | 41 | # GD64-RELA-NEXT: 0x2408 R_RISCV_TLSDESC - 0x7FF
|
|
74 | 76 | # GD64-NEXT: add a0, a0, tp
|
75 | 77 |
|
76 | 78 | ## &.got[b]-. = 0x23e0+40 - 0x12f4 = 0x1114
|
77 |
| -# GD64-NEXT: 12f4: auipc a2, 0x1 |
| 79 | +# GD64: 12f4: auipc a2, 0x1 |
78 | 80 | # GD64-NEXT: ld a3, 0x114(a2)
|
79 | 81 | # GD64-NEXT: addi a0, a2, 0x114
|
80 | 82 | # GD64-NEXT: jalr t0, 0x0(a3)
|
81 | 83 | # GD64-NEXT: add a0, a0, tp
|
82 | 84 |
|
83 | 85 | ## &.got[c]-. = 0x23e0+24 - 0x1308 = 0x10f0
|
84 |
| -# GD64-NEXT: 1308: auipc a4, 0x1 |
| 86 | +# GD64: 1308: auipc a4, 0x1 |
85 | 87 | # GD64-NEXT: ld a5, 0xf0(a4)
|
86 | 88 | # GD64-NEXT: addi a0, a4, 0xf0
|
87 | 89 | # GD64-NEXT: jalr t0, 0x0(a5)
|
88 | 90 | # GD64-NEXT: add a0, a0, tp
|
89 | 91 |
|
90 | 92 | # NOREL: no relocations
|
91 | 93 |
|
92 |
| -# LE64-LABEL: <.text>: |
| 94 | +# LE64-LABEL: <.Ltlsdesc_hi0>: |
93 | 95 | ## st_value(a) = 8
|
94 | 96 | # LE64-NEXT: addi zero, zero, 0x0
|
95 | 97 | # LE64-NEXT: addi zero, zero, 0x0
|
96 | 98 | # LE64-NEXT: addi zero, zero, 0x0
|
97 | 99 | # LE64-NEXT: addi a0, zero, 0x8
|
98 | 100 | # LE64-NEXT: add a0, a0, tp
|
99 | 101 | ## st_value(b) = 2047
|
| 102 | +# LE64-LABEL: <.Ltlsdesc_hi1>: |
100 | 103 | # LE64-NEXT: addi zero, zero, 0x0
|
101 | 104 | # LE64-NEXT: addi zero, zero, 0x0
|
102 | 105 | # LE64-NEXT: addi zero, zero, 0x0
|
103 | 106 | # LE64-NEXT: addi a0, zero, 0x7ff
|
104 | 107 | # LE64-NEXT: add a0, a0, tp
|
105 | 108 | ## st_value(c) = 2048
|
| 109 | +# LE64-LABEL: <.Ltlsdesc_hi2>: |
106 | 110 | # LE64-NEXT: addi zero, zero, 0x0
|
107 | 111 | # LE64-NEXT: addi zero, zero, 0x0
|
108 | 112 | # LE64-NEXT: lui a0, 0x1
|
|
116 | 120 | # IE64: .got 00000010 00000000000123a8
|
117 | 121 |
|
118 | 122 | ## a and b are optimized to use LE. c is optimized to IE.
|
119 |
| -# IE64-LABEL: <.text>: |
| 123 | +# IE64-LABEL: <.Ltlsdesc_hi0>: |
120 | 124 | # IE64-NEXT: addi zero, zero, 0x0
|
121 | 125 | # IE64-NEXT: addi zero, zero, 0x0
|
122 | 126 | # IE64-NEXT: addi zero, zero, 0x0
|
123 | 127 | # IE64-NEXT: addi a0, zero, 0x8
|
124 | 128 | # IE64-NEXT: add a0, a0, tp
|
| 129 | +# IE64-LABEL: <.Ltlsdesc_hi1>: |
125 | 130 | # IE64-NEXT: addi zero, zero, 0x0
|
126 | 131 | # IE64-NEXT: addi zero, zero, 0x0
|
127 | 132 | # IE64-NEXT: addi zero, zero, 0x0
|
128 | 133 | # IE64-NEXT: addi a0, zero, 0x7ff
|
129 | 134 | # IE64-NEXT: add a0, a0, tp
|
130 | 135 | ## &.got[c]-. = 0x123a8+8 - 0x112b8 = 0x10f8
|
| 136 | +# IE64-LABEL: <.Ltlsdesc_hi2>: |
131 | 137 | # IE64-NEXT: addi zero, zero, 0x0
|
132 | 138 | # IE64-NEXT: addi zero, zero, 0x0
|
133 | 139 | # IE64-NEXT: 112b8: auipc a0, 0x1
|
|
136 | 142 |
|
137 | 143 | # IE32: .got 00000008 00012248
|
138 | 144 |
|
139 |
| -# IE32-LABEL: <.text>: |
| 145 | +# IE32-LABEL: <.Ltlsdesc_hi0>: |
140 | 146 | ## st_value(a) = 8
|
141 | 147 | # IE32-NEXT: addi zero, zero, 0x0
|
142 | 148 | # IE32-NEXT: addi zero, zero, 0x0
|
143 | 149 | # IE32-NEXT: addi zero, zero, 0x0
|
144 | 150 | # IE32-NEXT: addi a0, zero, 0x8
|
145 | 151 | # IE32-NEXT: add a0, a0, tp
|
146 | 152 | ## st_value(b) = 2047
|
| 153 | +# IE32-LABEL: <.Ltlsdesc_hi1>: |
147 | 154 | # IE32-NEXT: addi zero, zero, 0x0
|
148 | 155 | # IE32-NEXT: addi zero, zero, 0x0
|
149 | 156 | # IE32-NEXT: addi zero, zero, 0x0
|
150 | 157 | # IE32-NEXT: addi a0, zero, 0x7ff
|
151 | 158 | # IE32-NEXT: add a0, a0, tp
|
152 | 159 | ## &.got[c]-. = 0x12248+4 - 0x111cc = 0x1080
|
| 160 | +# IE32-LABEL: <.Ltlsdesc_hi2>: |
153 | 161 | # IE32-NEXT: addi zero, zero, 0x0
|
154 | 162 | # IE32-NEXT: addi zero, zero, 0x0
|
155 | 163 | # IE32-NEXT: 111cc: auipc a0, 0x1
|
156 | 164 | # IE32-NEXT: lw a0, 0x80(a0)
|
157 | 165 | # IE32-NEXT: add a0, a0, tp
|
158 | 166 |
|
159 |
| -## FIXME This should not pass, but the code MC layer needs a fix to prevent this. |
160 |
| -# BADTLSLABEL: error: d.{{.*}}.o has an STT_TLS symbol but doesn't have an SHF_TLS section |
161 |
| - |
162 | 167 | #--- a.s
|
163 | 168 | .macro load dst, src
|
164 | 169 | .ifdef ELF32
|
|
0 commit comments