public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ld: Use run_host_cmd_yesno in indirect.exp instead of catch exec
@ 2023-06-30  6:07 YunQiang Su
  2023-07-05 21:30 ` Alan Modra
  2023-07-07  8:48 ` Nick Clifton
  0 siblings, 2 replies; 3+ messages in thread
From: YunQiang Su @ 2023-06-30  6:07 UTC (permalink / raw)
  To: binutils; +Cc: nickc, amodra, YunQiang Su

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 | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp
index eda48d30949..de5d9714e19 100644
--- a/ld/testsuite/ld-elf/indirect.exp
+++ b/ld/testsuite/ld-elf/indirect.exp
@@ -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
 }
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ld: Use run_host_cmd_yesno in indirect.exp instead of catch exec
  2023-06-30  6:07 [PATCH] ld: Use run_host_cmd_yesno in indirect.exp instead of catch exec YunQiang Su
@ 2023-07-05 21:30 ` Alan Modra
  2023-07-07  8:48 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Modra @ 2023-07-05 21:30 UTC (permalink / raw)
  To: YunQiang Su; +Cc: binutils, nickc

On Fri, Jun 30, 2023 at 02:07:57PM +0800, YunQiang Su wrote:
> 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.

OK, yes, we should be using run_host_cmd everywhere we invoke a
compiler in the ld testsuite.  One reason being that run_host_cmd
properly inserts $gcc_B_opt in cases where a user wants to test
binutils with a newly built compiler, ie. when $CC specifies -B.

I'm going to apply this one too.

	* testsuite/ld-elf/no-section-header.exp (binutils_run_test):
	Use run_host_cmd to invoke $CC.

diff --git a/ld/testsuite/ld-elf/no-section-header.exp b/ld/testsuite/ld-elf/no-section-header.exp
index c010e572a32..2d8c687dc0a 100644
--- a/ld/testsuite/ld-elf/no-section-header.exp
+++ b/ld/testsuite/ld-elf/no-section-header.exp
@@ -136,7 +136,6 @@ if { ![isnative] || ![check_shared_lib_support] } {
 
 proc binutils_run_test { prog } {
     global CC
-    global gcc_B_opt
     global READELF
     global NM
     global objcopy
@@ -354,8 +353,7 @@ proc binutils_run_test { prog } {
 	    return
 	}
 
-	send_log "$CC $gcc_B_opt -o tmpdir/pr25617-1 tmpdir/pr25617-1b.o tmpdir/pr25617-1a-now-no-sec-hdr.so\n"
-	catch "exec $CC $gcc_B_opt -o tmpdir/pr25617-1 tmpdir/pr25617-1b.o tmpdir/pr25617-1a-now-no-sec-hdr.so" got
+	set got [run_host_cmd $CC "-o tmpdir/pr25617-1 tmpdir/pr25617-1b.o tmpdir/pr25617-1a-now-no-sec-hdr.so"]
 	if ![string match "*pr25617-1a-now-no-sec-hdr.so*file in wrong format*" $got] then {
 	    send_log "$got\n"
 	    fail "Update pr25617-1a-now-no-sec-hdr.so ($prog_name)"


-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ld: Use run_host_cmd_yesno in indirect.exp instead of catch exec
  2023-06-30  6:07 [PATCH] ld: Use run_host_cmd_yesno in indirect.exp instead of catch exec YunQiang Su
  2023-07-05 21:30 ` Alan Modra
@ 2023-07-07  8:48 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2023-07-07  8:48 UTC (permalink / raw)
  To: YunQiang Su, binutils; +Cc: amodra

Hi YunQiang Su,

> 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.

Approved - please apply.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-07  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30  6:07 [PATCH] ld: Use run_host_cmd_yesno in indirect.exp instead of catch exec YunQiang Su
2023-07-05 21:30 ` Alan Modra
2023-07-07  8:48 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).