From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id 471353858D33 for ; Mon, 16 Oct 2023 23:23:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 471353858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 471353858D33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=96.47.72.81 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697498597; cv=pass; b=cGyJeSZJfvDv0h8Sy7Et7HJ1RVotCRodS6vpCRawtzKsmDfunxoOPLSL1W7qTSeVTVP7pZ73IHkAbhfVmh1Ose2tKG2l5EMCOd9gloDFWbSKYVpTMbWfM2MMMR/WR/cQh7Gx1YMB879nfDheeH04kxUVR7jWExNLBzuGi4XZtFw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697498597; c=relaxed/simple; bh=KTxAuxX3/Nu6JWHJRPWOO1tFTsmCdvZ635S/pbxGRcE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=RVnpMmOnPAuDutjUOht6CnQyv+WU1Cuqch6TuZB4gWV87Y8wpkN/noQnj0QX31Hxu0zJ3b0ye9WFlKJ8kEA4ddsegBsbAc823eLowCIRwH0TTr6xoKRji0Lh5Y1UAsIUukOeaatQJBwJg0JNd/pp0lknkaXS9Gnjo2KZxjbNBfk= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4S8Y7m13cnz3PpC; Mon, 16 Oct 2023 23:23:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S8Y7l71MJz3D6T; Mon, 16 Oct 2023 23:23:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697498596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DOb/5U0DsuQyYZJOIXQB/6bpVsWt54/xobJrBLT26Ns=; b=HulF1fBUc0j/QjoGwhp5Vk+dXoVktHJt5H1Mh6oJiFgqiTe8ObFWnpnPXY2F/MmT4ap3nX 5DIoHOEMXMHe5lhck8PVAtmyrSC+eAVjW+QTLMKgxqSLdBI1fDY4idWFJHnOLLeeouUZsL 5/M8W9JAkQeS2U2rOkTA6TTlMV3svEyuou34y9bY1BUU5GjA0LYjM9x0z8rhWoGHh3sp4Z AcG1GaFc2idsXLV0q8Sh/4Mz88QOgX5THO5nGNU5aYjSiql8aaBkH6GgV883TKn4QcRhYI +pqbR30NlaVDFkLVgH3rCjbZxNlhCvikpx4hAuASfrd+jfIrCrWuFpmZinNpiw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697498596; a=rsa-sha256; cv=none; b=sdQDwG95fLhBnjhesHKr1l4sFqNk+9V3XPxmQ1nHzplJcmzwwE3/iWKtXltg+q/x67LKn1 ygg7DDSbblEWbVphWzMJbcnDTzS2QX2z2ZZwoHgB7kSUuDXi8iQCq1Talj81+3mK/tdCfn +6//U9K5T3RYl12P83PDX/jnmdaRHVkMGV5udIWgMRGeqkLMFRzIPNLvp/IoThmysnbFhE qgpLGJ5YbPepccGCxEQx0R8SM28NHsRbMACwatdM5a7ut2fPn0aomIJOESYoCEW/cw2iCP FumNKh+0CPbZM8z9lAZRMSLkqnleUC2GtYGTzyt5zPhIMWLbwLLkgcfVoTTXAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697498596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DOb/5U0DsuQyYZJOIXQB/6bpVsWt54/xobJrBLT26Ns=; b=HoWaeNsxwCa2lrBWnbUUNjChv2uXgaLMy5mLv9Jh3N0chtmloiHgKg/IC1QYCbJg4WVqzQ EgmWr+RjehmmEBKWUs8seTkTSCic57G5D0i3EW2ariLL1uPUwv44blWNVO+i5F12TRZ8GT zqNk8Fj4VSlRkAqTexyu/r4uN0pnOfooKDSoji2S8XvOiLWuY+Mg8qjuGlP//kmBUKZkfH 0ULnCkh1dUSiMgezRApNDaM9bNw2enUsSUNP6GrgcUL/pu7bCMiT4ARVSPcwNlLh/14veC Q0rfzafXJBqdQsQajGbWSCl2GpVmpCevQ6XoX43qtsvo+29K0XN+shffYPUGPQ== Received: from [IPV6:2601:648:8683:39a0:f055:f679:76c4:bebe] (unknown [IPv6:2601:648:8683:39a0:f055:f679:76c4:bebe]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4S8Y7l1vMfzs7v; Mon, 16 Oct 2023 23:23:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <4fcf4c8b-a6f8-0864-e45c-81823b7bf03b@FreeBSD.org> Date: Mon, 16 Oct 2023 16:23:14 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Content-Language: en-US To: Lancelot SIX Cc: gdb-patches@sourceware.org, Felix , Jini Susan , Simon Marchi References: <20231009183617.24862-1-jhb@FreeBSD.org> <20231009183617.24862-2-jhb@FreeBSD.org> <20231016092315.a2dc3h3rfwb2xhq4@octopus> From: John Baldwin Subject: Re: [RFC 01/13] binutils: Support for the NT_X86_CPUID core dump note In-Reply-To: <20231016092315.a2dc3h3rfwb2xhq4@octopus> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 List-Id: On 10/16/23 2:23 AM, Lancelot SIX wrote: > Hi John > > I am aware this is a RFC series where you are mostly looking for > feedback on the overall direction, but I have an implemenation question > below (feel free to discard as part of the RFC process).t > > On Mon, Oct 09, 2023 at 11:36:03AM -0700, John Baldwin wrote: >> This core dump note contains an array of CPUID leaf values. Each >> entry in the array contains six 32-bit integers describing the inputs >> to the CPUID instruction (%eax and %ecx) and the outputs of the >> instruction (%eax, %ebx, %ecx, and %edx) similar to the C structure: >> >> struct cpuid_leaf >> { >> uint32_t leaf; >> uint32_t subleaf; >> uint32_t eax; >> uint32_t ebx; >> uint32_t ecx; >> uint32_t edx; >> }; >> >> Current implementations of this note contain leaves associated with >> the XSAVE state area (major leaf 0xd), but future implementations may >> add other leaf values in the future. >> --- >> bfd/elf-bfd.h | 2 ++ >> bfd/elf.c | 35 +++++++++++++++++++++++++++++++++++ >> binutils/readelf.c | 2 ++ >> include/elf/common.h | 2 ++ >> 4 files changed, 41 insertions(+) >> >> @@ -12640,6 +12660,19 @@ elfcore_write_xstatereg (bfd *abfd, char *buf, int *bufsiz, >> note_name, NT_X86_XSTATE, xfpregs, size); >> } >> >> +char * >> +elfcore_write_x86_cpuid (bfd *abfd, char *buf, int *bufsiz, >> + const void *cpuid, int size) >> +{ >> + char *note_name; >> + if (get_elf_backend_data (abfd)->elf_osabi == ELFOSABI_FREEBSD) >> + note_name = "FreeBSD"; > > The code above (in elfcore_grok_note) only accept "LINUX", and the > comment in "include/elf/common.h" says "note name must be "LINUX". > > Is this something you intend to adjust later when adding full FreeBSD > support? I really just kept that to match what is there for NT_X86_XSTATE, but this patch already includes FreeBSD support (FreeBSD notes use elfcore_grok_freebsd_note rather than elfcore_grok_note). I almost left that comment about the note name out, and probably I should just do that. (Arguably I should also remove that comment from NT_X86_XSTATE and possibly some others that both FreeBSD and Linux generate.) On a related note, abusing elf_osabi to determine the note name is a bit of a hack. It would be nice if elfcore_write_register_note accepted the note name as an argument, but I'm not sure how much that would break (e.g. if that's a public binutils API used by other things than gdb). -- John Baldwin