From patchwork Mon Nov 28 13:59:14 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: 61166 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B64AE385221D for ; Mon, 28 Nov 2022 14:00:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by sourceware.org (Postfix) with ESMTPS id 6D8F3385B519 for ; Mon, 28 Nov 2022 14:00:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6D8F3385B519 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-lj1-x234.google.com with SMTP id j2so10709960ljg.10 for ; Mon, 28 Nov 2022 06:00:10 -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=N5c56scJyivTWZQioTGYd9lus2mTM+CQcu0BfBaeLfg=; b=c+DAbcLS1p4vbAVOw1tR3xejJa9wALU6FE4WepY/0FT0g4CSjWm80Rdd7syN/y+UEm l2gRMS4I2e4d09YjWwD8gSaa9FJTBRXiDrL8djWZVAeMgeFEl+t8HnqkKuMRnSnVEICa PzD0o7FQHHD6VW+C01ojxCBpmKuHnpvFWEGHB5lJ5kqdjhw1ntEJnywBOb4Uch9WRqqt BHjxADyoVEi/ImfmvcR0hqDoTEptKhxLqLWQFdr0rJh6lH9opiEd6rGE5E4VxihG2jLc F2YQNZTt0tjWsPUZ1GcQ0dUxLfLgC6+1O0My+kYdmFCGv4AaHFPt1N9/dqDVhK9EVDxq el5Q== 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=N5c56scJyivTWZQioTGYd9lus2mTM+CQcu0BfBaeLfg=; b=koRI4NW6SX8gbdv+1zqBzdB2AayB0w0v3zb9HJ1h66I3gNp5PMB5ZgEZKZviaS1v52 xNJo1evHAblGGWhYjU2JnzTPgyFmv4huBiiYrKJLjd+3AlUgHjGi1Ny7hy95tTqdh43S q32ctOa6Uo9SjR8MEnE5urGRkaGooABK0CCgjSBSL96Yn/EWk+znBdY48ttvIPG+GhUM CK6L5VHNPW8rNJji2sKFoF4gVSTzALvypz4vFR++sTR0bVtoK5CyyAAlrfu61B8b0DuT BEwuKqRTaKV1s+hQy8ogJc59layTX4YuIUHvOP+fQcnjFNHB9eLdCykpM/N82NlAjPmI zOiQ== X-Gm-Message-State: ANoB5pkK5wAe+O3Tz7yXZUUWr2gqgKNPDDXHGPqMvrCKtREI0iJCJ4eZ J5MwTJG2GuYYWhz1KxABiz/FRqcIRezL6w== X-Google-Smtp-Source: AA0mqf7KvSOTEOHgHhQWqXzTtaEt2xPPWeY2FDPrjOXs1/1kI2mnBY1SNXAhbGhWshq5cpHez/4DsQ== X-Received: by 2002:a05:651c:2391:b0:277:3b2:864b with SMTP id bk17-20020a05651c239100b0027703b2864bmr16864347ljb.298.1669644008530; Mon, 28 Nov 2022 06:00:08 -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 r7-20020ac24d07000000b0049aa20af00fsm1731339lfi.21.2022.11.28.06.00.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 06:00:08 -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] gcc: Use ld -r when checking for HAVE_LD_RO_RW_SECTION_MIXING Date: Mon, 28 Nov 2022 14:59:14 +0100 Message-Id: <20221128135914.4068410-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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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 --- 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