Message ID | 00f401da4720$64e86b90$2eb942b0$@nextmovesoftware.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1341818dyc; Sun, 14 Jan 2024 11:32:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUVFajrVnlSIX746Jo0FizNN0p9fqryywTGRdiML8Qq+OAOz+/lMDzBKx+ox75UrjlIeij X-Received: by 2002:ac8:7f55:0:b0:429:c8f4:e892 with SMTP id g21-20020ac87f55000000b00429c8f4e892mr5624361qtk.34.1705260776869; Sun, 14 Jan 2024 11:32:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705260776; cv=pass; d=google.com; s=arc-20160816; b=AM6L+6hjxjmIzHmIZJErNxjabPuSzQYXljlQ9pZ8AzTLxXKhgDtMYTHeJQUX1v904z HMQpKd/fspJfeZK+r48wZlEB5iVBHG2IukLyXSPfKnWu3kAhN0jzzSAxrA3mT4kcoPRW VGUO0cMEGQV6JdFZF0RCo5yKUcnbk5NmRARbXbe4RZF+XC9h6vbzxFqeosDJ1Qk6+1yE lHRn1OBvu3xqeZIECzoC5/tNkBzk05ETBLOEAHIayAmnm1m/b0pKo6NfKlxu25UIY+99 UjYAtSzi/6w8+IR+aWstIzPZa6DdjBsPpc61leBIv2HL/0P7jcLmNWBVHzQS65+Ymr5B JFfw== 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:content-language:thread-index :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=VRWphkjk/Dq7StVeVaL19mbcU6a5X52hgyzT3tdiuAk=; fh=gk9A5O7Gbglvz1MjrRQ4hZ2i3c68kYkpOZJg1emXh+g=; b=V9fcqJ8mVtBasdlgJP6DPPG88IB8hk0EBsDZ8tazIke6XxzmlPkFTjw1EgHJt8tV6a EoOZWD+vUWcdfbM1tIde4z5BHKje4/qs3XFErzTGsqXvXhSdj80azYx564wXVhBeuLH/ gYWGHUCdHzzabEApSNZn8DB83X0ANUHywQwra16cbULkhr9UWIrDJCiiXBqpgQl+1JWy QTKIaX0FAmRuB5+RTOs41AXwH31NkWbFyMK1J5fOt8okVu2ducdcKKextO1wltCj8GoR wgkzccxrE5qkYibtb8FVZt76tSzGe8/iLmaYQqlm4HIGO51JP5BiTGcCbpzpjBObZBIR Ylbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@nextmovesoftware.com header.s=default header.b=eYMK2EjJ; 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 2-20020ac85942000000b00428125a7bfbsi6526306qtz.788.2024.01.14.11.32.56 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 11:32:56 -0800 (PST) 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=fail header.i=@nextmovesoftware.com header.s=default header.b=eYMK2EjJ; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B9D63858D3C for <ouuuleilei@gmail.com>; Sun, 14 Jan 2024 19:32:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id 3CCC73858D20 for <gcc-patches@gcc.gnu.org>; Sun, 14 Jan 2024 19:32:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3CCC73858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3CCC73858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=162.254.253.69 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705260743; cv=none; b=fMH9qXwOwy39mp8sz8vxdtm/kcy4MEr338Ayzw7ufeZoEucGEEIs0pPot0qr5jq83AXglBZHOQGO9Rj5GnImUGKsBXZMCZr/6TnCn4BmRahDRCsOfIM9y96ZSPjXG5LaJ8sbx9hDWrEAVOnyh6LqYj3PY7omzkPZnllSXrQb32g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705260743; c=relaxed/simple; bh=0O6SEuEsiR1B4vOHClJw91kC2ZIDRQvIbcXJEGNDE1M=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=aXKSnsKx0rM0A5diDQUnYabgALnIGFFNj+TGjcShVZxN+l5S9EpQFxLmZwLTkv82Hmgw0R3LEWR60vIMfD9VsatHrlEkRLdMLr+ZRbFFbJcQc9a6rMpaR2PH8IKIlAygE92aUgkRhjgBMUUKNXuKJ0UTtGiLgW/L/AqU86b2L2U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VRWphkjk/Dq7StVeVaL19mbcU6a5X52hgyzT3tdiuAk=; b=eYMK2EjJOAjS8838ztWqI+B/Ea k5h1zxX0wfs711GicYeOa1FPGUzV+sRIEqKZ/X0f5j+AZ8z+whE4KMGborLQTMvaJuwHR0f4CiHFe sYA9kulaWantwjRrWfYZUGLPw1jwvgbTbcYCuvOrsTo4izGhKHdLdlLiEBPEdRQiZ50UzLAZrRK2E 3vHMDMmtmKQJtPjJvmJjQF4TcJYGRQWZz3mmUeU6IkQP1arYpU7N32dynLXjIdN5Qq8pucl6CkRfR JVcU2skhOU4arcmKK5f9CRfMGGe2kUqqKAradjjaLR8bnTcOP/c+TcA/nU4IrAvX4f6Vk5JutWFfY W8Gz50+w==; Received: from host109-154-238-190.range109-154.btcentralplus.com ([109.154.238.190]:58596 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from <roger@nextmovesoftware.com>) id 1rP6DV-0005b1-0q for gcc-patches@gcc.gnu.org; Sun, 14 Jan 2024 14:32:21 -0500 From: "Roger Sayle" <roger@nextmovesoftware.com> To: <gcc-patches@gcc.gnu.org> Subject: [PATCH/RFC] Add --with-dwarf4 configure option. Date: Sun, 14 Jan 2024 19:32:18 -0000 Message-ID: <00f401da4720$64e86b90$2eb942b0$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00F5_01DA4720.64E86B90" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdpHHzT/biPBUy5QRnKrWgiL/+GczA== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788095524404181383 X-GMAIL-MSGID: 1788095524404181383 |
Series |
[PATCH/RFC] Add --with-dwarf4 configure option.
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Roger Sayle
Jan. 14, 2024, 7:32 p.m. UTC
This patch fixes three of the four unexpected failures that I'm seeing in the gcc testsuite on x86_64-pc-linux-gnu. The three FAILs are: FAIL: gcc.c-torture/execute/fprintf-2.c -O3 -g (test for excess errors) FAIL: gcc.c-torture/execute/printf-2.c -O3 -g (test for excess errors) FAIL: gcc.c-torture/execute/user-printf.c -O3 -g (test for excess errors) and are caused by the linker/toolchain (GNU ld 2.27 on RedHat 7) issuing a link-time warning: /usr/bin/ld: Dwarf Error: found dwarf version '5', this reader only handles version 2, 3 and 4 information. This also explains why these c-torture tests only fail with -g. One solution might be to tweak/improve GCC's testsuite to ignore these warnings. However, ideally it should also be possible to configure gcc not to generate dwarf5 debugging information on systems that don't/can't support it. This patch supplements the current --with-dwarf2 configure option with the addition of a --with-dwarf4 option that adds a tm-dwarf4.h to $tm_file (using the same mechanism as --with-dwarf2) that changes/redefines DWARF_VERSION_DEFAULT to 4 (overriding the current default of 5), This patch has been tested on x86_64-pc-linux-gnu, with a full make bootstrap, both with and without --with-dwarf4. This is fixes the three failures above, and causes no new failures outside of the gcc.dg/guality directory. Unfortunately, the guality testsuite contains a large number of tests that assume support for dwarf5 and don't (yet) check check_effective_target_dwarf5. Hopefully, adding --with-dwarf4 will help improve/test the portability of the guality testsuite. Ok for mainline? An alternative implementation might be to allow integer values for $with_dwarf such that --with-dwarf5, --with-dwarf3 etc. do the right thing. In fact, I'd originally misread the documentation and assumed --with-dwarf4 was already supported. 2024-01-14 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * configure.ac: Add a with --with dwarf4 option. * configure: Regenerate. * config/tm-dwarf4.h: New target file to define DWARF_VERSION_DEFAULT to 4. Thanks in advance, Roger --
Comments
On Sun, Jan 14, 2024 at 8:32 PM Roger Sayle <roger@nextmovesoftware.com> wrote: > > > This patch fixes three of the four unexpected failures that I'm seeing > in the gcc testsuite on x86_64-pc-linux-gnu. The three FAILs are: > FAIL: gcc.c-torture/execute/fprintf-2.c -O3 -g (test for excess errors) > FAIL: gcc.c-torture/execute/printf-2.c -O3 -g (test for excess errors) > FAIL: gcc.c-torture/execute/user-printf.c -O3 -g (test for excess errors) > > and are caused by the linker/toolchain (GNU ld 2.27 on RedHat 7) issuing > a link-time warning: > /usr/bin/ld: Dwarf Error: found dwarf version '5', this reader only handles > version 2, 3 and 4 information. We're patching GCC on old systems to avoid this (and fallout from tools not supporting DWARF5). > This also explains why these c-torture tests only fail with -g. > > One solution might be to tweak/improve GCC's testsuite to ignore > these warnings. However, ideally it should also be possible to > configure gcc not to generate dwarf5 debugging information on > systems that don't/can't support it. This patch supplements the > current --with-dwarf2 configure option with the addition of a > --with-dwarf4 option that adds a tm-dwarf4.h to $tm_file (using > the same mechanism as --with-dwarf2) that changes/redefines > DWARF_VERSION_DEFAULT to 4 (overriding the current default of 5), > > This patch has been tested on x86_64-pc-linux-gnu, with a full > make bootstrap, both with and without --with-dwarf4. This is > fixes the three failures above, and causes no new failures outside > of the gcc.dg/guality directory. Unfortunately, the guality > testsuite contains a large number of tests that assume support > for dwarf5 and don't (yet) check check_effective_target_dwarf5. > Hopefully, adding --with-dwarf4 will help improve/test the > portability of the guality testsuite. > > Ok for mainline? An alternative implementation might be to > allow integer values for $with_dwarf such that --with-dwarf5, > --with-dwarf3 etc. do the right thing. In fact, I'd originally > misread the documentation and assumed --with-dwarf4 was already > supported. The only thing to watch out for is ordering of tm_file since there's ./config/vxworks.h:#undef DWARF_VERSION_DEFAULT ./config/vxworks.h:#define DWARF_VERSION_DEFAULT (TARGET_VXWORKS7 ? 3 : 2) it looks like the --with-dwarf4 adjustment is before the vxworks handling so the vxworks handling will prevail even with --with-dwarf4. Not sure if that's intended? I think this also needs documenting in install.texi (and mention whether target specific defaults will prevail or not) Richard. > > 2024-01-14 Roger Sayle <roger@nextmovesoftware.com> > > gcc/ChangeLog > * configure.ac: Add a with --with dwarf4 option. > * configure: Regenerate. > * config/tm-dwarf4.h: New target file to define > DWARF_VERSION_DEFAULT to 4. > > > Thanks in advance, > Roger > -- >
diff --git a/gcc/configure.ac b/gcc/configure.ac index 596e5f2..2ce9093 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1036,6 +1036,11 @@ AC_ARG_WITH(dwarf2, dwarf2="$with_dwarf2", dwarf2=no) +AC_ARG_WITH(dwarf4, +[AS_HELP_STRING([--with-dwarf4], [force the default debug format to be DWARF 4])], +dwarf4="$with_dwarf4", +dwarf4=no) + AC_ARG_ENABLE(shared, [AS_HELP_STRING([--disable-shared], [don't provide a shared libgcc])], [ @@ -1916,6 +1921,10 @@ if test x"$dwarf2" = xyes then tm_file="$tm_file tm-dwarf2.h" fi +if test x"$dwarf4" = xyes +then tm_file="$tm_file tm-dwarf4.h" +fi + # Say what files are being used for the output code and MD file. echo "Using \`$srcdir/config/$out_file' for machine-specific logic." echo "Using \`$srcdir/config/$md_file' as machine description file." diff --git a/gcc/config/tm-dwarf4.h b/gcc/config/tm-dwarf4.h new file mode 100644 index 0000000..9557b40 --- /dev/null +++ b/gcc/config/tm-dwarf4.h @@ -0,0 +1,3 @@ +/* Make Dwarf4 debugging info the default */ +#undef DWARF_VERSION_DEFAULT +#define DWARF_VERSION_DEFAULT 4