From patchwork Sat Jun 22 21:15:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengdun Wang X-Patchwork-Id: 1951134 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=live.com header.i=@live.com header.a=rsa-sha256 header.s=selector1 header.b=WWmPihQe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W66Vj4JW2z20X6 for ; Sun, 23 Jun 2024 07:17:01 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C34BA385DDDA for ; Sat, 22 Jun 2024 21:16:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn20801.outbound.protection.outlook.com [IPv6:2a01:111:f403:2c15::801]) by sourceware.org (Postfix) with ESMTPS id DEDE73858416 for ; Sat, 22 Jun 2024 21:16:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DEDE73858416 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=live.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=live.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DEDE73858416 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2c15::801 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1719091002; cv=pass; b=fss7jPBUbk1b++sITpycqb6UuoVth6ipSp3ScuKwe64ogjHgy8lnfKUK8nT9Bv0ldsXuPnzUDKlgefE/+N2W6Aciv3ZZGdtub9SCGS89VlN2iMU6CsqUR4qB3+8tLEO2twxmFubMF9l+OH9d1e2M2JouPnJ8aYI75THjTYwaTAE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1719091002; c=relaxed/simple; bh=/qBO5l8vUfOdB7WHMyYMjEiurhUKHs+zoj8uncYzj/w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=unu0euWu1PM6dYBYtABEBWuNglA8L3l4Qgeq2F1YBJNQl0hdjDw1QhonkAsteuGmH/C1aN1PfAJBboDN7ZlpEQi5oRpqpvx6kTKmb7O0jWgbQ5kUrcvs6w6810t/VufdbxHudPaGPXcUCt1PdvOUFF8mzu+RhSAMPmxmPktZSKo= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Za50uhiNAuAavFsR/mK90lMFIQPgz64XJHsNk9MMq6km3alGfhB9ZM8wExtB5x0r/FOXxwIYXYnSLT10LxDZ0nGf74cbRLQIHM8j8A9KR/zvUmZ7vegoNem9rGBqrJeTmuXRoYhW/0Ky6nmEY7xU7WEqLBzcvvaDc+Z6tfglq3JEddTEFZyrPjoVkUvcHgUDSvYLC8p3CDO3MaJfuWZuPOWk4cKeF6WNCynOfxN7Yei5bLa5ZvWCGsd+cQ6nKyPCduJEesKthH/7qdHm+mSMRAl9dXdddde1iAtIi8YFBjvs618qtUHU6ABkOlVQigPKdWGQ7ahgw7Lh/A8D7XLugg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k+04cNj1rreeOds4RoD6jRBFMPDAuv+PIrF+zEi/POU=; b=NvgvmxyJxzpJLv+B73CcOk1NOcZfAkNCSISOA2oIFoldORrfIVd2evaSr4O2Y0fQ7HxE20xAi5y1l4Nn70N9ekxXBanKV7HoQQkv1Yyonlhi0tfpfbA7WrMK/DN9O1SY4FmvErakNjx/5H3vUpPPZwa1/lyA2Sx2d5wq8LLPru53M8Lg5wrhZO01iQkAeW0uCBA8ZWkBFxB0+jbqhFGjf0fjtInAOM9hOfWg6cHaX/pwg6jdd73fthYULP+S/mRMS8M1Klyq6on1Cqe7l0arQrmFFSv767jYbv0VDji/WffZPqxXxc2Cxm1govmOZrSclN7SW4X8qf7cD3Ym7N5Flg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k+04cNj1rreeOds4RoD6jRBFMPDAuv+PIrF+zEi/POU=; b=WWmPihQeX3wlq0eRK70ML6pFMfnbcpVXS8hzTFxdTzyAWkk1W5aNEHcX48hRscfBJYszVtrAcfyL/vSEzDDEPIhktYWuBpOZuvwDoTdm8r6x+MF+IG6Hf5xT7zUez0RSc2X/RxhQ8YepGY+JOxZocf/cTmpGkpK5Ew4yLHvYCUuHTNUSsqpH0mEwYYJkUAHmfqNp1QMAK863E27NsyMqYy0CNofEVEROdGhDMbiZmWZmNY0rYxa4yiQdh03j2LZSlWwZVo7JUU0p+6ZVoYRwIedVRnn27PxSPqZfhawdY6B52xbzfk1ZTV9yT25lLM4TsmaCyROZTvWHFIN+0ILXYA== Received: from SA1PR11MB7130.namprd11.prod.outlook.com (2603:10b6:806:29f::10) by PH0PR11MB7588.namprd11.prod.outlook.com (2603:10b6:510:28b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.26; Sat, 22 Jun 2024 21:16:36 +0000 Received: from SA1PR11MB7130.namprd11.prod.outlook.com ([fe80::928e:8882:8562:2dd5]) by SA1PR11MB7130.namprd11.prod.outlook.com ([fe80::928e:8882:8562:2dd5%5]) with mapi id 15.20.7698.025; Sat, 22 Jun 2024 21:16:36 +0000 From: Shengdun Wang To: gcc-patches@gcc.gnu.org Cc: Shengdun Wang Subject: [PATCH] Always -lntdll for all cygming targets [PR113501] Date: Sat, 22 Jun 2024 17:15:48 -0400 Message-ID: X-Mailer: git-send-email 2.45.2 X-TMN: [XFcx1Mn6dC1b2XP5bu9kDScqncQZFqpPRYzYFRSbB7U=] X-ClientProxiedBy: MN2PR22CA0012.namprd22.prod.outlook.com (2603:10b6:208:238::17) To SA1PR11MB7130.namprd11.prod.outlook.com (2603:10b6:806:29f::10) X-Microsoft-Original-Message-ID: <20240622211548.589265-1-euloanty@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR11MB7130:EE_|PH0PR11MB7588:EE_ X-MS-Office365-Filtering-Correlation-Id: e2cf6634-4698-4bbc-4472-08dc9300990b X-Microsoft-Antispam: BCL:0;ARA:14566002|461199025|440099025|3412199022; X-Microsoft-Antispam-Message-Info: hj/whdp5WqwnP12J9Xwx2h9Dep1gxwCRn76wiOMNcp/LGigZb2PFDAPguctfsyJHZv4iAn5iNwuRFnK/BugvkB+2i7XjRkZ12R2TnCqPyWWtezkl6SbcxxlxzQzD6+Fw5eXrnQq5jJHl/FHM9uuU/0FxL9iEKMlICo0wc3qOPEA32fP60D40yiIjPQMCl/444l+0ufwMKGoNDE5mSx4v5B2JV48NKNjgKuV/I1+2660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qr+7TCKkTbz9aS/XMlkJJKP/MWnTAEs1QN3zV2gqHcGMQeZRB3oFgT615WXF+NEW48WJIrwieyaE9Nv9HyxnUja+XB+Rg7ml69r1rqlF+VyIPQuJEpYy2DNf6DGykshl0cuQqAYthGEQePZiEPC4/aeg9D6rxf8usmfORGEWUD5L8t3ofvrdBDrb5525sca83Npn50b9H+geaoskjzodCXb/TZ2TXFwi9TmgFYMnzolqyYRCip52NNsJcHy3UT9zH9Oxv98z7aRZrQ+SmwGvG37VSnI4LVw22phUqg722IPVod9xPWXOn+dmeGujBVkSzg9/UWpWnRFNBmk2ZeMa1uEwtkQmcI65J7Rr92XsOQ6VuqCPe1g83zLtCSXWDbBvGyTG3A4TBKvcRInXGLU1RNLwDqfEQjQNQ1WJrcGcLZmPp9eAnNVnophkq3BSwYMkHB+n1REkFSTeqzX1rJlxTOjRCGhPe0//932cr++iJhwlkZlt/8TJk7EX7iu724vtl1SO8rwouwPl+KbCiLURWq0oAiRIHWTrXVj2hpy6QwgwlFcHt99/m2a3R29O5TEAuTys= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-e8f36.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: e2cf6634-4698-4bbc-4472-08dc9300990b X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB7130.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2024 21:16:35.8221 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB7588 X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Shengdun Wang The mcf thread has already linked to -lntdll, and it's confirmed that even Windows 95 includes ntdll.dll. Additionally, if users do not use any functions from ntdll directly, the inclusion of -lntdll does not result in linking to it. Therefore, I propose making it a default toggle to simplify compilation for Windows. On windows 95, if we do -lntdll, it won't still run. I have tried and confirmed it. gcc/ChangeLog: * config/i386/cygwin.h: * config/i386/mingw-w64.h: * config/mingw/mingw32.h: libgcc/ChangeLog: * config/i386/t-cygwin: * config/i386/t-mingw32: --- gcc/config/i386/cygwin.h | 2 +- gcc/config/i386/mingw-w64.h | 2 +- gcc/config/mingw/mingw32.h | 4 ++-- libgcc/config/i386/t-cygwin | 2 +- libgcc/config/i386/t-mingw32 | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 63de10c17d4..8655c9cff43 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -89,7 +89,7 @@ along with GCC; see the file COPYING3. If not see %{mwindows:-lgdi32 -lcomdlg32} \ %{fvtable-verify=preinit:-lvtv -lpsapi; \ fvtable-verify=std:-lvtv -lpsapi} \ - -ladvapi32 -lshell32 -luser32 -lkernel32" + -ladvapi32 -lshell32 -luser32 -lkernel32 -lntdll" /* To implement C++ function replacement we always wrap the cxx malloc-like operators. See N2800 #17.6.4.6 [replacement.functions] */ diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h index dde26413e22..b3d0c94ca5f 100644 --- a/gcc/config/i386/mingw-w64.h +++ b/gcc/config/i386/mingw-w64.h @@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see "%{mwindows:-lgdi32 -lcomdlg32} " \ "%{fvtable-verify=preinit:-lvtv -lpsapi; \ fvtable-verify=std:-lvtv -lpsapi} " \ - "-ladvapi32 -lshell32 -luser32 -lkernel32" + "-ladvapi32 -lshell32 -luser32 -lkernel32 -lntdll" #undef SPEC_32 #undef SPEC_64 diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h index fa6e307476c..95353394328 100644 --- a/gcc/config/mingw/mingw32.h +++ b/gcc/config/mingw/mingw32.h @@ -117,7 +117,7 @@ along with GCC; see the file COPYING3. If not see "%{mwindows:-lgdi32 -lcomdlg32} " \ "%{fvtable-verify=preinit:-lvtv -lpsapi; \ fvtable-verify=std:-lvtv -lpsapi} " \ - "-ladvapi32 -lshell32 -luser32 -lkernel32" + "-ladvapi32 -lshell32 -luser32 -lkernel32 -lntdll" /* Weak symbols do not get resolved if using a Windows dll import lib. Make the unwind registration references strong undefs. */ @@ -204,7 +204,7 @@ along with GCC; see the file COPYING3. If not see " SHARED_LIBGCC_SPEC " \ %{mcrtdll=crtdll*:-lcoldname} %{!mcrtdll=crtdll*:-lmoldname} \ -lmingwex %{!mcrtdll=*:-lmsvcrt} %{mcrtdll=*:-l%*} \ - -lkernel32 " MCFGTHREAD_SPEC + -lkernel32 -lntdll " MCFGTHREAD_SPEC #undef STARTFILE_SPEC #define STARTFILE_SPEC " \ diff --git a/libgcc/config/i386/t-cygwin b/libgcc/config/i386/t-cygwin index f85ec24220e..4118534e5f6 100644 --- a/libgcc/config/i386/t-cygwin +++ b/libgcc/config/i386/t-cygwin @@ -5,7 +5,7 @@ LIBGCC2_INCLUDES += -I$(srcdir)/../winsup/include \ -I$(srcdir)/../winsup/cygwin/include # Cygwin-specific parts of LIB_SPEC -SHLIB_LC = -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32 +SHLIB_LC = -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32 -lntdll # We have already included one of the t-{dw2,sjlj}-eh fragments for EH_MODEL SHLIB_EH_EXTENSION = $(subst -dw2,,-$(EH_MODEL)) diff --git a/libgcc/config/i386/t-mingw32 b/libgcc/config/i386/t-mingw32 index bfdef6723ce..aee08b541cf 100644 --- a/libgcc/config/i386/t-mingw32 +++ b/libgcc/config/i386/t-mingw32 @@ -1,2 +1,2 @@ # MinGW-specific parts of LIB_SPEC -SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 +SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lntdll