public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with recent ld
Date: Wed, 12 Oct 2022 16:51:19 +0200	[thread overview]
Message-ID: <20221012145117.GA3461@delia.home> (raw)

Hi,

On openSUSE Tumbleweed (with ld 2.39) and test-case
gdb.base/infoline-reloc-main-from-zero.exp, I get:
...
gdb compile failed, ld: warning: infoline-reloc-main-from-zero has a LOAD \
  segment with RWX permissions
UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: \
  infoline-reloc-main-from-zero.exp
...

Fix this by compiling with -Wl,--no-warn-rwx-segments.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with recent ld

---
 gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
index 31e753a0c1c..35c2db00c07 100644
--- a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
+++ b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
@@ -25,7 +25,15 @@ standard_testfile .c
 
 # Build executable with stripped startup code and text section starting at zero
 
-set opts {debug "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"}
+set opts {}
+lappend opts debug
+lappend opts "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"
+
+set ld_flags additional_flags=-Wl,--no-warn-rwx-segments
+if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \
+	  $ld_flags] } {
+    lappend opts $ld_flags
+}
 
 if {[build_executable $testfile.exp $testfile $srcfile $opts] == -1} {
     untested "failed to compile"

                 reply	other threads:[~2022-10-12 14:51 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=20221012145117.GA3461@delia.home \
    --to=tdevries@suse.de \
    --cc=gdb-patches@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).