From patchwork Fri May 24 21:57:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1939110 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=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=XsazyHCY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4VmJnY0fz5z20PT for ; Sat, 25 May 2024 07:58:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A20693858403 for ; Fri, 24 May 2024 21:58:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 761FE3858D29 for ; Fri, 24 May 2024 21:57:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 761FE3858D29 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 761FE3858D29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1030 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716587871; cv=none; b=M133cNoj0VmRwxas4nNfWGrBzbWUz/I0Lv951rGLjIDCcWvwQD2hqB74WV1JamiBf+bcm5FfKbBahRytGkbhqqu6yB9CDejI2+kbDlJ1JQ07WPAN+U0mFz1FqAoyenPirsLyNeDBaL+Yz1VuJHsHcF3hb4aBHaBUsELFBM0QK/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716587871; c=relaxed/simple; bh=Dn1jDdXgtJA5yO9+PzZjv3vSTM6QdaJi/+d7trMyVeo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=txfn/tdovE2RmC/aWCUKDbWiLJGZ/Sza2UsPeCZdnq2ySrUza2532rrYHZfNBoTWGeymbVyg/KDBSMGVht1LpfVKccaL2lP4kfimis+OHtMybhWludDiFyliONgyC1Tb7UVl/IkYwwg2Q1OcHPrG58Bvew9HcBUpeJlQTC+dUX4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2bd816ecaf5so3183328a91.2 for ; Fri, 24 May 2024 14:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716587868; x=1717192668; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pdSaA6Uv0yrsnBQr7F8ynfzwwpY2kKBEGIxz86yJzh0=; b=XsazyHCYPerhIFaGE/vEKH6fEkhsvGMvKAl6ZDdQOvPQ7x4YJh+yHFcmSBR0gN45Ij pTffVmGLmu+2clV8zqt2EcAtfpymgJVv7bsCGPmzlW9S1FhiCGnLJaw8HVGZW5qaqHkv kxr66wiH31VcF9kKcG+RwajXLSnzXkfMt6YJb4FK4QunuCBVccf0YPn4BT72A1RMxUV0 +H+1qZH3wa2o01kOESpzEHVZdf2CVKIFIgbS+9K01co6hJOH6I4N2HUn5YPzZtRXGVYt D85RjdFxZQyhpNeot7zo8aZc0bkipAEtoo2uBywgrGOIaV1Xs6x8zvaZfWINFMnfXn60 rJSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716587868; x=1717192668; 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=pdSaA6Uv0yrsnBQr7F8ynfzwwpY2kKBEGIxz86yJzh0=; b=g6d0nZvgWE5iSnGwV39ZUdpj5EkME52JE1yeLpL/jLEJUJLJcMuHU2xHeR5yHrbNlW CCmeD5MZDi4oXFhQbGuQL9o7N7dva033Atv/8XhV7JCjsqAOjBN8YwdPj7QYhRM/flng 9mnMiJSz3ReczNuPrqGQuYpEJ/tcAzGvUfMnF821lQ7ydHVKwFwKpl3bn6xyBKzxhn2C SM6zzUeq5MHlZt/FBi2JZfqwt6y/QSH1SrOyBJL1syK6g5H98cThlCkwmNpj1+aSmjzv JOvUUR2eBZMzyKlYzS37w+o3oaZuguSd8LDgxPzyUaWyvlsNBz3Ucz9orQZW7zhgW+Va qb6w== X-Gm-Message-State: AOJu0YxALF7o2WwGPeb4sy76oL0Ej5tNH15VqtfTkB0+n88GI+JerFTW 7gZIJo4osBXSrGHlByNoUUN4DLOoVyp9JwSljYKe21RJVYQEfSXA X-Google-Smtp-Source: AGHT+IH97C+beHb64vhT7YOQLVot+OONh2UWMynbjqOc9XyjoaqdhSCP6QVAm23/QO2Krdo7LpFhBg== X-Received: by 2002:a17:90b:3006:b0:2bd:6a8f:4140 with SMTP id 98e67ed59e1d1-2bf5e18b462mr3532923a91.20.1716587868195; Fri, 24 May 2024 14:57:48 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.59.129.178]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2bdd9ef09f9sm3718763a91.23.2024.05.24.14.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 14:57:47 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 501D77405A7; Fri, 24 May 2024 14:57:46 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: fweimer@redhat.com Subject: [PATCH] Add --enable-static-c++-link-check option [BZ #31412] Date: Fri, 24 May 2024 14:57:46 -0700 Message-ID: <20240524215746.1212197-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3021.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org The current minimum GCC version of glibc build is GCC 6.2 or newer. When building i686 glibc on Fedora 40, GCC 6.4 failed the static C++ link test since the 32-bit libc.a was built with GCC 14 and has references to __divmoddi4 which was added to GCC 7. Add --enable-static-c++-link-check configure option which is on by default. --disable-static-c++-link-check can be used to disable the static C++ link test. The newly built i686 libc.a can be used by GCC 6.4 to create static C++ tests. This fixes BZ #31412. Signed-off-by: H.J. Lu --- configure | 24 +++++++++++++++++++----- configure.ac | 22 +++++++++++++++------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 432e40a592..58e82d792d 100755 --- a/configure +++ b/configure @@ -778,6 +778,7 @@ ac_user_opts=' enable_option_checking with_pkgversion with_bugurl +enable_static_c___link_check with_gd with_gd_include with_gd_lib @@ -1447,6 +1448,8 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-static-c++-link-check + enable static C++ link check [default=yes] --disable-sanity-checks really do not use threads (should not be used except in special situations) [default=yes] --enable-shared build shared library [default=yes if GNU ld] @@ -3810,6 +3813,15 @@ if test -z "$CPP"; then fi +# Check whether --enable-static-c++-link-check was given. +if test ${enable_static_c___link_check+y} +then : + enableval=$enable_static_c___link_check; static_cxx_link_check=$enableval +else $as_nop + static_cxx_link_check=yes +fi + + # We need the C++ compiler only for testing. @@ -4220,10 +4232,11 @@ else $as_nop fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -# Static case. -old_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS -static" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if test $static_cxx_link_check = yes; then + # Static case. + old_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -static" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -4244,7 +4257,8 @@ else $as_nop fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LDFLAGS="$old_LDFLAGS" + LDFLAGS="$old_LDFLAGS" +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/configure.ac b/configure.ac index bdc385d03c..12de4c3d15 100644 --- a/configure.ac +++ b/configure.ac @@ -52,6 +52,12 @@ fi AC_SUBST(cross_compiling) AC_PROG_CPP +AC_ARG_ENABLE([static-c++-link-check], + AS_HELP_STRING([--enable-static-c++-link-check], + [enable static C++ link check @<:@default=yes@:>@]), + [static_cxx_link_check=$enableval], + [static_cxx_link_check=yes]) + # We need the C++ compiler only for testing. AC_PROG_CXX # It's useless to us if it can't link programs (e.g. missing -lstdc++). @@ -61,10 +67,11 @@ AC_LANG_PUSH([C++]) AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [libc_cv_cxx_link_ok=yes], [libc_cv_cxx_link_ok=no]) -# Static case. -old_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS -static" -AC_LINK_IFELSE([AC_LANG_SOURCE([ +if test $static_cxx_link_check = yes; then + # Static case. + old_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -static" + AC_LINK_IFELSE([AC_LANG_SOURCE([ #include int @@ -74,9 +81,10 @@ main() return 0; } ])], - [], - [libc_cv_cxx_link_ok=no]) -LDFLAGS="$old_LDFLAGS" + [], + [libc_cv_cxx_link_ok=no]) + LDFLAGS="$old_LDFLAGS" +fi AC_LANG_POP([C++])]) AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])