From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id EC9E63858D35 for ; Tue, 15 Mar 2022 19:43:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC9E63858D35 X-ASG-Debug-ID: 1647373386-0c856e06ab7f2b20001-Lwtx7q Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id EHJypev1CpcWLrV5 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Mar 2022 15:43:06 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id F2D70441D69; Tue, 15 Mar 2022 15:43:05 -0400 (EDT) From: Simon Marchi X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: binutils@sourceware.org Cc: Simon Marchi Subject: [PATCH 5/7] binutils/readelf: handle NT_AMDGPU_METADATA note name Date: Tue, 15 Mar 2022 15:43:01 -0400 X-ASG-Orig-Subj: [PATCH 5/7] binutils/readelf: handle NT_AMDGPU_METADATA note name Message-Id: <20220315194303.3716792-6-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220315194303.3716792-1-simon.marchi@polymtl.ca> References: <20220315194303.3716792-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1647373386 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 2186 X-Barracuda-Spam-Score: 3.00 X-Barracuda-Spam-Status: No, SCORE=3.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M, BSF_SC7_SG0021d X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.96673 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 2.50 BSF_SC7_SG0021d Custom rule SG0021d 0.50 BSF_RULE7568M Custom Rule 7568M X-Spam-Status: No, score=-3613.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_QUARANTINE, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2022 19:43:15 -0000 From: Simon Marchi Handle the NT_AMDGPU_METADATA note, which is described here: https://llvm.org/docs/AMDGPUUsage.html#code-object-v3-note-records As of this patch, just print out the name, not the contents, which is in the msgpack format. binutils/ChangeLog: * readelf.c (get_amdgpu_elf_note_type): New. (process_note): Handle "AMDGPU" notes. include/ChangeLog: * elf/amdgcn.h (NT_AMDGPU_METADATA): New. Change-Id: Id2dba2e2aeaa55ef7464fb35aee9c7d5f96ddb23 --- binutils/readelf.c | 20 ++++++++++++++++++++ include/elf/amdgpu.h | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/binutils/readelf.c b/binutils/readelf.c index 00b5e546c1e7..91515bdf0faa 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -19724,6 +19724,22 @@ decode_x86_compat_2_isa (unsigned int bitmask) } } +static const char * +get_amdgpu_elf_note_type (unsigned int e_type) +{ + switch (e_type) + { + case NT_AMDGPU_METADATA: + return _("NT_AMDGPU_METADATA (code object metadata)"); + default: + { + static char buf[64]; + snprintf (buf, sizeof (buf), _("Unknown note type: (0x%08x)"), e_type); + return buf; + } + } +} + static void decode_x86_isa (unsigned int bitmask) { @@ -21313,6 +21329,10 @@ process_note (Elf_Internal_Note * pnote, /* GNU-specific object file notes. */ nt = get_gnu_elf_note_type (pnote->type); + else if (startswith (pnote->namedata, "AMDGPU")) + /* AMDGPU-specific object file notes. */ + nt = get_amdgpu_elf_note_type (pnote->type); + else if (startswith (pnote->namedata, "FreeBSD")) /* FreeBSD-specific core file notes. */ nt = get_freebsd_elfcore_note_type (filedata, pnote->type); diff --git a/include/elf/amdgpu.h b/include/elf/amdgpu.h index 005064fc264e..e3c90dc74e85 100644 --- a/include/elf/amdgpu.h +++ b/include/elf/amdgpu.h @@ -87,4 +87,8 @@ #define EF_AMDGPU_FEATURE_SRAMECC_OFF_V4 0x800 #define EF_AMDGPU_FEATURE_SRAMECC_ON_V4 0xc00 +/* Notes. */ + +#define NT_AMDGPU_METADATA 32 + #endif /* _ELF_AMDGPU_H */ -- 2.35.1