This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR ld/12451: --build-id doesn't work


On Tue, Dec 13, 2011 at 04:01:03PM -0800, H.J. Lu wrote:
> diff --git a/bfd/elfcode.h b/bfd/elfcode.h
> index b7e0226..5c06bae 100644
> --- a/bfd/elfcode.h
> +++ b/bfd/elfcode.h
> @@ -1099,6 +1099,24 @@ elf_checksum_contents (bfd *abfd,
>  
>        if (i_shdr.contents)
>  	(*process) (i_shdr.contents, i_shdr.sh_size, arg);
> +      else
> +	{
> +	  asection *sec;
> +
> +	  sec = bfd_section_from_elf_index (abfd, count);
> +	  if (sec != NULL)
> +	    {
> +	      if (sec->contents == NULL)
> +		{
> +		  /* Force rereading from file.  */
> +		  sec->flags &= ~SEC_IN_MEMORY;
> +		  if (! bfd_malloc_and_get_section (abfd, sec, & sec->contents))
> +		    continue;
> +		}
> +	      if (sec->contents != NULL)
> +		(*process) (sec->contents, i_shdr.sh_size, arg);
> +	    }
> +	}
>      }
>  
>    return TRUE;

I reckon we should exclude SHT_NOBITS sections from the checksum.  It
seems a complete waste of time to me.  We already checksum their size
and address when processing program headers and section headers.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]