LoongArch: ld: Adjusted some code order in relax.exp.

ld/testsuite/ChangeLog:

	* ld/testsuite/ld-loongarch-elf/relax.exp: Modify test.
This commit is contained in:
changjiachen 2024-01-04 14:06:09 +08:00 committed by liuzhensong
parent 21455a847d
commit 2bee95b73c

View File

@ -33,90 +33,8 @@ if [istarget loongarch64-*-*] {
"relax" \
] \
]
set tls_relax_builds [list \
[list \
"tls_relax_builds" \
"" \
"" \
{relax-tls-le.s} \
{} \
"relax-tls-le" \
] \
]
set tls_no_relax_builds [list \
[list \
"tls_no_relax_builds" \
"-Wl,--no-relax" \
"" \
{relax-tls-le.s} \
{} \
"no-relax-tls-le" \
] \
]
set relax_bound_check [list \
[list \
"relax_bound_check" \
"" \
"" \
{relax-bound-check-tls-le.s} \
{} \
"relax-bound-check-tls-le" \
] \
]
set no_relax_bound_check [list \
[list \
"no_relax_bound_check" \
"-Wl,--no-relax" \
"" \
{relax-bound-check-tls-le.s} \
{} \
"no-relax-bound-check-tls-le" \
] \
]
set old_tls_le [list \
[list \
"old_tls_le" \
"" \
"" \
{old-tls-le.s} \
{} \
"old-tls-le" \
] \
]
set relax_compatible [list \
[list \
"relax_compatible" \
"" \
"" \
{tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \
{} \
"realx-compatible" \
] \
]
set no_relax_compatible [list \
[list \
"no_relax_compatible" \
"-Wl,--no-relax" \
"" \
{tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \
{} \
"no-realx-compatible" \
] \
]
run_cc_link_tests $pre_builds
run_cc_link_tests $tls_relax_builds
run_cc_link_tests $tls_no_relax_builds
run_cc_link_tests $relax_bound_check
run_cc_link_tests $no_relax_bound_check
run_cc_link_tests $old_tls_le
run_cc_link_tests $relax_compatible
run_cc_link_tests $no_relax_compatible
if [file exist "tmpdir/relax"] {
set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax"]
@ -173,6 +91,155 @@ if [istarget loongarch64-*-*] {
}
}
run_ld_link_tests \
[list \
[list \
"loongarch tls le relax .exe build" \
"" "" \
"" \
{relax-tls-le.s} \
{} \
"relax-tls-le" \
] \
]
if [file exist "tmpdir/relax-tls-le"] {
set objdump_output1 [run_host_cmd "objdump" "-d tmpdir/relax-tls-le"]
if { [ regexp ".addi.*st.*" $objdump_output1] } {
pass "loongarch relax success"
} {
fail "loongarch relax fail"
}
}
run_ld_link_tests \
[list \
[list \
"loongarch tls le no relax .exe build" \
"--no-relax" "" \
"" \
{relax-tls-le.s} \
{} \
"no-relax-tls-le" \
] \
]
if [file exist "tmpdir/no-relax-tls-le"] {
set objdump_output2 [run_host_cmd "objdump" "-d tmpdir/no-relax-tls-le"]
if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output2] } {
pass "loongarch no-relax success"
} {
fail "loongarch no-relax fail"
}
}
run_ld_link_tests \
[list \
[list \
"loongarch old tls le .exe build" \
"" "" \
"" \
{old-tls-le.s} \
{} \
"old-tls-le" \
] \
]
if [file exist "tmpdir/old-tls-le"] {
set objdump_output3 [run_host_cmd "objdump" "-d tmpdir/old-tls-le"]
if { [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output3] } {
pass "loongarch old tls le success"
} {
fail "loongarch old tls le fail"
}
}
run_ld_link_tests \
[list \
[list \
"loongarch tls le realx compatible .exe build" \
"" "" \
"" \
{tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \
{} \
"realx-compatible" \
] \
]
if [file exist "tmpdir/realx-compatible"] {
set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"]
if { [ regexp ".addi.*st.*" $objdump_output4] && \
[ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } {
pass "loongarch tls le relax compatible check success"
} {
fail "loongarch tls le relax compatible check fail"
}
}
run_ld_link_tests \
[list \
[list \
"loongarch tls le no realx compatible .exe build" \
"--no-relax" "" \
"" \
{tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \
{} \
"no-realx-compatible" \
] \
]
if [file exist "tmpdir/no-realx-compatible"] {
set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/no-realx-compatible"]
if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output4] && \
[ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } {
pass "loongarch tls le no-relax compatible check success"
} {
fail "loongarch tls le no-relax compatible check fail"
}
}
run_ld_link_tests \
[list \
[list \
"loongarch tls le realx bound-check .exe build" \
"" "" \
"" \
{relax-bound-check-tls-le.s} \
{} \
"relax-bound-check-tls-le" \
] \
]
if [file exist "tmpdir/relax-bound-check-tls-le"] {
set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/relax-bound-check-tls-le"]
if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output5] && \
[ regexp ".addi.*st.*" $objdump_output5] } {
pass "loongarch no-relax success"
} {
fail "loongarch no-relax fail"
}
}
run_ld_link_tests \
[list \
[list \
"loongarch tls le no realx bound-check .exe build" \
"--no-relax" "" \
"" \
{relax-bound-check-tls-le.s} \
{} \
"no-relax-bound-check-tls-le" \
] \
]
if [file exist "tmpdir/no-relax-bound-check-tls-le"] {
set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/no-relax-bound-check-tls-le"]
if { [ regexp ".*addi.*st.*" $objdump_output5] } {
pass "loongarch no-relax success"
} {
fail "loongarch no-relax fail"
}
}
# If symbol in data segment, offset need to sub segment align to prevent
# overflow.
if [check_pie_support] {
@ -201,73 +268,6 @@ if [istarget loongarch64-*-*] {
]
}
if [file exist "tmpdir/relax-tls-le"] {
set objdump_output1 [run_host_cmd "objdump" "-d tmpdir/relax-tls-le"]
if { [ regexp ".addi.*st.*" $objdump_output1] } {
pass "loongarch relax success"
} {
fail "loongarch relax fail"
}
}
if [file exist "tmpdir/no-relax-tls-le"] {
set objdump_output2 [run_host_cmd "objdump" "-d tmpdir/no-relax-tls-le"]
if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output2] } {
pass "loongarch no-relax success"
} {
fail "loongarch no-relax fail"
}
}
if [file exist "tmpdir/old-tls-le"] {
set objdump_output3 [run_host_cmd "objdump" "-d tmpdir/old-tls-le"]
if { [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output3] } {
pass "loongarch old tls le success"
} {
fail "loongarch old tls le fail"
}
}
if [file exist "tmpdir/realx-compatible"] {
set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"]
if { [ regexp ".addi.*st.*" $objdump_output4] && \
[ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } {
pass "loongarch tls le relax compatible check success"
} {
fail "loongarch tls le relax compatible check fail"
}
}
if [file exist "tmpdir/no-realx-compatible"] {
set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"]
if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output4] && \
[ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } {
pass "loongarch tls le no-relax compatible check success"
} {
fail "loongarch tls le no-relax compatible check fail"
}
}
if [file exist "tmpdir/relax-bound-check-tls-le"] {
set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/relax-bound-check-tls-le"]
if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output5] && \
[ regexp ".addi.*st.*" $objdump_output5] } {
pass "loongarch no-relax success"
} {
fail "loongarch no-relax fail"
}
}
if [file exist "tmpdir/no-relax-bound-check-tls-le"] {
set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/no-relax-bound-check-tls-le"]
if { [ regexp ".*addi.*st.*" $objdump_output5] } {
pass "loongarch no-relax success"
} {
fail "loongarch no-relax fail"
}
}
}
if [check_shared_lib_support] {