public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: binutils@sourceware.org
Subject: Commit: Fix PR 29072 test with --enable-default-execstack=no
Date: Wed, 21 Jun 2023 11:47:03 +0100	[thread overview]
Message-ID: <87352l6qjc.fsf@redhat.com> (raw)

Hi Guys,

  I noticed recently that if the linker is configured with the
  --enable-default-execstack=no option, then the
  target_defaults_to_execstack proc in the linker testsuite can return
  the wrong value for targets that enable executable stacks by default.
  
  So I am applying the patch below to add some code to the proc that
  checks the linker's config.status file for the configure option.  I
  realise that this will not work if the tests are being run on an
  installed version of the linker, but I could not think of any other
  way to perform the check.

Cheers
  Nick

ld/ChangeLog
2023-06-21  Nick Clifton  <nickc@redhat.com>

	PR 29072
	* testsuite/ld-elf/elf.exp (target_defaults_to_execstack): Always
	return false for linkers configured with the --enable-default-execstack=no
	option.

diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index cf0e949a966..a367cf41e95 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -180,6 +180,21 @@ if { [check_gc_sections_available] && ![istarget "v850-*-*"] } {
 }
 
 proc target_defaults_to_execstack {} {
+    global base_dir
+
+    # If the linker has been configured with --enable-default-execstack=no then
+    # this proc should always return 0.
+    if { [file exists $base_dir/config.status] } {
+	set status [remote_exec host grep "enable-default-execstack=no" $base_dir/config.status]
+	if { [lindex $status 0] == 0 } {
+	    return 0
+	} else {
+	    verbose -log "$base_dir/config.status does not contain enable-default-execstack=no"
+	}
+    } else {
+	verbose -log "there is no file $base_dir/config.status"
+    }
+    
     if {   [istarget "aarch64*-*-*"]
 	|| [istarget "arc*-*-*"]
 	|| [istarget "cris*-*-*"]


                 reply	other threads:[~2023-06-21 10:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87352l6qjc.fsf@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).