From patchwork Mon Dec 5 13:43:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Joakim_Nohlg=C3=A5rd?= X-Patchwork-Id: 29680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2260890wrr; Mon, 5 Dec 2022 05:44:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf4OQsMKTJ1d8CIuKyy2eC2as+oi1TPDqCbJeKkUPjPUZ0MVECJ6VNNoWhJ55mYesx7hRI4Q X-Received: by 2002:a17:906:81c9:b0:7c0:deb6:fcea with SMTP id e9-20020a17090681c900b007c0deb6fceamr7111532ejx.291.1670247877305; Mon, 05 Dec 2022 05:44:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670247877; cv=none; d=google.com; s=arc-20160816; b=nGmGzFZIN7B2h7VrdaPe6HSRilhKxn2xUim/YD7XIASUKB6hDUYn5c2QYBL61K9uMe vvKePPck5jT6ePd0b9mXmr0D8llfXwtrys0saIYcwncI1mkskmuPO8geC2QvrUsG9BYC yOoMp3z4TmNgUVUsQLztimW57OaBhX/DZv26Qq73M5imfh4cl4ZXgJgL5NBvyO8gdmbV rx3dby87ronLPs+GYcrjle4HTe0z/OO+mqSUYfN7AmIUTkJa1qBNeHOTI4DV6Pn/ALuN fCSqwrYu6ctBZVqrDbrU4Tqsqa04B9rez8v6kOwo6vbPtEWzki+DMNGmX4PpgknnmPMi +Ywg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=VQG7OjstGMJELu4od7tPNSv6MAFXkzEYKKlGyIvkI0E=; b=VMhHkYwHR0flfEOtc0a4Zm3Ib9Q1pWCez2Obn1wrRYNeuj22m0lBdhVUs0JaZVYGD9 QhQHe2S1rP0HCg3CW7iWFbWtXmmAAl3mHjaBT06npnvcbC5ipGvaU8ytB6naTVSEvE3Z fygMsUYTDItiSvk+zDq+ONPi0Le4+uBThfszNroaEdMR/IlbM3kHOY5e6yVAiEJMOwM5 5NF00J0clV3tvI5B0y7FcdH1E4xGLM+Ntxk1gM5iXxStMg9Af8cAcWO0QBODnKNBVZfH PlI6Ukrt3zjmoU1MO/MDXdYZ/+TbUM0mQaTxfYPLWfGY39EXsEQ7tNlsjuojke/GdLUy aYYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nohlgard.se header.s=google header.b=TZq6fv+b; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ho9-20020a1709070e8900b007c106ff40ddsi56726ejc.631.2022.12.05.05.44.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 05:44:37 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@nohlgard.se header.s=google header.b=TZq6fv+b; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 449F838A8164 for ; Mon, 5 Dec 2022 13:44:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id 591D338A814D for ; Mon, 5 Dec 2022 13:44:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 591D338A814D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nohlgard.se Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nohlgard.se Received: by mail-lf1-x12f.google.com with SMTP id x28so1283506lfn.6 for ; Mon, 05 Dec 2022 05:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nohlgard.se; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VQG7OjstGMJELu4od7tPNSv6MAFXkzEYKKlGyIvkI0E=; b=TZq6fv+b0dc1uCLmTL6q3draPZjtr1aDQ+LcAeUINiJDa5caYai9bmuD54WkgK29Hm GODneyhLlHH8LU2EeV8gEdMEb/Irw8xcI605G21iYDEEI7e2hs5vPvd7AjBsjl5XxEit hOu91OrTntqw+O+3raw02m8caChx0U695AB8YTYMB3QH9J5AqWLOPn+uMR/SNQ5sjMpo BfEZJxVLYHIT3v0BfaUgaYTLKWunxMtd2Az2u7njlcT812YzYLjAgTDdElsxF7byldVS H0XWBEsS2BYIvrQ6ZJSO+QJBeSKYs80DpA8yEqDZq5o9wg+ByiT1Nv3RwPXLywZi73R1 hOjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VQG7OjstGMJELu4od7tPNSv6MAFXkzEYKKlGyIvkI0E=; b=kf7sZH6t6PuijYKGLw2rxgqm0K/StxUSa2KiTW1cZXlvYocln+cvOms3zxauBFivf5 m536Kh2wDt567vwWuFW7bcZZKOWepeT5vmP82TjEN8RdQZdDN6aMzjVWi+JKOurI5CFk LiC5Vcwyj7V+SG1kxBwRIycda7dm7gr0Ar+yNMbA52ph9T4BPYE54Wzkd5xIWcEL1R0R HLbElb/wVu8kJjKZD3zig2oqy8u/WVLxgywCiiVwdqitSUO0ij1zAxOsfif24f6YbLhl gIB3eXYq+Z4pxrrwTkhEso7rIwOu6cQcF4uen2SUDdtQGBAhC+qJBYK7S0ADlruv3qq4 gG1A== X-Gm-Message-State: ANoB5pmUS4+afaJro1gca7nH7E/NL594jC9oBDOxyQee7nTI4gNN5bJL buu/G4kLloYhuweFKOTZc1YuNsKqh5NTFZnp X-Received: by 2002:ac2:4347:0:b0:4a4:782a:42ac with SMTP id o7-20020ac24347000000b004a4782a42acmr26176660lfl.468.1670247838401; Mon, 05 Dec 2022 05:43:58 -0800 (PST) Received: from cppdev.jnohlgard-laptop (81-26-241-118.customers.ownit.se. [81.26.241.118]) by smtp.gmail.com with ESMTPSA id o14-20020a056512230e00b004a26ba3458fsm2132013lfu.62.2022.12.05.05.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 05:43:57 -0800 (PST) From: =?utf-8?q?Joakim_Nohlg=C3=A5rd?= To: gcc-patches@gcc.gnu.org Cc: =?utf-8?q?Joakim_Nohlg=C3=A5rd?= Subject: [PATCH v2] gcc: Use ld -r when checking for HAVE_LD_RO_RW_SECTION_MIXING Date: Mon, 5 Dec 2022 14:43:49 +0100 Message-Id: <20221205134349.1730053-1-joakim@nohlgard.se> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751381838297554271?= X-GMAIL-MSGID: =?utf-8?q?1751381838297554271?= 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 Signed-off-by: Joakim NohlgÄrd --- gcc/configure.ac | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/gcc/configure.ac b/gcc/configure.ac index 7c55bff6cb0..500829ceb1d 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3152,16 +3152,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