From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=marvell.com 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=TQkpjY4+7Ojtj4pYqybTfxl5//qwioNoQUHXUKC+lHo=; b=ANQ2ESP+AGUtIlDVdmGvZHs9R54jC2DOtX5XUigzqlWqQ9iqQAwsmYw6vINbecJMgxB4 c1bd7Q48TM8U4VH4Uy13bXkpDOJ7ioXWrW+D0LHJM7nMy1UYuNcH6GJTIHNvtppKZMgs mmSVmIQHks794TmyuXJlpVPYvS9HKDjvlqN2M8pIyXi3uysbXPbbpjezog6ALNOr8dDJ OgL0eP1bkIjaIWE/tCUuig6oyBk3DCa8LwkT3VDSHnz/mKpxai4GxkB6zw+JoInyMZnn 4iK+nOkgocv00eLLB9+wLy4lRoyixYIsoCtOGaRKXTRcFlF4Ey1Fl0xi5zMvngU8aNsT PA== 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) From: Andrew Pinski 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 List-Id: 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 -- 2.39.1