From patchwork Sun Jan 14 19:32:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 84064 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 606543858C42 for ; Sun, 14 Jan 2024 19:32:44 +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 ; 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 ) id 1rP6DV-0005b1-0q for gcc-patches@gcc.gnu.org; Sun, 14 Jan 2024 14:32:21 -0500 From: "Roger Sayle" To: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org 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 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