This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/12451: --build-id doesn't work
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org, Jakub Jelinek <jakub at redhat dot com>, Nick Clifton <nickc at redhat dot com>
- Date: Wed, 14 Dec 2011 20:23:34 +1030
- Subject: Re: PATCH: PR ld/12451: --build-id doesn't work
- References: <20111214000103.GA29059@intel.com>
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