[PATCH] Create just one PT_NOTE for consecutive loadable .note* sections instead of one for each section

Alan Modra amodra@bigpond.net.au
Fri Jun 29 00:58:00 GMT 2007


On Thu, Jun 28, 2007 at 05:29:03PM +0200, Jakub Jelinek wrote:
> 	* elf.c (get_program_header_size): Adjacent loadable .note*
> 	sections need just one PT_NOTE segment.
> 	(_bfd_elf_map_sections_to_segments): Likewise.

OK, but please add a comment explaining why it is necessary to
restrict this to notes with 4-byte alignment.  It took me a little
while to figure out why..

> +	      while (count > 1)
> +		{
> +		  m->sections[m->count - count--] = s;
> +		  BFD_ASSERT ((s->flags & SEC_THREAD_LOCAL) == 0);
> +		  s = s->next;
> +		}
> +	      m->sections[m->count - 1] = s;

Probably not worth peeling off the last iteration of this loop (and
losing the BFD_ASSERT).

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list