From patchwork Sun Jul 23 01:06:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 124404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1045186vqg; Sat, 22 Jul 2023 18:08:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFa/jlvv/ChzxZtEwigwReuLxhyNkEh4iNMgnH2dfZsPQtEPxfz3xcVJsffd0RZWLp9LvN X-Received: by 2002:a05:6402:2ce:b0:522:1bdd:d41a with SMTP id b14-20020a05640202ce00b005221bddd41amr2336247edx.4.1690074507108; Sat, 22 Jul 2023 18:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690074507; cv=none; d=google.com; s=arc-20160816; b=V4C76LJkyVlvHx62oXTj5dl9KJDD8itPh3lhA+qZ0xMsXWAdSIoLR53r6jV2+qkj5s Gw/xvtJJwnANhEM6l8ZpGDtK9ZZesL7ar0AHvzZDfVCENAQyIJOaVcCtnJlblPKpykbr FArxZNDAkkKuhiiDSGWOo6+x37kDoyO5AtKYYCouRAxsPOp4XRDgjfMbOGU5uvIfehPH e6US1HTwtvGpD2Q+4ajzwZiprG2PYClMRIrwoeYYrj/6HEmaUnJ1AtQFww9t/9mLHuBX VXM0oIgf4IlwrsgYa4l2blc3szAlZKTMU0F7sHC4YdEcDbrf3qxIiG5D5JTLXzXtNvnX EH2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=TQkpjY4+7Ojtj4pYqybTfxl5//qwioNoQUHXUKC+lHo=; fh=09okz+w4tVyhQmqNBttR063P0zKcIsLE1JRBioNPGC4=; b=GaPO/ZMSV0OesbN3BKmBAQbiffctimG8O+QcbdCZtMeiCMWNWFmmGOKh/S/DvPXgZG GS6Y7TMFa+spg2XgbzJbMYusGKX8BaX7QZXog3uptqZgADg/Hyu5Uu8xmSFSNcmlPSmM 5MC3z0pYaFmxRmBNxzqBFuRaCbR6PbYcLrpauOQnSw0dNoEYEYT4XjQkUGLrM58rZLXT nn7jrAmYXi7OJClCu5/ITNOFyWSyGCCtzqOS9nqs617y8d+k+ZhKb/Yl9PZLYE80rcLc PGZwsUSOX/hLriSHjorvuQk8cbsAcIsVM8vd51+ScIuI9MtF6kRwrtVHexJdQnyMEHVa qZ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=BppDoyAh; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f13-20020a056402150d00b00521656f855dsi4722017edw.110.2023.07.22.18.08.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jul 2023 18:08:27 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b=BppDoyAh; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52A183857014 for ; Sun, 23 Jul 2023 01:08:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52A183857014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690074492; bh=TQkpjY4+7Ojtj4pYqybTfxl5//qwioNoQUHXUKC+lHo=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=BppDoyAh1KzFp0B+PsGEESLisvvSqWm3TJ23mrDN9NBv0daKE27aHaySik+afcowW d/ge5j61HbVuedqhYtq9n+8+KCS6JzZ75q8pRAZwYwOis3UsFsAu63SGrlHQeoCUAU f0qMETnfBfu1k8B1kYcOGwMAISUlbhy1asgDt6NU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id 355BB3858D33 for ; Sun, 23 Jul 2023 01:07:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 355BB3858D33 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36MNMRkp016422 for ; Sat, 22 Jul 2023 18:06:57 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3s0emks2dv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 22 Jul 2023 18:06:57 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 22 Jul 2023 18:06:55 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sat, 22 Jul 2023 18:06:55 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.76.242.112]) by maili.marvell.com (Postfix) with ESMTP id 092223F7073; Sat, 22 Jul 2023 18:06:54 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH 1/2] Fix PR 110066: crash with -pg -static on riscv Date: Sat, 22 Jul 2023 18:06:44 -0700 Message-ID: <20230723010645.1622083-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-GUID: sd5iL2mbv2k7cBnIYasn7QeMKyBy1bux X-Proofpoint-ORIG-GUID: sd5iL2mbv2k7cBnIYasn7QeMKyBy1bux X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-22_12,2023-07-20_01,2023-05-22_02 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , X-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772171566176905343 X-GMAIL-MSGID: 1772171566176905343 The problem -fasynchronous-unwind-tables is on by default for riscv linux We need turn it off for crt*.o because it would make __EH_FRAME_BEGIN__ point to .eh_frame data from crtbeginT.o instead of the user-defined object during static linking. This turns it off. OK? libgcc/ChangeLog: * config.host (riscv*-*-linux*): Add t-crtstuff to tmake_file. (riscv*-*-freebsd*): Likewise. * config/riscv/t-crtstuff: New file. --- libgcc/config.host | 4 ++-- libgcc/config/riscv/t-crtstuff | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 libgcc/config/riscv/t-crtstuff diff --git a/libgcc/config.host b/libgcc/config.host index 9d7212028d0..c94d69d84b7 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1304,12 +1304,12 @@ pru-*-*) tm_file="$tm_file pru/pru-abi.h" ;; riscv*-*-linux*) - tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc" + tmake_file="${tmake_file} riscv/t-crtstuff riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc" extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o" md_unwind_header=riscv/linux-unwind.h ;; riscv*-*-freebsd*) - tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc" + tmake_file="${tmake_file} riscv/t-crtstuff riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc" extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o" ;; riscv*-*-*) diff --git a/libgcc/config/riscv/t-crtstuff b/libgcc/config/riscv/t-crtstuff new file mode 100644 index 00000000000..685d11b3e66 --- /dev/null +++ b/libgcc/config/riscv/t-crtstuff @@ -0,0 +1,5 @@ +# -fasynchronous-unwind-tables -funwind-tables is on by default for riscv linux +# We turn it off for crt*.o because it would make __EH_FRAME_BEGIN__ point +# to .eh_frame data from crtbeginT.o instead of the user-defined object +# during static linking. +CRTSTUFF_T_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables