bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sparc-lp64: stab section entsize wrong


From: Alan Modra
Subject: Re: sparc-lp64: stab section entsize wrong
Date: Tue, 9 Jul 2002 09:36:17 +0930
User-agent: Mutt/1.3.25i

On Mon, Jul 08, 2002 at 12:34:37PM -0700, Marco Walther wrote:
> >>>>> "AM" == Alan Modra <address@hidden> writes:
> 
> AM> On Thu, Jun 27, 2002 at 03:15:22PM -0700, Marco Walther wrote:
> >> Hi,
> >> 
> >> the subject says it all.  Gas out of binutils-2.12.1 produces an
> >> sh_entsize of 0x14 for the .stab section when building a 64bit object.
> >> But the stab entries are still 12 (0x0c) bytes long even for 64bit
> >> objects.
> 
> >> --- binutils-2.12.1/bfd/elf.c.orig Thu May  9 07:48:54 2002
> >> +++ binutils-2.12.1/bfd/elf.c      Thu Jun 27 15:07:44 2002
> >> @@ -2547,8 +2547,17 @@
> >> elf_section_data (s)->this_hdr.sh_link = d->this_idx;
> >> 
> >> /* This is a .stab section.  */
> >> -            elf_section_data (s)->this_hdr.sh_entsize =
> >> -              4 + 2 * bfd_get_arch_size (abfd) / 8;
> >> +            if (bfd_mach_sparc_v9_p(bfd_get_arch(abfd)))
> 
> AM> This is very broken.  Also, it is better to keep arch specific code
> AM> out of the generic code.
> 
> The original code is not a lot better there;-)  Yes it looks like a
> convenient place to fixup this entry size.  But it's kind of hard to
> find this place later one.

By broken, I meant your patch was using bfd_get_arch when you wanted
bfd_get_mach, and you weren't testing bfd_get_arch against bfd_arch_sparc.

> AM> An acceptable fix might be to modify the code you're patching above to
> AM> only set sh_entsize if zero (I think it defaults to zero, not sure),
> 
> Yes, most of the sh_entsize fields are never set and so default to
> zero.
> 
> 
> AM> and set up the sparc sh_entsize value in a new
> AM> elf_backend_fake_sections function living in elf64-sparc.c.
> 
> Maybe the following patch looks better to you;-)

Definitely.  Please supply ChangeLog entries too, and I'll commit it.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



reply via email to

[Prev in Thread] Current Thread [Next in Thread]