This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: What does--enable-64-bit-bfd mean anyway? Thinko in bfd-in.h?
Dave Korn wrote:
> Alan Modra wrote:
> Ah, it's just wrong for the print routine to assume that bfd_vma is
> precisely the targets' size, as these macros implicitly do, gotcha.
>
>> See bfd.c:bfd_fprintf_vma.
>
> Ah, so the PE dump routines are wrong to use the macros and should be going
> via the bfd_ forms which wrap them. Hmm, it would be nice if the macros were
> private to bfd.c in some way, but there you go.
>
> I'll fix peXXigen.c shortly. Should be as simple as putting the 'bfd_' in
> front of every [sp]rintf_vma.
A quick grep shows there are quite a few places using one of [sp]rintf_vma
that probably ought to use the bfd_ version instead, and I even found where
someone has run into this same problem before in coffgen.c:
#ifdef BFD64
/* fprintf_vma() on a 64-bit enabled host will always print a 64-bit
value, but really we want to display the address in the target's
address size. Since we do not have a field in the bfd structure
to tell us this, we take a guess, based on the target's name. */
if (strstr (bfd_get_target (abfd), "64") == NULL)
fprintf (file, "%08lx", (unsigned long) (val & 0xffffffff));
else
#endif
I guess I'll take care of that while I'm at it. There's a bunch in
bfd/pei-x86_64.c too; I'm divided about whether to bother fixing it in
target-specific code where we know that the vma size is 64. I guess it's a
minor optimisation and also a pretty minor risk.
cheers,
DaveK