From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 7BD973858D35; Sun, 30 Apr 2023 16:34:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BD973858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682872498; bh=Zj4MiT+SBHJ82uMxf2rub+rv9Ecal2Ow4H7XHc2cMPQ=; h=From:To:Subject:Date:From; b=UONCQlcSdsxPDHX1Rf+QEf6wO80i0B1R8i2KxmW230kx2e/wOARtUiV00oIHKhv5D 9Eoj9KXS+iiIcEJV58dMSq88R8IAEpL1LtLeZjAz6qOO7IaR+O6LEJO87IdVuxtoBl TCeYkmt8Sy2v1e6p6S75Awn4BIm+EQ6zcR2FefSo= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-357] gcc: Use ld -r when checking for HAVE_LD_RO_RW_SECTION_MIXING X-Act-Checkin: gcc X-Git-Author: =?utf-8?q?Joakim_Nohlg=C3=A5rd?= X-Git-Refname: refs/heads/master X-Git-Oldrev: d2ab430a16caa62a4cd71490e1a8759a1dd09c8e X-Git-Newrev: 2744dbb9ecf104a113da3a0f39115da4653bb676 Message-Id: <20230430163458.7BD973858D35@sourceware.org> Date: Sun, 30 Apr 2023 16:34:58 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2744dbb9ecf104a113da3a0f39115da4653bb676 commit r14-357-g2744dbb9ecf104a113da3a0f39115da4653bb676 Author: Joakim NohlgÄrd Date: Sun Apr 30 10:34:26 2023 -0600 gcc: Use ld -r when checking for HAVE_LD_RO_RW_SECTION_MIXING Fall back to ld -r if ld -shared fails during configure. The check for HAVE_LD_RO_RW_SECTION_MIXING can fail 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 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 Diff: --- gcc/configure | 23 +++++++++++++---------- gcc/configure.ac | 23 +++++++++++++---------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/gcc/configure b/gcc/configure index c7b26d1927d..cdc7358a56b 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24391,16 +24391,19 @@ elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then echo '.byte 0' >> conftest3.s 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 \ - conftest2.o conftest3.o > /dev/null 2>&1; then - gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \ - | 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 - gcc_cv_ld_ro_rw_mix=read-only - else - gcc_cv_ld_ro_rw_mix=read-write + && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1; then + if $gcc_cv_ld -shared -o conftest1.so conftest1.o \ + conftest2.o conftest3.o > /dev/null 2>&1 \ + || $gcc_cv_ld -r -o conftest1.so conftest1.o \ + conftest2.o conftest3.o > /dev/null 2>&1; then + gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \ + | 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 + gcc_cv_ld_ro_rw_mix=read-only + else + gcc_cv_ld_ro_rw_mix=read-write + fi fi fi fi diff --git a/gcc/configure.ac b/gcc/configure.ac index 09082e8ccae..73ff7c23c63 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3187,16 +3187,19 @@ elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then echo '.byte 0' >> conftest3.s 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 \ - conftest2.o conftest3.o > /dev/null 2>&1; then - gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \ - | 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 - gcc_cv_ld_ro_rw_mix=read-only - else - gcc_cv_ld_ro_rw_mix=read-write + && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1; then + if $gcc_cv_ld -shared -o conftest1.so conftest1.o \ + conftest2.o conftest3.o > /dev/null 2>&1 \ + || $gcc_cv_ld -r -o conftest1.so conftest1.o \ + conftest2.o conftest3.o > /dev/null 2>&1; then + gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \ + | 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 + gcc_cv_ld_ro_rw_mix=read-only + else + gcc_cv_ld_ro_rw_mix=read-write + fi fi fi fi