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] Keep bfd section lma in sync with elf data structures


Can put PR 11219 in ChangeLog entry?

Thanks.


H.J.

On Fri, Feb 5, 2010 at 9:13 AM, Sterling Augustine
<sterling@tensilica.com> wrote:
> I have committed the attached patch which updates the lma of a section
> inside the bfd data structure when it is changed inside the elf structure.
> The updated value is now printed in the map file, rather than the formerly
> stale value. This fixes bugzilla #11219.
>
> Sterling
>
> 2010-02-05 ?Sterling Augustine ?<sterling@tensilica.com>
>
> ? ? ? ?* elf.c (assign_file_positions_for_load_sections) Update lma of
> ? ? ? ?section if necessary.
>
>
> Index: elf.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf.c,v
> retrieving revision 1.500
> diff -u -p -r1.500 elf.c
> --- elf.c ? ? ? 4 Feb 2010 09:16:38 -0000 ? ? ? 1.500
> +++ elf.c ? ? ? 5 Feb 2010 17:02:01 -0000
> @@ -4462,6 +4462,22 @@ assign_file_positions_for_load_sections
> ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ?p->p_memsz += adjust;
>
> + ? ? ? ? ? ? if (p->p_paddr + p->p_memsz != sec->lma)
> + ? ? ? ? ? ? ? {
> + ? ? ? ? ? ? ? ? /* This behavior is a compromise--ld has long
> + ? ? ? ? ? ? ? ? ? ?silently changed the lma of sections when
> + ? ? ? ? ? ? ? ? ? ?lma - vma is not equal for every section in a
> + ? ? ? ? ? ? ? ? ? ?pheader--but only in the internal elf structures.
> + ? ? ? ? ? ? ? ? ? ?Silently changing the lma is probably a bug, but
> + ? ? ? ? ? ? ? ? ? ?changing it would have subtle and unknown
> + ? ? ? ? ? ? ? ? ? ?consequences for existing scripts.
> +
> + ? ? ? ? ? ? ? ? ? ?Instead modify the bfd data structure to reflect
> + ? ? ? ? ? ? ? ? ? ?what happened. ?This at least fixes the values
> + ? ? ? ? ? ? ? ? ? ?for the lma in the mapfile. ?*/
> + ? ? ? ? ? ? ? ? sec->lma = p->p_paddr + p->p_memsz;
> + ? ? ? ? ? ? ? }
> +
> ? ? ? ? ? ? ?if (this_hdr->sh_type != SHT_NOBITS)
> ? ? ? ? ? ? ? ?{
> ? ? ? ? ? ? ? ? ?if (p->p_filesz + adjust < p->p_memsz)
>
>



-- 
H.J.


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