[PATCH 1/3] ELF: Group PT_NOTE segments by section alignments

H.J. Lu hjl.tools@gmail.com
Wed Oct 3 12:56:00 GMT 2018


On Wed, Oct 3, 2018 at 3:30 AM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi H.J.
>
>   One question:
>
> > +       while (s->next != NULL
> > +              && s->next->alignment_power == alignment_power
> > +              && (s->next->flags & SEC_LOAD) != 0
> > +              && CONST_STRNEQ (s->next->name, ".note"))
> > +         s = s->next;
>
> I did not think that note sections were required to have a ".note"
> prefix to their name.  So wouldn't it be better to check for a SHF_NOTE
> flag instead ?  (Assuming that the section is in an ELF format bfd, of
> course).
>
> I appreciate that the code that you are patching also used the CONST_STRNEQ
> check, but I am thinking that now would be a good time to fix this bug
> as well.  If the section is not in an ELF format file, you could always
> fall back on checking for the .note prefix.

get_program_header_size and _bfd_elf_map_sections_to_segments are only
used on ELF files.  This updated patch checks SHT_NOTE section type instead.
OK for master?

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ELF-Group-PT_NOTE-segments-by-section-alignments.patch
Type: text/x-patch
Size: 4163 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20181003/1d43f809/attachment.bin>


More information about the Binutils mailing list