From patchwork Sat Jun 29 22:06:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 1954283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=harmstone.com header.i=@harmstone.com header.a=rsa-sha256 header.s=mail header.b=69LKbors; 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 4WBRHp0pSSz20Xf for ; Sun, 30 Jun 2024 08:07:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B33C381159A for ; Sat, 29 Jun 2024 22:07:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.burntcomma.com (mail.burntcomma.com [IPv6:2a02:8012:8cf0:250::6d61:696c]) by sourceware.org (Postfix) with ESMTPS id 6FD19389EC96 for ; Sat, 29 Jun 2024 22:07:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6FD19389EC96 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=harmstone.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6FD19389EC96 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a02:8012:8cf0:250::6d61:696c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698824; cv=none; b=jpaRiG3Beog8ARTN+/Dmy6munshGk5CRmBX64Mj8kpWvHNrOB0u5UasOOhWF3tHeS7Z1WpEOhqeSfyj+nhAQPnc4Ktq9md2d6qcYK6MvfvI2Fac6HQ519+bAllr+j4w1G8wqx/ooakVfS6Fh4oafkq4pclRZJIxfYE23kBxS7Qo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698824; c=relaxed/simple; bh=CnKjnDl8ej5RzFULOPQ3gijlAMazKKqIP8PE7UIpkI0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=kI3+GPs6Sc0FuwU3j50zSn/mm2k9pbHuBY9jyjfH8R0eY1EBxo4WCT+WXXH1VOp89bS+NRgsA4ygJ/GRMAe1CM9FnBDk4bW256u7gjIp0jmvGhLA6c+fCDU7MsI26nwazD3bHo2w1/e6gvVad7OA5Xlc1g0K3fpWPzrULy+dTuU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (beren.burntcomma.com [IPv6:2a02:8012:8cf0:0:b62e:99ff:fee9:ad9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.burntcomma.com (Postfix) with ESMTPSA id C4A863DA80E8; Sat, 29 Jun 2024 23:07:00 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmstone.com; s=mail; t=1719698820; bh=ImdWx99uGnrl0m2M8YocYmf+vYOgH+JJHyozvLcouLw=; h=From:To:Cc:Subject:Date; b=69LKborsUfkuZQqoTrpf9rjl0sKbLco0+jvj1335Wywry65JlNIVxZJu/oadsnEuS 6L7Iabh5cg9jnkWiqyMvJ0yiw6FlNtlBJmAWcuRx4ms0ol3jOGn8DWRVJQ2T00otrH AqM2ZmBH4B6a4R6WdwxBdWXr4s/4HIpAde18bRZw= From: Mark Harmstone To: gcc-patches@gcc.gnu.org Cc: Mark Harmstone Subject: [PATCH 1/5] Add CodeView enum cv_leaf_type Date: Sat, 29 Jun 2024 23:06:49 +0100 Message-ID: <20240629220653.4445-1-mark@harmstone.com> Mime-Version: 1.0 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 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 Make everything more gdb-friendly by using an enum for type constants rather than #defines. gcc/ * dwarf2codeview.cc (enum cv_leaf_type): Define. (struct codeview_subtype): Use enum cv_leaf_type. (struct codeview_custom_type): Use enum cv_leaf_type. (write_lf_fieldlist): Add default to switch. (write_custom_types): Add default to switch. * dwarf2codeview.h (LF_MODIFIER, LF_POINTER): Undefine. (LF_PROCEDURE, LF_ARGLIST, LF_FIELDLIST, LF_BITFIELD): Likewise. (LF_INDEX, LF_ENUMERATE, LF_ARRAY, LF_CLASS): Likewise. (LF_STRUCTURE, LF_UNION, LF_ENUM, LF_MEMBER, LF_CHAR): Likewise. (LF_SHORT, LF_USHORT, LF_LONG, LF_ULONG, LF_QUADWORD): Likewise. (LF_UQUADWORD): Likewise. --- gcc/dwarf2codeview.cc | 37 +++++++++++++++++++++++++++++++++++-- gcc/dwarf2codeview.h | 23 ----------------------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc index e8ed3713480..5155aa70139 100644 --- a/gcc/dwarf2codeview.cc +++ b/gcc/dwarf2codeview.cc @@ -70,6 +70,33 @@ along with GCC; see the file COPYING3. If not see #define HASH_SIZE 16 +/* This is enum LEAF_ENUM_e in Microsoft's cvinfo.h. */ + +enum cv_leaf_type { + LF_MODIFIER = 0x1001, + LF_POINTER = 0x1002, + LF_PROCEDURE = 0x1008, + LF_ARGLIST = 0x1201, + LF_FIELDLIST = 0x1203, + LF_BITFIELD = 0x1205, + LF_INDEX = 0x1404, + LF_ENUMERATE = 0x1502, + LF_ARRAY = 0x1503, + LF_CLASS = 0x1504, + LF_STRUCTURE = 0x1505, + LF_UNION = 0x1506, + LF_ENUM = 0x1507, + LF_MEMBER = 0x150d, + LF_FUNC_ID = 0x1601, + LF_CHAR = 0x8000, + LF_SHORT = 0x8001, + LF_USHORT = 0x8002, + LF_LONG = 0x8003, + LF_ULONG = 0x8004, + LF_QUADWORD = 0x8009, + LF_UQUADWORD = 0x800a +}; + struct codeview_string { codeview_string *next; @@ -185,7 +212,7 @@ struct codeview_integer struct codeview_subtype { struct codeview_subtype *next; - uint16_t kind; + enum cv_leaf_type kind; union { @@ -212,7 +239,7 @@ struct codeview_custom_type { struct codeview_custom_type *next; uint32_t num; - uint16_t kind; + enum cv_leaf_type kind; union { @@ -1336,6 +1363,9 @@ write_lf_fieldlist (codeview_custom_type *t) putc ('\n', asm_out_file); break; + + default: + break; } t->lf_fieldlist.subtypes = next; @@ -1790,6 +1820,9 @@ write_custom_types (void) case LF_ARGLIST: write_lf_arglist (custom_types); break; + + default: + break; } free (custom_types); diff --git a/gcc/dwarf2codeview.h b/gcc/dwarf2codeview.h index e6ad517bf28..8fd3632e524 100644 --- a/gcc/dwarf2codeview.h +++ b/gcc/dwarf2codeview.h @@ -60,29 +60,6 @@ along with GCC; see the file COPYING3. If not see #define MOD_const 0x1 #define MOD_volatile 0x2 -/* Constants for type definitions. */ -#define LF_MODIFIER 0x1001 -#define LF_POINTER 0x1002 -#define LF_PROCEDURE 0x1008 -#define LF_ARGLIST 0x1201 -#define LF_FIELDLIST 0x1203 -#define LF_BITFIELD 0x1205 -#define LF_INDEX 0x1404 -#define LF_ENUMERATE 0x1502 -#define LF_ARRAY 0x1503 -#define LF_CLASS 0x1504 -#define LF_STRUCTURE 0x1505 -#define LF_UNION 0x1506 -#define LF_ENUM 0x1507 -#define LF_MEMBER 0x150d -#define LF_CHAR 0x8000 -#define LF_SHORT 0x8001 -#define LF_USHORT 0x8002 -#define LF_LONG 0x8003 -#define LF_ULONG 0x8004 -#define LF_QUADWORD 0x8009 -#define LF_UQUADWORD 0x800a - #define CV_ACCESS_PRIVATE 1 #define CV_ACCESS_PROTECTED 2 #define CV_ACCESS_PUBLIC 3 From patchwork Sat Jun 29 22:06:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 1954282 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=harmstone.com header.i=@harmstone.com header.a=rsa-sha256 header.s=mail header.b=xVY8dKnv; 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 4WBRHp2mWtz20ZV for ; Sun, 30 Jun 2024 08:07:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B45F38114CE for ; Sat, 29 Jun 2024 22:07:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.burntcomma.com (mail.burntcomma.com [IPv6:2a02:8012:8cf0:250::6d61:696c]) by sourceware.org (Postfix) with ESMTPS id ED2DC389EC99 for ; Sat, 29 Jun 2024 22:07:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED2DC389EC99 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=harmstone.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ED2DC389EC99 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a02:8012:8cf0:250::6d61:696c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698824; cv=none; b=YxrR8Uq3pZfCB7v+6xLRCcdTnnMOTlp/E2C2ebIfLb7D0gx8bGV+PuMXOlg0IOCke/RR4c/sW9AQSx8jID0ymtpC2LHXQ2bcBG9aheRlcg3FHYFZjbhbbbvREuE4ZRzFwvp0VCnw7bA7eGkRdbnKjwntskzXhcmg5iIMjqTy54I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698824; c=relaxed/simple; bh=g6Yv585tdeRegoC+HkjNdhyqWD6HW/lyq8C4G5KAkhg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=Qw5rip62lb5Y0+T2fVm0hGGxRz8GuA/P0w0vH6TsfVNZm3c0YdyHLwqRZmmSjVYCcDQ8uuB20DirRXARwokXVp6ke/zQw5l7zu2OJMgKy7vrL4TCUI/4j7HuaXI6247YyCOhVKaTbCZICT/p4CuIAq8K5AZOx1kfq/Cpm0AkuzQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (beren.burntcomma.com [IPv6:2a02:8012:8cf0:0:b62e:99ff:fee9:ad9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.burntcomma.com (Postfix) with ESMTPSA id 1D0C83DA80EC; Sat, 29 Jun 2024 23:07:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmstone.com; s=mail; t=1719698822; bh=V/6a7tUS5DY4Ya4HB7vE8ymz2Pox64IcD/EXO07931g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xVY8dKnv/0Ap7u5Ajl0QL8Kh+laUikTJfi9UpmbqVREh+6cj+5SPfC2xX8m+ytBSc cYzLi1dIDRsfDhe8v/dLNr7CoMNzMSrPVvYAaR0DT9C/5cWMpP7pNjvhjU9MCOOu4W khMISM5bbc0waPtTHJKa0BlP2K1UchWMXc2VzcF8= From: Mark Harmstone To: gcc-patches@gcc.gnu.org Cc: Mark Harmstone Subject: [PATCH 2/5] Add CodeView enum cv_sym_type Date: Sat, 29 Jun 2024 23:06:50 +0100 Message-ID: <20240629220653.4445-2-mark@harmstone.com> In-Reply-To: <20240629220653.4445-1-mark@harmstone.com> References: <20240629220653.4445-1-mark@harmstone.com> Mime-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, 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: 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 Make everything more gdb-friendly by using an enum for symbol constants rather than #defines. gcc/ * dwarf2codeview.cc (S_LDATA32, S_GDATA32, S_COMPILE3): Undefine. (enum cv_sym_type): Define. (struct codeview_symbol): Use enum cv_sym_type. (write_codeview_symbols): Add default to switch. --- gcc/dwarf2codeview.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc index 5155aa70139..921d5f41e5a 100644 --- a/gcc/dwarf2codeview.cc +++ b/gcc/dwarf2codeview.cc @@ -46,10 +46,6 @@ along with GCC; see the file COPYING3. If not see #define CHKSUM_TYPE_MD5 1 -#define S_LDATA32 0x110c -#define S_GDATA32 0x110d -#define S_COMPILE3 0x113c - #define CV_CFL_80386 0x03 #define CV_CFL_X64 0xD0 @@ -70,6 +66,14 @@ along with GCC; see the file COPYING3. If not see #define HASH_SIZE 16 +/* This is enum SYM_ENUM_e in Microsoft's cvinfo.h. */ + +enum cv_sym_type { + S_LDATA32 = 0x110c, + S_GDATA32 = 0x110d, + S_COMPILE3 = 0x113c +}; + /* This is enum LEAF_ENUM_e in Microsoft's cvinfo.h. */ enum cv_leaf_type { @@ -168,7 +172,7 @@ struct codeview_function struct codeview_symbol { codeview_symbol *next; - uint16_t kind; + enum cv_sym_type kind; union { @@ -983,6 +987,8 @@ write_codeview_symbols (void) case S_GDATA32: write_data_symbol (sym); break; + default: + break; } free (sym); From patchwork Sat Jun 29 22:06:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 1954284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=harmstone.com header.i=@harmstone.com header.a=rsa-sha256 header.s=mail header.b=MsgwJeHk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [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 4WBRHq6Xt8z20bN for ; Sun, 30 Jun 2024 08:07:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 84AFB389F4FF for ; Sat, 29 Jun 2024 22:07:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.burntcomma.com (mail.burntcomma.com [IPv6:2a02:8012:8cf0:250::6d61:696c]) by sourceware.org (Postfix) with ESMTPS id B1D8A389EC9A for ; Sat, 29 Jun 2024 22:07:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B1D8A389EC9A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=harmstone.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B1D8A389EC9A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a02:8012:8cf0:250::6d61:696c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698825; cv=none; b=v+gyPv38V9O/BOZ4PdNBGHf4SibXui3yG2UxuKRgA95slN1FWY2dhNOM0yqecGMbDVvZy9aDFDGYvzPR3oHSzIencgKRUpfDrdSJOyASGuJWaVe+wKCoGe4Mhbi1gJiwR2jhEG5Y0nfcEXGOthwdAHMu4KlzR6AEpSsxwR6iTtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698825; c=relaxed/simple; bh=tf1TbdvoBAFBzwdurbQBb7pjrONKMuPdI9wdQQxcZ3c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=b2MP8eS73OnnZrGfFB29W2b/M4o4zJ2MZkuUT4Dh5ZfrzbmRfpUsE7SEcPDkR62O/fP7Q72jTSQb61WIzlYCvEK+g4WTmdNNDZsJJ/NtNtOmw0r6kZ/kNzvpf/6+XB9RaJKAT1Wqm155GPOsXKeSQ5br974tzozj3MwxC0ddHaI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (beren.burntcomma.com [IPv6:2a02:8012:8cf0:0:b62e:99ff:fee9:ad9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.burntcomma.com (Postfix) with ESMTPSA id D3D543DA80EF; Sat, 29 Jun 2024 23:07:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmstone.com; s=mail; t=1719698822; bh=dSKEMsHeho0LJv6ze3aKt/vCnO9QX4+zgU8hYQJtkhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MsgwJeHkPQpryr63dFhNrHEHyNGI01/CQu2eKEwwP3K+S0Jtq5lkvWx/yzixIiQZH U2rHUL1WvfJLtKd85UsrgT0QaXvb8w2qJzkPCh6pgEcASQa7e+6rW9GlVo1jAM0Vzd KH1k5/zVJ/NFvE/69PfEq+XZUv0duEz3OixkGkrw= From: Mark Harmstone To: gcc-patches@gcc.gnu.org Cc: Mark Harmstone Subject: [PATCH 3/5] Avoid magic numbers when writing CodeView padding Date: Sat, 29 Jun 2024 23:06:51 +0100 Message-ID: <20240629220653.4445-3-mark@harmstone.com> In-Reply-To: <20240629220653.4445-1-mark@harmstone.com> References: <20240629220653.4445-1-mark@harmstone.com> Mime-Version: 1.0 X-Spam-Status: No, score=-12.7 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 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 Adds names for the padding magic numbers to enum cv_leaf_type. gcc/ * dwarf2codeview.cc (enum cv_leaf_type): Add padding constants. (write_cv_padding): Use names for padding constants. --- gcc/dwarf2codeview.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc index 921d5f41e5a..71049ccf878 100644 --- a/gcc/dwarf2codeview.cc +++ b/gcc/dwarf2codeview.cc @@ -77,6 +77,9 @@ enum cv_sym_type { /* This is enum LEAF_ENUM_e in Microsoft's cvinfo.h. */ enum cv_leaf_type { + LF_PAD1 = 0xf1, + LF_PAD2 = 0xf2, + LF_PAD3 = 0xf3, LF_MODIFIER = 0x1001, LF_POINTER = 0x1002, LF_PROCEDURE = 0x1008, @@ -1037,7 +1040,7 @@ write_lf_pointer (codeview_custom_type *t) /* All CodeView type definitions have to be aligned to a four-byte boundary, so write some padding bytes if necessary. These have to be specific values: - f3, f2, f1. */ + LF_PAD3, LF_PAD2, LF_PAD1. */ static void write_cv_padding (size_t padding) @@ -1048,19 +1051,19 @@ write_cv_padding (size_t padding) if (padding == 3) { fputs (integer_asm_op (1, false), asm_out_file); - fprint_whex (asm_out_file, 0xf3); + fprint_whex (asm_out_file, LF_PAD3); putc ('\n', asm_out_file); } if (padding >= 2) { fputs (integer_asm_op (1, false), asm_out_file); - fprint_whex (asm_out_file, 0xf2); + fprint_whex (asm_out_file, LF_PAD2); putc ('\n', asm_out_file); } fputs (integer_asm_op (1, false), asm_out_file); - fprint_whex (asm_out_file, 0xf1); + fprint_whex (asm_out_file, LF_PAD1); putc ('\n', asm_out_file); } From patchwork Sat Jun 29 22:06:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 1954285 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=harmstone.com header.i=@harmstone.com header.a=rsa-sha256 header.s=mail header.b=C6yzuAr2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [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 4WBRJn07vhz20Xf for ; Sun, 30 Jun 2024 08:08:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5C21D389F4FF for ; Sat, 29 Jun 2024 22:08:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.burntcomma.com (mail2.burntcomma.com [217.169.27.34]) by sourceware.org (Postfix) with ESMTPS id 9E625389EC8F for ; Sat, 29 Jun 2024 22:07:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E625389EC8F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=harmstone.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9E625389EC8F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.169.27.34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698826; cv=none; b=vr4cLYZtI1YLDhtEYjdyqzAG7xypyz/YAeo+5i4yOyEHHVBKrw6/SBdT7aWyr2Zx2EINiSfTNVrSluWLxydrhsyu2D8ua4r2RWsFbhxM4RWINoWJiQtrqF0iE/P4iY6zbAJ4hafE4k4YcYW6V6GBR6IdAudN9NP3okjQ4dVNXDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698826; c=relaxed/simple; bh=k27Z9VVqPwFEHiXKwGtMRaPBQgBf9sM7APQ0WkYkWW8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=kaYzrENaiZcJApJhdBRTHQsLYmXxncUl+8a84iApwfooH12/SS5Tm9Igx2mGrlK13LUZxLtARwVm1bcGME07bzr6hU/RS7UQPc1iksu80D42KOotiIWbdFhbw0nRBepxpK/E4QX3070WxNhiaYPk1OVSZWL2egztNPJgOUhfg1I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (beren.burntcomma.com [IPv6:2a02:8012:8cf0:0:b62e:99ff:fee9:ad9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.burntcomma.com (Postfix) with ESMTPSA id 721143DA80F3; Sat, 29 Jun 2024 23:07:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmstone.com; s=mail; t=1719698823; bh=q1dCnrTufPUjOzPGXg4DV/GwCHya3+pZZEfYzIXEUdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C6yzuAr2HS2H4t0/GsVCqjF7HDMQHc76t0dZlyS7F52tcrm4YRvnhplxzKkVGN4Qj QwVBaixQeCgc6I7jdMcH84yW106RTM6DHKZ6xplzwAxHRScm1HhW8tryLCtgvg3qUD z0D1fgwhme7d8ZAG2+bDNut+puQUX8obPTt8+Yts= From: Mark Harmstone To: gcc-patches@gcc.gnu.org Cc: Mark Harmstone Subject: [PATCH 4/5] Make sure CodeView symbols are aligned Date: Sat, 29 Jun 2024 23:06:52 +0100 Message-ID: <20240629220653.4445-4-mark@harmstone.com> In-Reply-To: <20240629220653.4445-1-mark@harmstone.com> References: <20240629220653.4445-1-mark@harmstone.com> Mime-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, 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: 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 CodeView symbols have to be multiples of four bytes; add an alignment directive to write_data_symbol to ensure this. Note that these can be zeroes, so we can rely on GAS to do this for us; it's only types that need f3, f2, f1 values. gcc/ * dwarf2codeview.cc (write_data_symbol): Add alignment directive. --- gcc/dwarf2codeview.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc index 71049ccf878..5a33b439b14 100644 --- a/gcc/dwarf2codeview.cc +++ b/gcc/dwarf2codeview.cc @@ -958,6 +958,8 @@ write_data_symbol (codeview_symbol *s) ASM_OUTPUT_ASCII (asm_out_file, s->data_symbol.name, strlen (s->data_symbol.name) + 1); + ASM_OUTPUT_ALIGN (asm_out_file, 2); + targetm.asm_out.internal_label (asm_out_file, SYMBOL_END_LABEL, label_num); end: From patchwork Sat Jun 29 22:06:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 1954286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=harmstone.com header.i=@harmstone.com header.a=rsa-sha256 header.s=mail header.b=2oJjR84Q; 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 4WBRJv0Km2z20Xf for ; Sun, 30 Jun 2024 08:08:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F154038114C8 for ; Sat, 29 Jun 2024 22:08:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.burntcomma.com (mail.burntcomma.com [IPv6:2a02:8012:8cf0:250::6d61:696c]) by sourceware.org (Postfix) with ESMTPS id DEEB2389EC9B for ; Sat, 29 Jun 2024 22:07:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DEEB2389EC9B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=harmstone.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DEEB2389EC9B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a02:8012:8cf0:250::6d61:696c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698826; cv=none; b=uOoGEj8DRbU+h+n007KBeU6f3qJRDHjEMGkxk7dyr2k04TMB58U7bHZrLL+i4I3moTPJpAm83u5VfNrKSk/Ci4+GqBYeSOdGgLpBQtpkKdTo+woDAlmJFL1tkQtCzFFbSZ/J1BbWsY/HPfjBB9fXNjffh78aviEcDvMw+Qvn+p8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698826; c=relaxed/simple; bh=9FhgnGjqqwHQ0Nn4MbHADgA0QgAkDhk3sUFPIwSHaCw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=FbG1hduuvhUrKXiA4cqUXafax7xrMckazppIS+CPISBg+R2stniI3nU4U6dKhMh9g2wY12rPrZCJgj/L7Qv2eXdHqPXfc4x/5oBGdy+WxwSfYU8boH78R53UNQscR1KACR5Ap4DvkDGtkZLcC/PnoeXdk8Uf75rQ32+csCQYBMk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (beren.burntcomma.com [IPv6:2a02:8012:8cf0:0:b62e:99ff:fee9:ad9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.burntcomma.com (Postfix) with ESMTPSA id 161653DA80F7; Sat, 29 Jun 2024 23:07:04 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmstone.com; s=mail; t=1719698824; bh=+n22oI8R96gixrrzwfS5Twi9jDbnopKvCQbd+7F3BM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2oJjR84QSIKK5LA1SF/rd8IW0PnMrlGcsOLsuC3436A0HauC0/5vrgL1/HAqsQ9pT ylecuIMQIHNU2xleyStRNe7Bv301gfQ3MHwfB4Adk5dvF3Mh6+Z4GOrHiop41p+xVW 17d4l+XclcK9FDxXkUup3vIq42EOuDW7BKZMPZLw= From: Mark Harmstone To: gcc-patches@gcc.gnu.org Cc: Mark Harmstone Subject: [PATCH 5/5] Document return value in write_cv_integer Date: Sat, 29 Jun 2024 23:06:53 +0100 Message-ID: <20240629220653.4445-5-mark@harmstone.com> In-Reply-To: <20240629220653.4445-1-mark@harmstone.com> References: <20240629220653.4445-1-mark@harmstone.com> Mime-Version: 1.0 X-Spam-Status: No, score=-12.7 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 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 gcc/ * dwarf2codeview.cc (write_lf_modifier): Expand upon comment. --- gcc/dwarf2codeview.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc index 5a33b439b14..df53d8bab9d 100644 --- a/gcc/dwarf2codeview.cc +++ b/gcc/dwarf2codeview.cc @@ -1113,7 +1113,7 @@ write_lf_modifier (codeview_custom_type *t) /* Write a CodeView extensible integer. If the value is non-negative and < 0x8000, the value gets written directly as an uint16_t. Otherwise, we output two bytes for the integer type (LF_CHAR, LF_SHORT, ...), and the - actual value follows. */ + actual value follows. Returns the total number of bytes written. */ static size_t write_cv_integer (codeview_integer *i)