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: What does--enable-64-bit-bfd mean anyway? Thinko in bfd-in.h?


2009/5/18 Dave Korn <dave.korn.cygwin@googlemail.com>:
>
> ? ?Hi everyone,
>
> ?Christian observed an interesting failure mode on the i686-pc-cygwin
> (32-bit) target when configured using --enable-64-bit-bfd. ?One of the dump
> tests fails with this pattern mismatch:
>
>> regexp_diff match failure
>> regexp "^Entry 0 00000000 00000000 Export Directory \[\.edata \(or
>> where ever we found it\)\]$"
>> line ? "Entry 0 0000000000000000 00000000 Export Directory [.edata (or
>> where ever we found it)]"
>> FAIL: Empty export table
>
> ?This is very straightforwardly caused by the definition of fprintf_vma
> coming from bfd-in.h:
>
> #ifdef BFD64
>
> ? ? ? ? [ ... snips ... ]
>
> #ifndef fprintf_vma
> #define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
> #define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
> #endif
> ? ? ? ? [ ... snips ... ]
>
> #else /* not BFD64 ?*/
>
> ? ? ? ? [ ... snips ... ]
>
> #define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
> #define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)
>
> ? ? ? ? [ ... snips ... ]
>
> #endif /* not BFD64 ?*/
>
>
> ?This looks like a thinko to me. ?Surely the size of a VMA and thus the size
> used to print it out in the dump fields should depend on the object file
> format in question, or perhaps the target, but certainly not on host
> characteristics? ?I see this definition:
>
> #if BFD_ARCH_SIZE >= 64
> #define BFD64
> #endif
>
> ... which I think means "Turn on 64-bit support if the target format implies
> we're going to need it"; does that mean it's a mistake to use
> --enable-64-bit-bfd for a 32-bit target (or a collection of --enable-targets
> that includes any 32-bit targets)?
>
> ? ?cheers,
> ? ? ?DaveK
>

Hmm, interesting. AFAIU the switch it makes sure that bfd_vma has
64-bit scalar width. So a absolute print of a 64-bit scalar results in
16 characters. Possile we could change the bfd_print_vma routines to
print the upper 32-bit just in case it isn't zero. But I fear this
could lead to other breakages, too.

Cheers,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination


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