From patchwork Fri Nov 3 03:04:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 161152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp775440vqu; Thu, 2 Nov 2023 20:05:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpY6JKk+ZNJD4rJQSTu+Oc7vIB9LiPLwhVUQwEcqMTwSTfJPyzxztqDjk1he7GMto4p9ik X-Received: by 2002:a05:622a:13ca:b0:403:abf5:6865 with SMTP id p10-20020a05622a13ca00b00403abf56865mr3045745qtk.18.1698980713907; Thu, 02 Nov 2023 20:05:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698980713; cv=pass; d=google.com; s=arc-20160816; b=jyKzWvyAnfaB+I1ZCwP1siK+zd1CA8qJSGrXpSoKjFuU9ZwRmaGbBy1QWqfVuZmrUC UBoMinxW50QnC6aj5KdcDJreBPPM+JiVn4a5VntsBxyPNR3Ku6/yFwl+v1kuLvuxE6Ex VDMxJCOggtgQWBhHnMhjY+3z+iUyP1Ttnhc523GIyaDeBRUXk7Ig0hvqLwL5TbaMYIy7 6RoJl81PjjGLZN/tJsebklK84x1cxMnG4ZBbcTjwn5w38oWLAVFrMEtrVfjUqKJM7Fqb J+qS+gBrbI2ZTyFr5Gd5QkLxzTlBv+cACZDelonjRbS79a0hr0yCG8W3JUaTSONIn5TG OqwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:subject:message-id:date :from:mime-version:dkim-signature:arc-filter:dmarc-filter :delivered-to; bh=nA+h4GCqppN4RSG2Ecf6cGPUM7I1aqe0/ci6GBdEqOs=; fh=odrdm34MKK124q0DIfM2hLcDzKucEMhtQiRvGrPfUng=; b=UEEiqXG/89tNqIqyqZoRLaHnP0hHgVAaPwxeRmm5SLw+XieLwuzrv3tUM+V+MAxSTu SevHiXInxzOI6hhv75bmJEbipb3vmf/VWVUfoJSgWpTQm+ALeej+cWm3n2YdQ9fyGLY4 dMRfU3YPTmWuDHa2wznbGSXFdZZ8NkfAwxpk1VfELMKpiB8QWj7Gfu506LNdY0Pvf0Yd NcpSsRUmNSzoyeRNbAWGePCgxV6IEpN7h0BPbCIPCRFLxsKAtFsMKzJVVYb9xPiFs+iN RugtMJuDPAKGvxllqEj+GyjCbGI2kJho24BZ/vqzGl6h2mT5JyqOWwPhfjCtxzthG30y C7bw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@golang-org.20230601.gappssmtp.com header.s=20230601 header.b=dlk8NbY3; arc=pass (i=1); 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=fail (p=NONE sp=NONE dis=NONE) header.from=golang.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y3-20020a05622a004300b00419818167easi755678qtw.131.2023.11.02.20.05.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 20:05:13 -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=@golang-org.20230601.gappssmtp.com header.s=20230601 header.b=dlk8NbY3; arc=pass (i=1); 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=fail (p=NONE sp=NONE dis=NONE) header.from=golang.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AAF53858412 for ; Fri, 3 Nov 2023 03:05:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by sourceware.org (Postfix) with ESMTPS id C44583858D32 for ; Fri, 3 Nov 2023 03:04:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C44583858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=golang.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=golang.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C44583858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::112e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698980689; cv=none; b=W/P71wpq1BnWdlvpWmnZIQvX8GJxPrfO/VWLjTwxjEuaznsfWK36iOvJCsaOOdcrmR3qoAmDhpUism9pJQJOlCqCbe00XYW4JxiyNdmwqKWu5CgbnPsUzmvigbxY1XbvrriTdkjP35tRwN0rEi1kh/Zma5wS2XRG9PuNmCBZJ4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698980689; c=relaxed/simple; bh=R0ANp+i/dVhgq8oyEOJzyXihMvt2paYW6gWlnINn90I=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=uc6vxTlgDR8GUSVz4kEiyL4d8jNHQCFMtuKQzNCudmF0RUHXDeTMRcLEwjoFHTgC9oo+Mb2Pw52U+stOQBRdKAR6SVl5649mRWIb9jwsLRgnvShGIAC5wiU1PJJvNQfN11nJGw5JsQuKBPaVMJUa2Un6HuenwfAjCMEdTBNq5ak= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-5b3b17d36d5so24090887b3.0 for ; Thu, 02 Nov 2023 20:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20230601.gappssmtp.com; s=20230601; t=1698980678; x=1699585478; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=nA+h4GCqppN4RSG2Ecf6cGPUM7I1aqe0/ci6GBdEqOs=; b=dlk8NbY3sJ8VTVLMv8+0Xa80BF6OE16HPow3IqdiMtYDmH6tC4/6+U0WAR3+W61UbS m6M+SAsIwfBvjysKfhyH9CuCMOYRDvufMZZVqrtdO3bMq506KRI121Fd/gKUFg7Ao39a EuzjbcYHlza6LbQpiQ2VpqEnG3umCk56wFT1nyrMZyGGj9ZgshA5v0aXbCBmTqtEn6GN lcL9CKCPf7Cr70/int95i9mn7WCWcUlBMIDL5LouvILWpdfNN01+H0GQZCdXHuFQqsBJ IIfVjK+/5F9w4HRld56W3UCG3k08kAzoRAbj9MF28ClBaZ3eS2uTdZ/i5q04lzQWx08m sXLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698980678; x=1699585478; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nA+h4GCqppN4RSG2Ecf6cGPUM7I1aqe0/ci6GBdEqOs=; b=ERghuRBfyoEMBHXLyoObuIbWGDkpTW+pJTHdyF6tPP9YgHqALSwPRk0FFQbSbr4zy6 CRtaXGlwGAp1wthqWJjNoig9TlIp3v+a4hPy+Q9tcFrEGXDHStUfT6FRjAI/r6pnko4I KO9ZfZeZF/DM9u1qI2mewaj4lONfI3YnCS9vawyNAsab9RsCV2EERl33RpwCA//nvNzc 5EnsFFsvpV6EBF15jq4w/EihzhKsLrzgxIkxP2VwmKTAqnmzWlgeGpwsOFpEjn14Jdw5 Z7E2NEzvlqlfEH9kmsR/ZJA6nuV/nOw9uiIieB2UzOxLCZQM70KrP4ULcXYSDcHsY2d1 T3zg== X-Gm-Message-State: AOJu0YymD+HYfgm4mg6Xtnfhl7MhhbAL4wxS4Od/S3e2I8KUzsNl2nhx gBVl55erYla7FqpjTjtck6VmGmScqSDrPgYs/BO2kQ== X-Received: by 2002:a0d:d44e:0:b0:5a7:d828:a430 with SMTP id w75-20020a0dd44e000000b005a7d828a430mr1106644ywd.19.1698980678071; Thu, 02 Nov 2023 20:04:38 -0700 (PDT) MIME-Version: 1.0 From: Ian Lance Taylor Date: Thu, 2 Nov 2023 20:04:26 -0700 Message-ID: Subject: libstdc++ patch RFA: Fix dl_iterate_phdr configury for libbacktrace To: Jonathan Wakely Cc: gcc-patches X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781510400647477875 X-GMAIL-MSGID: 1781510400647477875 The libbacktrace sources, as used by libstdc++-v3, fail to correctly determine whether the system supports dl_iterate_phdr. The issue is that the libbacktrace configure assumes that _GNU_SOURCE is defined during compilation, but the libstdc++-v3 configure does not do that. This configury failure is the cause of PR 112263. This patch fixes the problem. OK for mainline? Ian PR libbacktrace/112263 * acinclude.m4: Set -D_GNU_SOURCE in BACKTRACE_CPPFLAGS and when grepping link.h for dl_iterate_phdr. * configure: Regenerate. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index d8f0ba1c3e2..41446c2c3d6 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -5443,7 +5443,7 @@ AC_DEFUN([GLIBCXX_ENABLE_BACKTRACE], [ # Most of this is adapted from libsanitizer/configure.ac - BACKTRACE_CPPFLAGS= + BACKTRACE_CPPFLAGS="-D_GNU_SOURCE" # libbacktrace only needs atomics for int, which we've already tested if test "$glibcxx_cv_atomic_int" = "yes"; then @@ -5471,8 +5471,11 @@ AC_DEFUN([GLIBCXX_ENABLE_BACKTRACE], [ have_dl_iterate_phdr=no else # When built as a GCC target library, we can't do a link test. + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes], [have_dl_iterate_phdr=no]) + CPPFLAGS="$ac_save_CPPFLAGS" fi if test "$have_dl_iterate_phdr" = "yes"; then BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_DL_ITERATE_PHDR=1" diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 9f12c5baa3f..693564d3c7e 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -73299,7 +73299,7 @@ fi # Most of this is adapted from libsanitizer/configure.ac - BACKTRACE_CPPFLAGS= + BACKTRACE_CPPFLAGS="-D_GNU_SOURCE" # libbacktrace only needs atomics for int, which we've already tested if test "$glibcxx_cv_atomic_int" = "yes"; then @@ -73382,6 +73382,8 @@ done have_dl_iterate_phdr=no else # When built as a GCC target library, we can't do a link test. + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -73395,6 +73397,7 @@ else fi rm -f conftest* + CPPFLAGS="$ac_save_CPPFLAGS" fi if test "$have_dl_iterate_phdr" = "yes"; then BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_DL_ITERATE_PHDR=1"