This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Fix objdump output formatting
Alan Modra wrote:
> > > > Thiemo Seufer wrote:
> > > > > /binutils/ChangeLog
> > > > > * objdump.c (dump_headers): Fix output formatting for 32-bit arches
> > > > > in BFD64 enabled toolchain.
>
> >From a quick look at the patch and code in objdump.c:dump_section_header,
> it appears that you are fixing an output formatting bug for ELF, and
> creating a new bug for non-ELF. See fprintf_vma. :-(
>
> So, would you please investigate fixing non-ELF fprintf_vma?
If I understood the code correctly, all non-ELF targets determine their
address size at compile time via BFD64, while ELF targets do this via
their backend data.
> If you
> can fix that as well, I think we can apply the patch even if it does
> break some of the binutils testsuite. We can fix the testsuite later.
As long as ELF addresses are either 32 or 64 bit, the logic below
should work.
Thiemo
2002-05-11 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
/binutils/ChangeLog
* objdump.c (dump_headers): Fix output formatting for ELF32
architectures in a BFD64 enabled toolchain.
diff -BurpNX /bigdisk/src/dontdiff source-orig/binutils/objdump.c source/binutils/objdump.c
--- source-orig/binutils/objdump.c Sat Feb 2 12:53:28 2002
+++ source/binutils/objdump.c Mon May 20 03:19:03 2002
@@ -361,7 +361,11 @@ dump_headers (abfd)
#ifndef BFD64
printf (_("Idx Name Size VMA LMA File off Algn"));
#else
- printf (_("Idx Name Size VMA LMA File off Algn"));
+ /* With BFD64, non-ELF returns -1 and wants always 64 bit addresses. */
+ if (bfd_get_arch_size (abfd) == 32)
+ printf (_("Idx Name Size VMA LMA File off Algn"));
+ else
+ printf (_("Idx Name Size VMA LMA File off Algn"));
#endif
if (wide_output)