This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFC] Collision between NT_GNU_BUILD_ATTRIBUTE_OPEN and NT_PPC_VMX
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Gustavo Romero <gromero at linux dot vnet dot ibm dot com>
- Cc: Binutils <binutils at sourceware dot org>, Alan Modra <amodra at gmail dot com>
- Date: Fri, 11 Aug 2017 16:03:26 -0700
- Subject: Re: [RFC] Collision between NT_GNU_BUILD_ATTRIBUTE_OPEN and NT_PPC_VMX
- Authentication-results: sourceware.org; auth=none
- References: <598E32FC.4070509@linux.vnet.ibm.com>
On Fri, Aug 11, 2017 at 3:43 PM, Gustavo Romero
<gromero@linux.vnet.ibm.com> wrote:
> Hi,
>
> After commit 9ef920e, "Add support for displaying and merging GNU_BUILD_NOTEs.",
> coredump file generated on PPC64 and displayed with 'binutils/readelf -n' shows
> errors in VMX/Altivec registers note section like:
>
> readelf: Error: unrecognised attribute type in name field: 76
> <unknown name type> 0x00000220 NT_PPC_VMX (ppc Altivec registers)
> readelf: Error: <invalid description size: 220>
> <invalid descsz>
>
> Before it was:
>
> LINUX 0x00000220 NT_PPC_VMX (ppc Altivec registers)
>
> because NT_GNU_BUILD_ATTRIBUTE_OPEN (introduced by the aforementioned commit)
> has the same value as NT_PPC_VMX:
>
> $ grep 0x100 include/elf/common.h
> #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
> #define NT_GNU_BUILD_ATTRIBUTE_OPEN 0x100
>
> If my understanding is correct about GNU_BUILD_NOTEs, it's just useful on
> run-time or dynamic / static linking and will never be present in a coredump
> file. If that holds I suggest the following simple fix:
>
> @@ -17477,8 +17503,8 @@ process_note (Elf_Internal_Note * pnote,
>
> printf (" ");
>
> - if (pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN
> - || pnote->type == NT_GNU_BUILD_ATTRIBUTE_FUNC)
> + if (elf_header.e_type != ET_CORE && (pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN
> + || pnote->type == NT_GNU_BUILD_ATTRIBUTE_FUNC))
> print_gnu_build_attribute_name (pnote);
> else
> print_symbol (-20, name);
> @@ -17496,8 +17522,8 @@ process_note (Elf_Internal_Note * pnote,
> return print_stapsdt_note (pnote);
> else if (const_strneq (pnote->namedata, "CORE"))
> return print_core_note (pnote);
> - else if (pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN
> - || pnote->type == NT_GNU_BUILD_ATTRIBUTE_FUNC)
> + else if (elf_header.e_type != ET_CORE && (pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN
> + || pnote->type == NT_GNU_BUILD_ATTRIBUTE_FUNC))
> return print_gnu_build_attribute_description (pnote, file);
>
> If that change is upvoted I'll send a formal patch for review.
>
> Thank you.
>
This is wrong. pnote->type is unique only for a given pnote->namedata.
NT_GNU_* should be be checked for "GNU" notes.
--
H.J.