From patchwork Sun Dec 7 05:04:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ericson X-Patchwork-Id: 126089 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BB5B442F0C7 for ; Sun, 7 Dec 2025 05:06:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BB5B442F0C7 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=johnericson.me header.i=@johnericson.me header.a=rsa-sha256 header.s=fm3 header.b=UUMVe37P; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=v+WcMx+w X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) by sourceware.org (Postfix) with ESMTPS id 4F19B48F1754 for ; Sun, 7 Dec 2025 05:05:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F19B48F1754 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=JohnEricson.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=JohnEricson.me ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4F19B48F1754 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=202.12.124.147 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765083904; cv=none; b=TPIA/0+YqUl6AXWdE44nhamMSQTI8BZR9dwaMrT5mYwT/N9YKZwWTVTYb/yyQDrsn7VBPY/tjcHVk7ecAwRrO7tCo3hLd2XA/xqhjBIsLKBKVI8XnCHXibXTbHu9Kj3WLQ7sq2J7WHeRN/Y9AeaKVWKKdXEW/f/meuR+two1hHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765083904; c=relaxed/simple; bh=1vz69DMQ3aYnJ0ENunLMWEshOsPmTn+emOxLwSpAgUI=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=YbM2besnqXx9rio5SkZwoSseqm3l9U4ee8pZsaeCKsppheV+FzIUduDAxAWXuJpa38l44FLc2/VkoRGfBinVbpjyUllSBRHcRjP74X3vbo6ZWBXB1qRFlI0+MW/5fmYl5uRhVAq27NB75k8Z2bGifQOXEnTFxZQD1PRqTR36VkU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F19B48F1754 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 82A081D00254; Sun, 7 Dec 2025 00:05:03 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Sun, 07 Dec 2025 00:05:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnericson.me; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1765083903; x= 1765170303; bh=dIVZzjaboHSiOSM6ldLdIbYa7zbs2K7vyT9KYiyhXeQ=; b=U UMVe37PQsHrzTSU5xNpUj27zjowcvBfRDLMlVnxZgxxHhUZFKQoU6GsrVIa7aMeP pQXHHCSqKwh1UmskwwoTyIg7JeU1GnTa05rlO3J9R1m0Zt2tnSBJqWLJrzFjfvAZ U5CP28qpxtH5kg6X7N4cIj2LmOllsZ29V75t9BSANDCMuG+X0cdHfop1dRhXa9GZ hDYhu5HlaQaM+tOYamoP7Ef+204/Jfn7jls2Pa6+Xsuijw4CiQ0eHanIhue09iuC 818GVqQT/ZCyO7Yfrg2/1GaoPKrBlo8pexN0tEwRolJVIpTuVBnfc+W7Kv1elavl KaS4fRIMsWhQvI7toJqcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1765083903; x=1765170303; bh=d IVZzjaboHSiOSM6ldLdIbYa7zbs2K7vyT9KYiyhXeQ=; b=v+WcMx+wrY4cjcaCx 7pZ+w2Ir1QIWrzaqMfhlfEc2PCD32cWldntJemcYVmvW1mznUDgjPhGH/hAFXSx6 s26x1+pYWpuewkbu1Up62b1tlWv5Aexr60i7kXUfPyxWktMJEpLT09iIw8GTIv2+ SRQlkG5HC2mPmrafnXatb0lAq8Gz5n+Rzo+2NE2Dl3/9HcP66zrSDss1kagHPg1l DTp4R4rKvUomQ7zy/5dbIZ+1kYM+Y1tiWqBhYjhf0SL1C6K+owQyvyWm9CNMmESZ lu+cpBK+j3XcQu15FSgNPCMHs3Gefbd9WbaW1+cQuX3ukqeY27USrqaux3EUqqx+ ZYRSA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduvdelfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeflohhhnhcugfhr ihgtshhonhcuoehgihhtseflohhhnhfgrhhitghsohhnrdhmvgeqnecuggftrfgrthhtvg hrnhepffdtgedujeettedtledtfefgveeggffggeevgfekleetiefgheeihfegvdfhtdej necuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepghhitheslfhohhhngfhrihgtshhonhdrmhgvpdhnsggp rhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgtggtqdhprg httghhvghssehgtggtrdhgnhhurdhorhhgpdhrtghpthhtohepphhinhhskhhirgesghhm rghilhdrtghomhdprhgtphhtthhopehjohhsmhihvghrshesrhgvughhrghtrdgtohhmpd hrtghpthhtohepqhhuihgtpggrphhinhhskhhisehquhhitghinhgtrdgtohhmpdhrtghp thhtohepghhithesjhhohhhnvghrihgtshhonhdrmhgv X-ME-Proxy: Feedback-ID: idab146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 7 Dec 2025 00:05:02 -0500 (EST) From: John Ericson To: gcc-patches@gcc.gnu.org Cc: Andrew Pinski , Joseph Myers , Andrew Pinski , John Ericson Subject: [PATCH v4 RESEND 1/2] Move NO_PIE_CFLAGS logic from gcc to libgcc Date: Sun, 7 Dec 2025 00:04:34 -0500 Message-ID: <20251207050435.339616-1-git@JohnEricson.me> X-Mailer: git-send-email 2.50.1 In-Reply-To: <2c7a0d9e-e2e9-4bb7-a89f-cf002dc9cb4f@app.fastmail.com> References: <2c7a0d9e-e2e9-4bb7-a89f-cf002dc9cb4f@app.fastmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_INFOUSMEBIZ, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 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 My goal is to be able to build libgcc cleanly in isolation --- today one needs to figure `make ...` misc things in the gcc subdir. Following Andrew Pinski's suggestions in https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689683.html, this commit moves the NO_PIE_CFLAGS logic. gcc/ChangeLog: * Makefile.in:: Remove NO_PIE_CFLAGS logic, since it is now in libgcc. * configure: Regenerate. * configure.ac: Remove the enable_default_pie substitution, since libgcc now has its own logic. libgcc/ChangeLog: * Makefile.in: Define NO_PIE_CFLAGS make variable via autoconf substitution. * configure: Regenerate. * configure.ac: New configure check to define NO_PIE_CFLAGS using the algorithm Andrew asked for in the linked mail. Suggested-by: Andrew Pinski Signed-off-by: John Ericson --- gcc/Makefile.in | 6 ------ gcc/configure | 6 ++---- gcc/configure.ac | 1 - libgcc/Makefile.in | 2 ++ libgcc/configure | 35 +++++++++++++++++++++++++++++++++++ libgcc/configure.ac | 14 ++++++++++++++ 6 files changed, 53 insertions(+), 11 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2c3194e7d1e..a9264bde9bc 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2504,12 +2504,6 @@ libgcc.mvars: config.status Makefile specs xgcc$(exeext) echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars - if test @enable_default_pie@ = yes; then \ - NO_PIE_CFLAGS="-fno-PIE"; \ - else \ - NO_PIE_CFLAGS=; \ - fi; \ - echo NO_PIE_CFLAGS = "$$NO_PIE_CFLAGS" >> tmp-libgcc.mvars mv tmp-libgcc.mvars libgcc.mvars diff --git a/gcc/configure b/gcc/configure index d7074355e42..f349c1dc4c1 100755 --- a/gcc/configure +++ b/gcc/configure @@ -635,7 +635,6 @@ LIBOBJS CET_HOST_FLAGS LD_PICFLAG PICFLAG -enable_default_pie libgccjit_version enable_host_bind_now LIBGDIAGNOSTICS @@ -21877,7 +21876,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21880 "configure" +#line 21879 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21983,7 +21982,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21986 "configure" +#line 21985 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -34939,7 +34938,6 @@ $as_echo "#define ENABLE_DEFAULT_PIE 1" >>confdefs.h fi - # Check if -fno-PIE works. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-PIE option" >&5 $as_echo_n "checking for -fno-PIE option... " >&6; } diff --git a/gcc/configure.ac b/gcc/configure.ac index b6d9608d599..c652257f29e 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -7765,7 +7765,6 @@ if test x$enable_default_pie = xyes ; then AC_DEFINE(ENABLE_DEFAULT_PIE, 1, [Define if your target supports default PIE and it is enabled.]) fi -AC_SUBST([enable_default_pie]) # Check if -fno-PIE works. AC_CACHE_CHECK([for -fno-PIE option], diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 32a5a15813f..f0cbcb8004b 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -298,6 +298,8 @@ override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS)) INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \ $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@ +NO_PIE_CFLAGS = @NO_PIE_CFLAGS@ + # Options to use when compiling crtbegin/end. CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ $(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \ diff --git a/libgcc/configure b/libgcc/configure index d5e80d227ff..02f489276fc 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -610,6 +610,7 @@ accel_dir_suffix use_tm_clone_registry force_explicit_eh_registry CET_FLAGS +NO_PIE_CFLAGS fixed_point enable_decimal_float decimal_float @@ -4836,6 +4837,40 @@ $as_echo "$libgcc_cv_fixed_point" >&6; } fixed_point=$libgcc_cv_fixed_point +# Check whether the compiler defines __PIE__ by default, so -fno-PIE is needed. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler defines __PIE__" >&5 +$as_echo_n "checking whether the compiler defines __PIE__... " >&6; } +if ${libgcc_cv_no_pie_cflags+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __PIE__ +#error __PIE__ defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libgcc_cv_no_pie_cflags='' +else + libgcc_cv_no_pie_cflags='-fno-PIE' +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_no_pie_cflags" >&5 +$as_echo "$libgcc_cv_no_pie_cflags" >&6; } + +NO_PIE_CFLAGS=$libgcc_cv_no_pie_cflags + + # For platforms with the unwind ABI which includes an unwind library, # libunwind, we can choose to use the system libunwind. # config.gcc also contains tests of with_system_libunwind. diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 65cd3c6aa1a..7cab489b3aa 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -258,6 +258,20 @@ AC_CACHE_CHECK([whether fixed-point is supported], [libgcc_cv_fixed_point], fixed_point=$libgcc_cv_fixed_point AC_SUBST(fixed_point) +# Check whether the compiler defines __PIE__ by default, so -fno-PIE is needed. +AC_CACHE_CHECK([whether the compiler defines __PIE__], [libgcc_cv_no_pie_cflags], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#ifdef __PIE__ +#error __PIE__ defined +#endif + ]], [[]])], + [libgcc_cv_no_pie_cflags=''], + [libgcc_cv_no_pie_cflags='-fno-PIE'])]) + +NO_PIE_CFLAGS=$libgcc_cv_no_pie_cflags +AC_SUBST([NO_PIE_CFLAGS]) + # For platforms with the unwind ABI which includes an unwind library, # libunwind, we can choose to use the system libunwind. # config.gcc also contains tests of with_system_libunwind. From patchwork Sun Dec 7 05:04:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ericson X-Patchwork-Id: 126088 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F1CC8452C4D8 for ; Sun, 7 Dec 2025 05:06:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1CC8452C4D8 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=johnericson.me header.i=@johnericson.me header.a=rsa-sha256 header.s=fm3 header.b=UumtWGlv; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=lMqqeZDV X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) by sourceware.org (Postfix) with ESMTPS id D2FCF48F113B for ; Sun, 7 Dec 2025 05:05:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D2FCF48F113B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=JohnEricson.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=JohnEricson.me ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D2FCF48F113B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=202.12.124.147 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765083905; cv=none; b=GZabT5zdoslVbB1mueNk7SjgEoPRCigbgm6w8NvEgHD4I6VeiFSdwufaPExfalh/YYdVAgevvhz6kLrJiI2VSUhGiCrWZEykicbK5qVDDQLNldWhlwCZVb5/qM1qzqsfPUVAYNd6s+V67JB6Dp2Bzd5f7hLmF9CcRTKv4fkmxoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765083905; c=relaxed/simple; bh=b1PRf4gpF/+14dHtsSg5KUlSAwd/BAVAHWx7B+Jsc/k=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=sPJQzMNPEGE/pciHSqKI85QjwFagPOJABcg6Vb1lFEywpyZrj4uC3uYpH62OSgETZCTpMklRmBxahzUvlfV1/24jpPfBlg2bn4HTz6O+v40Lxu4T/CZTIUBg3vzIa24G5U5C+1ymQ8CWx73rNydNijalKkm5wunIqoGv3gldEqc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2FCF48F113B Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 512DA1D0021A; Sun, 7 Dec 2025 00:05:04 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Sun, 07 Dec 2025 00:05:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnericson.me; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1765083904; x= 1765170304; bh=b1+aQzJAtJMXkgkW9/Lc00ccvJzxo40mX8ae/aNExfs=; b=U umtWGlvJD+uji6qwMq7WVKJZYogf8tO+lT8PdTLT9NB/d0VupOFDab9JkQSTcfOy ea2UIm1om1ePoedb1wDftwBPJSJj5G9/2dtP7YoH86nWdtNA1wPcuIPMfdzpnc2Z HdBBK2tAspm3jzFNAmI1wMfNTzqP8N6WlSS7RqwShWXNDEV5Iob4SAE2f5KkVGTo pw+qHX/IzKq1Jq5DbxG3OZ6Q0Wtwkfh+7oGw30eD1AhIKF/nS712G4Jd3+mgiGli SIxPtfFQ6+5gdivEg+oY2KOoupyD0SiRK8tOmaCAN8aMivDQUs2983LnAsCGo0b+ n/64SsBQdHcRv6pfthCYw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1765083904; x=1765170304; bh=b 1+aQzJAtJMXkgkW9/Lc00ccvJzxo40mX8ae/aNExfs=; b=lMqqeZDVV4zh2lfHf mjIV6qBciNzp1j4uqsfV8RtG/3B7ZV9RgloP3ky2q2C9EwhLmWCLPX6vbO4gW5hK TsPH9iqmMXS/NLcWMnpNjxZda4gEJUymVsMLW2b0fLFiPfAfTabwbD7aFpl2c6oc zkOSGS/S+vv/+W5d+pXap0Zw6URfQnBSpxVybr2wNoR4HdAqrcJTADPWeMcUfDLt TvwNv4KjwiCZGuvXnZ0/SCA2/CQBPawfx8SZrh+xFkZKfsjo68ahj0O0N8ZitkEY gN8/q9LnRsIR82v/KRfG07jXej5zjWlU/Q9YFzgzbuSBT5N8vqJuaVcmwBt2irta z58mQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduvdelfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeflohhhnhcugfhr ihgtshhonhcuoehgihhtseflohhhnhfgrhhitghsohhnrdhmvgeqnecuggftrfgrthhtvg hrnhepffdtgedujeettedtledtfefgveeggffggeevgfekleetiefgheeihfegvdfhtdej necuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepghhitheslfhohhhngfhrihgtshhonhdrmhgvpdhnsggp rhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgtggtqdhprg httghhvghssehgtggtrdhgnhhurdhorhhgpdhrtghpthhtohepphhinhhskhhirgesghhm rghilhdrtghomhdprhgtphhtthhopehjohhsmhihvghrshesrhgvughhrghtrdgtohhmpd hrtghpthhtohepqhhuihgtpggrphhinhhskhhisehquhhitghinhgtrdgtohhmpdhrtghp thhtohepghhithesjhhohhhnvghrihgtshhonhdrmhgv X-ME-Proxy: Feedback-ID: idab146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 7 Dec 2025 00:05:03 -0500 (EST) From: John Ericson To: gcc-patches@gcc.gnu.org Cc: Andrew Pinski , Joseph Myers , Andrew Pinski , John Ericson Subject: [PATCH v4 RESEND 2/2] libgcc: Dont use TARGET_SYSTEM_ROOT from gcc Date: Sun, 7 Dec 2025 00:04:35 -0500 Message-ID: <20251207050435.339616-2-git@JohnEricson.me> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251207050435.339616-1-git@JohnEricson.me> References: <2c7a0d9e-e2e9-4bb7-a89f-cf002dc9cb4f@app.fastmail.com> <20251207050435.339616-1-git@JohnEricson.me> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_INFOUSMEBIZ, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 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 Following Andrew Pinski's suggestions in https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689683.html, just use the output of: $(CC) -print-sysroot It is just used in one spot, in an AIX code-path. I just made (within make) a shell variable to use instead. I don't have AIX on-hand to test this, however. gcc/ChangeLog: * Makefile.in: No longer include TARGET_SYSTEM_ROOT in libgcc.mvars. libgcc/ChangeLog: * config/rs6000/t-slibgcc-aix: Instead of using a TARGET_SYSTEM_ROOT make variable, just define a shell variable as part of the rule and use that. Suggested-by: Andrew Pinski Signed-off-by: John Ericson --- gcc/Makefile.in | 1 - libgcc/config/rs6000/t-slibgcc-aix | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index a9264bde9bc..d62314505c9 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2503,7 +2503,6 @@ libgcc.mvars: config.status Makefile specs xgcc$(exeext) : > tmp-libgcc.mvars echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars - echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars mv tmp-libgcc.mvars libgcc.mvars diff --git a/libgcc/config/rs6000/t-slibgcc-aix b/libgcc/config/rs6000/t-slibgcc-aix index 63336876e2a..4a3d624cfec 100644 --- a/libgcc/config/rs6000/t-slibgcc-aix +++ b/libgcc/config/rs6000/t-slibgcc-aix @@ -40,7 +40,9 @@ SHLIB_LINK = \ -Wl,-bE:@shlib_map_file@ -o shr.o \ @multilib_flags@ @shlib_objs@ -lc \ `case @multilib_dir@ in \ - *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \ + *pthread*) \ + TARGET_SYSTEM_ROOT=\`$(CC) -print-sysroot\`; \ + echo -L$$TARGET_SYSTEM_ROOT/usr/lib/threads -lpthreads -lc_r $$TARGET_SYSTEM_ROOT/usr/lib/libc.a ;; \ *) echo -lc ;; esac` ; \ rm -f tmp-@shlib_base_name@.a ; \ $(AR_CREATE_FOR_TARGET) tmp-@shlib_base_name@.a shr.o ; \ @@ -53,7 +55,9 @@ SHLIB_LINK = \ -Wl,-bE:@shlib_map_file@ -o $$shr.o \ @multilib_flags@ @shlib_objs@ -lc \ `case @multilib_dir@ in \ - *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \ + *pthread*) \ + TARGET_SYSTEM_ROOT=\`$(CC) -print-sysroot\`; \ + echo -L$$TARGET_SYSTEM_ROOT/usr/lib/threads -lpthreads -lc_r $$TARGET_SYSTEM_ROOT/usr/lib/libc.a ;; \ *) echo -lc ;; esac` ; \ $(STRIP_FOR_TARGET) -X32_64 -e $$shr.o ; \ { echo "\#! $(SHLIB_SONAME)($$shr.o)" ; \