Commit: Add support for displaying and merging GNU_BUILD_NOTEs
H.J. Lu
hjl.tools@gmail.com
Tue Mar 7 23:11:00 GMT 2017
On Wed, Mar 1, 2017 at 3:09 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi Guys,
>
> I am applying the patch below to add support for displaying and
> merging GNU_BUILD_NOTEs. The proposal for these notes can be
> found here:
>
> https://fedoraproject.org/wiki/Toolchain/Watermark#Questions
>
> The notes are designed so that they can be used without any
> modifications to the assembler or linker. But in order to display the
> contents of the notes readelf needs an update. Plus in order to
> reduce redundancy in the notes (and thus save size in the binary
> containing them) a merge-notes option has been added to objcopy.
>
> Cheers
> Nick
>
> binutils/ChangeLog
> 2017-03-01 Nick Clifton <nickc@redhat.com>
>
> * readelf.c (get_note_type): Add support for GNU_BUILD_NOTEs.
> (get_gnu_elf_note_type): Add support for GNU_PROPERTY_NOTEs.
> (decode_x86_isa): New function.
> (print_gnu_property_note): New function.
> (print_gnu_note): Handle GNU_PROPERTY_NOTEs.
> (print_gnu_build_attribute_description): New function.
> (print_gnu_build_attribute_name): New function.
> (process_note): Add support for GNU_BUILD_NOTEs.
> * objcopy.c (--merge-notes): New command line option.
> (copy_options): Add merge-notes.
> (copy_usage): Likewise.
> (is_merge_note_section): New function.
> (merge_gnu_build_notes): New function.
> (copy_object): Merge note sections if asked to do so.
> (skip_section): Add skip_copy parameter. Add support for skipping
> merged note sections.
> (copy_relocations_in_section): Update call to skip_section.
> (copy_section): Likewise.
> (copy_main): Add support for merge-notes option.
> * doc/binutils.texi: Document the new option to objcopy.
> * NEWS: Mention the new feature.
> * testsuite/binutils-all/note-2-32.d: New test. Checks note
> merging on 32-bit targets.
> * testsuite/binutils-all/note-2-32.s: New test source file.
> * testsuite/binutils-all/note-2-64.d: New test. Like note-2-32.d
> but for 64-bit targets.
> * testsuite/binutils-all/note-2-64.s: New test source file.
> * testsuite/binutils-all/objcopy.exp: Run the new test.
>
> include/ChangeLog
> 2017-03-01 Nick Clifton <nickc@redhat.com>
>
> * elf/common.h (SHF_GNU_BUILD_NOTE): Define.
> (NT_GNU_PROPERTY_TYPE_0): Define.
> (NT_GNU_BUILD_ATTRIBUTE_OPEN): Define.
> (NT_GNU_BUILD_ATTRIBUTE_FUN): Define.
> (GNU_BUILD_ATTRIBUTE_TYPE_NUMERIC): Define.
> (GNU_BUILD_ATTRIBUTE_TYPE_STRING): Define.
> (GNU_BUILD_ATTRIBUTE_TYPE_BOOL_TRUE): Define.
> (GNU_BUILD_ATTRIBUTE_TYPE_BOOL_FALSE): Define.
> (GNU_BUILD_ATTRIBUTE_VERSION): Define.
> (GNU_BUILD_ATTRIBUTE_STACK_PROT): Define.
> (GNU_BUILD_ATTRIBUTE_RELRO): Define.
> (GNU_BUILD_ATTRIBUTE_STACK_SIZE): Define.
> (GNU_BUILD_ATTRIBUTE_TOOL): Define.
> (GNU_BUILD_ATTRIBUTE_ABI): Define.
> (GNU_BUILD_ATTRIBUTE_PIC): Define.
> (NOTE_GNU_PROPERTY_SECTION_NAME): Define.
> (GNU_BUILD_ATTRS_SECTION_NAME): Define.
> (GNU_PROPERTY_STACK_SIZE): Define.
> (GNU_PROPERTY_NO_COPY_ON_PROTECTED): Define.
> (GNU_PROPERTY_X86_ISA_1_USED): Define.
> (GNU_PROPERTY_X86_ISA_1_NEEDED): Define.
> (GNU_PROPERTY_X86_ISA_1_486): Define.
> (GNU_PROPERTY_X86_ISA_1_586): Define.
> (GNU_PROPERTY_X86_ISA_1_686): Define.
> (GNU_PROPERTY_X86_ISA_1_SSE): Define.
> (GNU_PROPERTY_X86_ISA_1_SSE2): Define.
> (GNU_PROPERTY_X86_ISA_1_SSE3): Define.
> (GNU_PROPERTY_X86_ISA_1_SSSE3): Define.
> (GNU_PROPERTY_X86_ISA_1_SSE4_1): Define.
> (GNU_PROPERTY_X86_ISA_1_SSE4_2): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX2): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX512F): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX512CD): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX512ER): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX512PF): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX512VL): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX512DQ): Define.
> (GNU_PROPERTY_X86_ISA_1_AVX512BW): Define.
>
NT_GNU_PROPERTY_TYPE_0 isn't dumped properly:
https://sourceware.org/bugzilla/show_bug.cgi?id=21231
This patch fixes it. OK for master?
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Properly-dump-NT_GNU_PROPERTY_TYPE_0.patch
Type: text/x-patch
Size: 14544 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170307/c5a0690f/attachment.bin>
More information about the Binutils
mailing list