ld: Use run_host_cmd_yesno in indirect.exp instead of catch exec
authorYunQiang Su <yunqiang.su@cipunited.com>
Fri, 30 Jun 2023 06:07:57 +0000 (14:07 +0800)
committerYunQiang Su <yunqiang.su@cipunited.com>
Thu, 6 Jul 2023 01:04:53 +0000 (09:04 +0800)
Catch "exec $CC_FOR_TARGET" won't use the gas/ld that we just build,
and in fact run_host_cmd_yesno is a better choice for it.

ld/ChangeLog:

* testsuite/ld-elf/indirect.exp: use run_host_cmd_yesno
instead of handwrite catch exec $CC_FOR_TARGET.

ld/testsuite/ld-elf/indirect.exp

index eda48d309491b8800aa3dfd53176cc71b9c81985..de5d9714e19e2fdbb8449e000cc9098b3d4bddfc 100644 (file)
@@ -226,10 +226,7 @@ foreach t [list indirect5a indirect5b indirect6a indirect6b] {
     }
 }
 
-send_log "$CC_FOR_TARGET -fPIE -pie $srcdir/$subdir/main.c -o tmpdir/pie"
-catch "exec $CC_FOR_TARGET -fPIE -pie $srcdir/$subdir/main.c -o tmpdir/pie" exec_output
-send_log "$exec_output"
-if { ! [string match "" $exec_output] } {
+if { ![run_host_cmd_yesno $CC_FOR_TARGET "-fPIC -pie $srcdir/$subdir/main.c -o tmpdir/pie"] } {
     return
 }