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

Nick Clifton nickc@redhat.com
Wed Oct 3 10:31:00 GMT 2018


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.

Cheers
  Nick




More information about the Binutils mailing list