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
Hi H.J. Thanks for you comment. Alan fixed that at light speed... so, well, it's
already fixed.
On 11-08-2017 20:03, H.J. Lu wrote:
> 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.
>
>