public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix objdump output formatting
@ 2002-05-11  2:29 Thiemo Seufer
  2002-05-19 13:14 ` Thiemo Seufer
  0 siblings, 1 reply; 9+ messages in thread
From: Thiemo Seufer @ 2002-05-11  2:29 UTC (permalink / raw)
  To: binutils

Hi All,

this fixes the output width of the header dump for 32 bit architectures
when BFD64 is enabled.


Thiemo


2002-05-11  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/binutils/ChangeLog
	* objdump.c (dump_headers): Fix output formatting for 32-bit arches
	in BFD64 enabled toolchain.


diff -BurpNX /bigdisk/src/binutils-exclude 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	Thu Apr 18 17:30:09 2002
@@ -361,7 +361,10 @@ dump_headers (abfd)
 #ifndef BFD64
   printf (_("Idx Name          Size      VMA       LMA       File off  Algn"));
 #else
-  printf (_("Idx Name          Size      VMA               LMA               File off  Algn"));
+  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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix objdump output formatting
  2002-05-11  2:29 [PATCH] Fix objdump output formatting Thiemo Seufer
@ 2002-05-19 13:14 ` Thiemo Seufer
  2002-05-19 16:08   ` Hans-Peter Nilsson
  0 siblings, 1 reply; 9+ messages in thread
From: Thiemo Seufer @ 2002-05-19 13:14 UTC (permalink / raw)
  To: binutils

Thiemo Seufer wrote:
[snip]
> 2002-05-11  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> 
> 	/binutils/ChangeLog
> 	* objdump.c (dump_headers): Fix output formatting for 32-bit arches
> 	in BFD64 enabled toolchain.

If there are no objections, I'll check this in the next days.


Thiemo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix objdump output formatting
  2002-05-19 13:14 ` Thiemo Seufer
@ 2002-05-19 16:08   ` Hans-Peter Nilsson
  2002-05-19 16:40     ` Thiemo Seufer
  0 siblings, 1 reply; 9+ messages in thread
From: Hans-Peter Nilsson @ 2002-05-19 16:08 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

On Sun, 19 May 2002, Thiemo Seufer wrote:
> Thiemo Seufer wrote:
> [snip]
> > 2002-05-11  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> >
> > 	/binutils/ChangeLog
> > 	* objdump.c (dump_headers): Fix output formatting for 32-bit arches
> > 	in BFD64 enabled toolchain.
>
> If there are no objections, I'll check this in the next days.

No, don't do that, binutils doesn't work that way: you need
actual approval.  I'm not an approver, but I'd like to see all
affected test-cases fixed (or affirmation that none are
affected)...

brgds, H-P

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix objdump output formatting
  2002-05-19 16:08   ` Hans-Peter Nilsson
@ 2002-05-19 16:40     ` Thiemo Seufer
  2002-05-19 16:42       ` DJ Delorie
  2002-05-19 17:31       ` Alan Modra
  0 siblings, 2 replies; 9+ messages in thread
From: Thiemo Seufer @ 2002-05-19 16:40 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

Hans-Peter Nilsson wrote:
> On Sun, 19 May 2002, Thiemo Seufer wrote:
> > Thiemo Seufer wrote:
> > [snip]
> > > 2002-05-11  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> > >
> > > 	/binutils/ChangeLog
> > > 	* objdump.c (dump_headers): Fix output formatting for 32-bit arches
> > > 	in BFD64 enabled toolchain.
> >
> > If there are no objections, I'll check this in the next days.
> 
> No, don't do that, binutils doesn't work that way: you need
> actual approval.

And if no approver cares about it, it will never go in...

> I'm not an approver, but I'd like to see all
> affected test-cases fixed (or affirmation that none are
> affected)...

Assuming sh64 is always 64 bit, I haven't found any (the ppc gas
testsuite uses pattern matching to get around this).


