Skip to content

Commit 06bfdc6

Browse files
loongson-cailululzshhxx
authored andcommitted
LoongArch: Fix loongarch*-elf target ld testsuite failure
The loongarch*-elf target does not support SHARED and PIE, so this target is skipped for some tests that require these options.
1 parent 1c729b7 commit 06bfdc6

File tree

3 files changed

+71
-59
lines changed

3 files changed

+71
-59
lines changed

ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,21 @@ if [istarget "loongarch32-*-*"] {
4343
}
4444

4545
if [istarget "loongarch64-*-*"] {
46-
run_ld_link_tests \
47-
[list \
48-
[list \
49-
"64_pcrel" \
50-
"-e 0x0 -z relro" "" \
51-
"" \
52-
{64_pcrel.s} \
53-
[list \
54-
[list objdump -D 64_pcrel.d] \
55-
] \
56-
"64_pcrel" \
57-
] \
58-
]
46+
if [check_shared_lib_support] {
47+
run_ld_link_tests \
48+
[list \
49+
[list \
50+
"64_pcrel" \
51+
"-e 0x0 -z relro" "" \
52+
"" \
53+
{64_pcrel.s} \
54+
[list \
55+
[list objdump -D 64_pcrel.d] \
56+
] \
57+
"64_pcrel" \
58+
] \
59+
]
60+
}
5961

6062
run_ld_link_tests \
6163
[list \
@@ -71,10 +73,12 @@ if [istarget "loongarch64-*-*"] {
7173
}
7274

7375
if [istarget "loongarch64-*-*"] {
76+
if [check_shared_lib_support] {
7477
run_dump_test "desc-ie"
7578
run_dump_test "desc-le"
7679
run_dump_test "ie-le"
7780
run_dump_test "tlsdesc-dso"
7881
run_dump_test "desc-norelax"
7982
run_dump_test "desc-relax"
83+
}
8084
}

ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#as:
22
#ld: -shared -z combreloc
33
#objdump: -R
4+
#skip: loongarch*-elf
45

56
.*: +file format .*
67

ld/testsuite/ld-loongarch-elf/relax.exp

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,19 @@ if [istarget loongarch64-*-*] {
150150
}
151151
}
152152

153-
run_ld_link_tests \
154-
[list \
155-
[list \
156-
"loongarch relax .so build" \
157-
"-shared -e 0x0" "" \
158-
"" \
159-
{relax-so.s} \
160-
{} \
161-
"relax-so" \
162-
] \
163-
]
153+
if [check_shared_lib_support] {
154+
run_ld_link_tests \
155+
[list \
156+
[list \
157+
"loongarch relax .so build" \
158+
"-shared -e 0x0" "" \
159+
"" \
160+
{relax-so.s} \
161+
{} \
162+
"relax-so" \
163+
] \
164+
]
165+
}
164166

165167
if [file exist "tmpdir/relax-so"] {
166168
set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax-so"]
@@ -173,29 +175,31 @@ if [istarget loongarch64-*-*] {
173175

174176
# If symbol in data segment, offset need to sub segment align to prevent
175177
# overflow.
176-
run_ld_link_tests \
177-
[list \
178-
[list \
179-
"loongarch relax segment alignment min" \
180-
"-e0 -Ttext 0x120004000 -pie -z relro" "" \
181-
"" \
182-
{relax-segment-min.s} \
183-
{} \
184-
"relax-segment-min" \
185-
] \
186-
]
178+
if [check_pie_support] {
179+
run_ld_link_tests \
180+
[list \
181+
[list \
182+
"loongarch relax segment alignment min" \
183+
"-e0 -Ttext 0x120004000 -pie -z relro" "" \
184+
"" \
185+
{relax-segment-min.s} \
186+
{} \
187+
"relax-segment-min" \
188+
] \
189+
]
187190

188-
run_ld_link_tests \
189-
[list \
190-
[list \
191-
"loongarch relax segment alignment max" \
192-
"-e0 -Ttext 0x120004000 -pie -z relro" "" \
193-
"" \
194-
{relax-segment-max.s} \
195-
{} \
196-
"relax-segment-max" \
197-
] \
198-
]
191+
run_ld_link_tests \
192+
[list \
193+
[list \
194+
"loongarch relax segment alignment max" \
195+
"-e0 -Ttext 0x120004000 -pie -z relro" "" \
196+
"" \
197+
{relax-segment-max.s} \
198+
{} \
199+
"relax-segment-max" \
200+
] \
201+
]
202+
}
199203

200204
if [file exist "tmpdir/relax-tls-le"] {
201205
set objdump_output1 [run_host_cmd "objdump" "-d tmpdir/relax-tls-le"]
@@ -265,19 +269,22 @@ if [istarget loongarch64-*-*] {
265269
}
266270

267271
}
268-
run_ld_link_tests \
269-
[list \
270-
[list \
271-
"loongarch relax-align" \
272-
"-e 0x0 -z relro" "" \
273-
"--no-warn" \
274-
{relax-align.s} \
275-
[list \
276-
[list objdump -d relax-align.dd] \
277-
] \
278-
"relax-align" \
279-
] \
280-
]
272+
273+
if [check_shared_lib_support] {
274+
run_ld_link_tests \
275+
[list \
276+
[list \
277+
"loongarch relax-align" \
278+
"-e 0x0 -z relro" "" \
279+
"--no-warn" \
280+
{relax-align.s} \
281+
[list \
282+
[list objdump -d relax-align.dd] \
283+
] \
284+
"relax-align" \
285+
] \
286+
]
287+
}
281288

282289
set objdump_flags "-s -j .data"
283290
run_ld_link_tests \

0 commit comments

Comments
 (0)