public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joakim Nohlgård" <joakim@nohlgard.se>
To: gcc-patches@gcc.gnu.org
Cc: "Joakim Nohlgård" <joakim@nohlgard.se>
Subject: [PATCH] gcc: Use ld -r when checking for HAVE_LD_RO_RW_SECTION_MIXING
Date: Mon, 28 Nov 2022 14:59:14 +0100	[thread overview]
Message-ID: <20221128135914.4068410-1-joakim@nohlgard.se> (raw)

The check for HAVE_LD_RO_RW_SECTION_MIXING fails on targets where ld
does not support shared objects, even though the answer to the test
should be 'read-write'. One such target is riscv64-unknown-elf. Failing
this test results in a libgcc crtbegin.o which has a writable .eh_frame
section leading to the default linker scripts placing the .eh_frame
section in a writable memory segment, or a linker warning about writable
sections in a read-only segment when using ld scripts that place
.eh_frame unconditionally in ROM.

gcc/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Use ld -r in the check for HAVE_LD_RO_RW_SECTION_MIXING

Signed-off-by: Joakim Nohlgård <joakim@nohlgard.se>
---
 gcc/configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 7c55bff6cb0..4f36ed4aff3 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3153,9 +3153,9 @@ elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
   if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
      && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
      && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
-     && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
+     && $gcc_cv_ld -r -o conftest.o conftest1.o \
 	conftest2.o conftest3.o > /dev/null 2>&1; then
-    gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
+    gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest.o \
 			 | sed -e '/myfoosect/!d' -e N`
     if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
       if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
-- 
2.38.1


             reply	other threads:[~2022-11-28 14:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 13:59 Joakim Nohlgård [this message]
2022-11-28 16:53 ` Jeff Law
2022-12-05 13:46   ` Joakim Nohlgård

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=20221128135914.4068410-1-joakim@nohlgard.se \
    --to=joakim@nohlgard.se \
    --cc=gcc-patches@gcc.gnu.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).