Thiemo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix objdump output formatting
  2002-05-19 16:40     ` Thiemo Seufer
@ 2002-05-19 16:42       ` DJ Delorie
  2002-05-19 17:31       ` Alan Modra
  1 sibling, 0 replies; 9+ messages in thread
From: DJ Delorie @ 2002-05-19 16:42 UTC (permalink / raw)
  To: ica2_ts; +Cc: binutils


> And if no approver cares about it, it will never go in...

Yup, that's a risk we all take.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix objdump output formatting
  2002-05-19 16:40     ` Thiemo Seufer
  2002-05-19 16:42       ` DJ Delorie
@ 2002-05-19 17:31       ` Alan Modra
  2002-05-19 19:49         ` Thiemo Seufer
  1 sibling, 1 reply; 9+ messages in thread
From: Alan Modra @ 2002-05-19 17:31 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: Hans-Peter Nilsson, binutils

> > > 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 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.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix objdump output formatting
  2002-05-19 17:31       ` Alan Modra
@ 2002-05-19 19:49         ` Thiemo Seufer
  2002-05-19 21:35           ` Alan Modra
  0 siblings, 1 reply; 9+ messages in thread
From: Thiemo Seufer @ 2002-05-19 19:49 UTC (permalink / raw)
  To: binutils; +Cc: Hans-Peter Nilsson

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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix objdump output formatting
  2002-05-19 19:49         ` Thiemo Seufer
@ 2002-05-19 21:35           ` Alan Modra
  2002-05-21  9:04             ` Thiemo Seufer
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Modra @ 2002-05-19 21:35 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

On Mon, May 20, 2002 at 04:49:15AM +0200, Thiemo Seufer wrote:
> 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.

Uh, OK.  I didn't look far enough.

> 	/binutils/ChangeLog
> 	* objdump.c (dump_headers): Fix output formatting for ELF32
> 	architectures in a BFD64 enabled toolchain.

OK then, except that bfd_get_arch_size will call bfd_set_error on
non-ELF targets.  I think calling bfd_set_error is wrong.  A patch to
remove the bfd_set_error call is pre-approved.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix objdump output formatting
  2002-05-19 21:35           ` Alan Modra
@ 2002-05-21  9:04             ` Thiemo Seufer
  0 siblings, 0 replies; 9+ messages in thread
From: Thiemo Seufer @ 2002-05-21  9:04 UTC (permalink / raw)
  To: binutils; +Cc: Thiemo Seufer

Alan Modra wrote:
> On Mon, May 20, 2002 at 04:49:15AM +0200, Thiemo Seufer wrote:
> > 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.
> 
> Uh, OK.  I didn't look far enough.
> 
> > 	/binutils/ChangeLog
> > 	* objdump.c (dump_headers): Fix output formatting for ELF32
> > 	architectures in a BFD64 enabled toolchain.
> 
> OK then, except that bfd_get_arch_size will call bfd_set_error on
> non-ELF targets.  I think calling bfd_set_error is wrong.  A patch to
> remove the bfd_set_error call is pre-approved.

I checked in this patch.


Thiemo


2002-05-21  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.

	/bfd/ChangeLog
	* bfd/bfd.c (bfd_get_arch_size): Remove bfd_set_error call for
	non-ELF targets.


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)

diff -BurpNX /bigdisk/src/binutils-exclude source-orig/bfd/bfd.c source/bfd/bfd.c
--- source-orig/bfd/bfd.c	Wed Apr 10 18:40:44 2002
+++ source/bfd/bfd.c	Tue May 21 17:55:29 2002
@@ -749,7 +749,6 @@ bfd_get_arch_size (abfd)
   if (abfd->xvec->flavour == bfd_target_elf_flavour)
     return (get_elf_backend_data (abfd))->s->arch_size;
 
-  bfd_set_error (bfd_error_wrong_format);
   return -1;
 }
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-05-21 16:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-11  2:29 [PATCH] Fix objdump output formatting Thiemo Seufer
2002-05-19 13:14 ` Thiemo Seufer
2002-05-19 16:08   ` Hans-Peter Nilsson
2002-05-19 16:40     ` Thiemo Seufer
2002-05-19 16:42       ` DJ Delorie
2002-05-19 17:31       ` Alan Modra
2002-05-19 19:49         ` Thiemo Seufer
2002-05-19 21:35           ` Alan Modra
2002-05-21  9:04             ` Thiemo Seufer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).