public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma
@ 2001-08-08 15:06 H . J . Lu
  2001-08-09  9:03 ` H . J . Lu
  0 siblings, 1 reply; 8+ messages in thread
From: H . J . Lu @ 2001-08-08 15:06 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: binutils

> On Wed, Aug 08, 2001 at 10:11:29AM +0200, Maciej W. Rozycki wrote:
> > 
> >  Sign-extension is fine.  I think what you really want is to truncate
> > addresses in the output of certain programs such as nm and objdump to 32
> > bits if the output BFD is elf32-*mips.  It's on my to-do list for some
> > time, but don't hold your breath (i.e. feel free to do it yourself ;-) ). 
> 

Here is the first step to implement it. After it is checked in, I will
replace as many sprintf_vma/fprintf_vma with _sprintf_vma/bfd_fprintf_vma
as I can to fix it. Any comments?

Thanks.


H.J.
----
2001-08-08  H.J. Lu  <hjl@gnu.org>

	* bfd-in.h (bfd_sprintf_vma): New prototype.
	(bfd_fprintf_vma): Likewise.
	(bfd_elf_sprintf_vma): Likewise.
	(bfd_elf_fprintf_vma): Likewise.
	(bfd_printf_vma): New. Defined with bfd_fprintf_vma.

	* bfd.c (bfd_sprintf_vma): New. Defined.
	(bfd_fprintf_vma): Likewise.

	* elf.c (bfd_elf_sprintf_vma): New. Defined.
	(bfd_elf_fprintf_vma): Likewise.

Index: bfd-in.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/bfd-in.h,v
retrieving revision 1.25
diff -u -p -r1.25 bfd-in.h
--- bfd-in.h	2001/06/19 17:57:39	1.25
+++ bfd-in.h	2001/08/08 21:56:25
@@ -183,7 +183,13 @@ typedef unsigned long bfd_size_type;
 
 #endif /* not BFD64  */
 
+extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+extern void bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
 #define printf_vma(x) fprintf_vma(stdout,x)
+#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
 
 typedef unsigned int flagword;	/* 32 bits of flags */
 typedef unsigned char bfd_byte;
Index: bfd.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/bfd.c,v
retrieving revision 1.1.1.11
diff -u -p -r1.1.1.11 bfd.c
--- bfd.c	2001/07/03 16:39:26	1.1.1.11
+++ bfd.c	2001/08/08 21:56:26
@@ -1250,3 +1250,25 @@ bfd_record_phdr (abfd, type, flags_valid
 
   return true;
 }
+
+void
+bfd_sprintf_vma (abfd, buf, value)
+     bfd *abfd;
+     char *buf;
+     bfd_vma value;
+{
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+    return bfd_elf_sprintf_vma (abfd, buf, value);
+  sprintf_vma (buf, value);
+}
+
+void
+bfd_fprintf_vma (abfd, stream, value)
+     bfd *abfd;
+     PTR stream;
+     bfd_vma value;
+{
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+    return bfd_elf_fprintf_vma (abfd, stream, value);
+  fprintf_vma ((FILE *) stream, value);
+}
Index: elf.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf.c,v
retrieving revision 1.58
diff -u -p -r1.58 elf.c
--- elf.c	2001/08/03 15:55:46	1.58
+++ elf.c	2001/08/08 21:56:26
@@ -5986,3 +5986,53 @@ bfd_get_elf_phdrs (abfd, phdrs)
 
   return num_phdrs;
 }
+
+void
+bfd_elf_sprintf_vma (abfd, buf, value)
+     bfd *abfd;
+     char *buf;
+     bfd_vma value;
+{
+  Elf_Internal_Ehdr *i_ehdrp;	/* Elf file header, internal form */
+
+  i_ehdrp = elf_elfheader (abfd);
+  if (i_ehdrp == NULL)
+    sprintf_vma (buf, value);
+  else
+    {
+      if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+#if BFD_HOST_64BIT_LONG
+	sprintf (buf, "%016lx", value);
+#else
+	sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
+		 _bfd_int64_low (value));
+#endif
+      else
+	sprintf (buf, "%08lx", (long) value);
+    }
+}
+
+void
+bfd_elf_fprintf_vma (abfd, stream, value)
+     bfd *abfd;
+     PTR stream;
+     bfd_vma value;
+{
+  Elf_Internal_Ehdr *i_ehdrp;	/* Elf file header, internal form */
+
+  i_ehdrp = elf_elfheader (abfd);
+  if (i_ehdrp == NULL)
+    fprintf_vma ((FILE *) stream, value);
+  else
+    {
+      if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+#if BFD_HOST_64BIT_LONG
+	fprintf ((FILE *) stream, "%016lx", value);
+#else
+	fprintf ((FILE *) stream, "%08lx%08lx",
+		 _bfd_int64_high (value), _bfd_int64_low (value));
+#endif
+      else
+	fprintf ((FILE *) stream, "%08lx", (long) value);
+    }
+}

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

* Re: PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma
  2001-08-08 15:06 PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma H . J . Lu
@ 2001-08-09  9:03 ` H . J . Lu
  2001-08-09  9:27   ` Doug Evans
  2001-08-10  1:09   ` Maciej W. Rozycki
  0 siblings, 2 replies; 8+ messages in thread
From: H . J . Lu @ 2001-08-09  9:03 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: binutils

On Wed, Aug 08, 2001 at 03:06:31PM -0700, H . J . Lu wrote:
> 
> Here is the first step to implement it. After it is checked in, I will
> replace as many sprintf_vma/fprintf_vma with _sprintf_vma/bfd_fprintf_vma
> as I can to fix it. Any comments?
> 

I checked in the following patch. I am coverting sprintf_vma/fprintf_vma
to _sprintf_vma/bfd_fprintf_vma.


H.J.
----
2001-08-09  H.J. Lu  <hjl@gnu.org>

	* bfd-in.h (bfd_sprintf_vma): New prototype.
	(bfd_fprintf_vma): Likewise.
	(bfd_elf_sprintf_vma): Likewise.
	(bfd_elf_fprintf_vma): Likewise.
	(bfd_printf_vma): New. Defined with bfd_fprintf_vma.
	* bfd-in2.h: Regenerated.

	* bfd.c (bfd_sprintf_vma): New. Defined.
	(bfd_fprintf_vma): Likewise.

	* elf.c (bfd_elf_sprintf_vma): New. Defined.
	(bfd_elf_fprintf_vma): Likewise.

Index: bfd-in.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/bfd-in.h,v
retrieving revision 1.25
diff -u -p -r1.25 bfd-in.h
--- bfd-in.h	2001/06/19 17:57:39	1.25
+++ bfd-in.h	2001/08/09 15:37:29
@@ -183,7 +183,13 @@ typedef unsigned long bfd_size_type;
 
 #endif /* not BFD64  */
 
+extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+extern void bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
 #define printf_vma(x) fprintf_vma(stdout,x)
+#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
 
 typedef unsigned int flagword;	/* 32 bits of flags */
 typedef unsigned char bfd_byte;
Index: bfd-in2.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/bfd-in2.h,v
retrieving revision 1.74
diff -u -p -r1.74 bfd-in2.h
--- bfd-in2.h	2001/07/12 15:35:22	1.74
+++ bfd-in2.h	2001/08/09 15:37:29
@@ -183,7 +183,13 @@ typedef unsigned long bfd_size_type;
 
 #endif /* not BFD64  */
 
+extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+extern void bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
 #define printf_vma(x) fprintf_vma(stdout,x)
+#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
 
 typedef unsigned int flagword;	/* 32 bits of flags */
 typedef unsigned char bfd_byte;
Index: bfd.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/bfd.c,v
retrieving revision 1.1.1.11
diff -u -p -r1.1.1.11 bfd.c
--- bfd.c	2001/07/03 16:39:26	1.1.1.11
+++ bfd.c	2001/08/09 15:37:29
@@ -1250,3 +1250,25 @@ bfd_record_phdr (abfd, type, flags_valid
 
   return true;
 }
+
+void
+bfd_sprintf_vma (abfd, buf, value)
+     bfd *abfd;
+     char *buf;
+     bfd_vma value;
+{
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+    return bfd_elf_sprintf_vma (abfd, buf, value);
+  sprintf_vma (buf, value);
+}
+
+void
+bfd_fprintf_vma (abfd, stream, value)
+     bfd *abfd;
+     PTR stream;
+     bfd_vma value;
+{
+  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+    return bfd_elf_fprintf_vma (abfd, stream, value);
+  fprintf_vma ((FILE *) stream, value);
+}
Index: elf.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf.c,v
retrieving revision 1.58
diff -u -p -r1.58 elf.c
--- elf.c	2001/08/03 15:55:46	1.58
+++ elf.c	2001/08/09 15:37:29
@@ -5986,3 +5986,54 @@ bfd_get_elf_phdrs (abfd, phdrs)
 
   return num_phdrs;
 }
+
+void
+bfd_elf_sprintf_vma (abfd, buf, value)
+     bfd *abfd;
+     char *buf;
+     bfd_vma value;
+{
+  Elf_Internal_Ehdr *i_ehdrp;	/* Elf file header, internal form */
+
+  i_ehdrp = elf_elfheader (abfd);
+  if (i_ehdrp == NULL)
+    sprintf_vma (buf, value);
+  else
+    {
+      if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+#if BFD_HOST_64BIT_LONG
+	sprintf (buf, "%016lx", value);
+#else
+	sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
+		 _bfd_int64_low (value));
+#endif
+      else
+	sprintf (buf, "%08lx", (unsigned long) (value & 0xffffffff));
+    }
+}
+
+void
+bfd_elf_fprintf_vma (abfd, stream, value)
+     bfd *abfd;
+     PTR stream;
+     bfd_vma value;
+{
+  Elf_Internal_Ehdr *i_ehdrp;	/* Elf file header, internal form */
+
+  i_ehdrp = elf_elfheader (abfd);
+  if (i_ehdrp == NULL)
+    fprintf_vma ((FILE *) stream, value);
+  else
+    {
+      if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+#if BFD_HOST_64BIT_LONG
+	fprintf ((FILE *) stream, "%016lx", value);
+#else
+	fprintf ((FILE *) stream, "%08lx%08lx",
+		 _bfd_int64_high (value), _bfd_int64_low (value));
+#endif
+      else
+	fprintf ((FILE *) stream, "%08lx",
+		 (unsigned long) (value & 0xffffffff));
+    }
+}

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

* Re: PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma
  2001-08-09  9:03 ` H . J . Lu
@ 2001-08-09  9:27   ` Doug Evans
  2001-08-09  9:48     ` H . J . Lu
  2001-08-10  1:09   ` Maciej W. Rozycki
  1 sibling, 1 reply; 8+ messages in thread
From: Doug Evans @ 2001-08-09  9:27 UTC (permalink / raw)
  To: H . J . Lu; +Cc: Maciej W. Rozycki, binutils

H . J . Lu writes:
 > On Wed, Aug 08, 2001 at 03:06:31PM -0700, H . J . Lu wrote:
 > > 
 > > Here is the first step to implement it. After it is checked in, I will
 > > replace as many sprintf_vma/fprintf_vma with _sprintf_vma/bfd_fprintf_vma
 > > as I can to fix it. Any comments?
 > > 
 > 
 > I checked in the following patch. I am coverting sprintf_vma/fprintf_vma
 > to _sprintf_vma/bfd_fprintf_vma.
 > 
 > 
 > H.J.
 > ----
 > 2001-08-09  H.J. Lu  <hjl@gnu.org>
 > 
 > 	* bfd-in.h (bfd_sprintf_vma): New prototype.
 > 	(bfd_fprintf_vma): Likewise.
 > 	(bfd_elf_sprintf_vma): Likewise.
 > 	(bfd_elf_fprintf_vma): Likewise.
 > 	(bfd_printf_vma): New. Defined with bfd_fprintf_vma.
 > 	* bfd-in2.h: Regenerated.
 > 
 > 	* bfd.c (bfd_sprintf_vma): New. Defined.
 > 	(bfd_fprintf_vma): Likewise.
 > 
 > 	* elf.c (bfd_elf_sprintf_vma): New. Defined.
 > 	(bfd_elf_fprintf_vma): Likewise.

I'm not sure I'd bubble bfd_elf_*printf_vma up to the top.
Why not leave them be internal  implementation details
of bfd_*printf_vma?

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

* Re: PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma
  2001-08-09  9:27   ` Doug Evans
@ 2001-08-09  9:48     ` H . J . Lu
  2001-08-09 14:12       ` H . J . Lu
  0 siblings, 1 reply; 8+ messages in thread
From: H . J . Lu @ 2001-08-09  9:48 UTC (permalink / raw)
  To: Doug Evans; +Cc: Maciej W. Rozycki, binutils

On Thu, Aug 09, 2001 at 09:26:58AM -0700, Doug Evans wrote:
> 
> I'm not sure I'd bubble bfd_elf_*printf_vma up to the top.
> Why not leave them be internal  implementation details
> of bfd_*printf_vma?

You are right. I checked in the following patch.


H.J.
----
2001-08-09  H.J. Lu  <hjl@gnu.org>

	* bfd-in.h (bfd_elf_sprintf_vma, bfd_elf_fprintf_vma): Moved
	to ...
	* elf-bfd.h: Here.
	* bfd-in2.h: Regenerated.

Index: bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.29
diff -u -p -r1.29 bfd-in.h
--- bfd-in.h	2001/08/09 16:00:21	1.29
+++ bfd-in.h	2001/08/09 16:43:15
@@ -185,8 +185,6 @@ typedef unsigned long bfd_size_type;
 
 extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
 extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
-extern void bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
-extern void bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
 
 #define printf_vma(x) fprintf_vma(stdout,x)
 #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
Index: bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.104
diff -u -p -r1.104 bfd-in2.h
--- bfd-in2.h	2001/08/09 16:00:21	1.104
+++ bfd-in2.h	2001/08/09 16:43:24
@@ -185,8 +185,6 @@ typedef unsigned long bfd_size_type;
 
 extern void bfd_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
 extern void bfd_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
-extern void bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
-extern void bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
 
 #define printf_vma(x) fprintf_vma(stdout,x)
 #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
Index: elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.38
diff -u -p -r1.38 elf-bfd.h
--- elf-bfd.h	2001/08/08 13:09:33	1.38
+++ elf-bfd.h	2001/08/09 16:43:31
@@ -999,6 +999,9 @@ extern void bfd_elf_print_symbol PARAMS 
 #define bfd_elf32_print_symbol	bfd_elf_print_symbol
 #define bfd_elf64_print_symbol	bfd_elf_print_symbol
 
+extern void bfd_elf_sprintf_vma PARAMS ((bfd *, char *, bfd_vma));
+extern void bfd_elf_fprintf_vma PARAMS ((bfd *, PTR, bfd_vma));
+
 extern unsigned long bfd_elf_hash PARAMS ((const char *));
 
 extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,

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

* Re: PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma
  2001-08-09  9:48     ` H . J . Lu
@ 2001-08-09 14:12       ` H . J . Lu
  2001-08-10  1:05         ` Alan Modra
  0 siblings, 1 reply; 8+ messages in thread
From: H . J . Lu @ 2001-08-09 14:12 UTC (permalink / raw)
  To: binutils

On Thu, Aug 09, 2001 at 09:48:18AM -0700, H . J . Lu wrote:
> On Thu, Aug 09, 2001 at 09:26:58AM -0700, Doug Evans wrote:
> > 
> > I'm not sure I'd bubble bfd_elf_*printf_vma up to the top.
> > Why not leave them be internal  implementation details
> > of bfd_*printf_vma?
> 
> You are right. I checked in the following patch.
> 

I checked in the following patch so that we can build it on BFD32.


H.J.
----
2001-08-09  H.J. Lu  <hjl@gnu.org>

	* elf.c (bfd_elf_sprintf_vma): Check ELFCLASS64 only in BFD64.
	(bfd_elf_fprintf_vma): Likewise.

--- /tmp/elf.c	Thu Aug  9 13:38:25 2001
+++ ./elf.c	Thu Aug  9 13:40:29 2001
@@ -5993,6 +5993,7 @@ bfd_elf_sprintf_vma (abfd, buf, value)
      char *buf;
      bfd_vma value;
 {
+#ifdef BFD64
   Elf_Internal_Ehdr *i_ehdrp;	/* Elf file header, internal form */
 
   i_ehdrp = elf_elfheader (abfd);
@@ -6010,6 +6011,9 @@ bfd_elf_sprintf_vma (abfd, buf, value)
       else
 	sprintf (buf, "%08lx", (unsigned long) (value & 0xffffffff));
     }
+#else
+  sprintf_vma (buf, value);
+#endif
 }
 
 void
@@ -6018,6 +6022,7 @@ bfd_elf_fprintf_vma (abfd, stream, value
      PTR stream;
      bfd_vma value;
 {
+#ifdef BFD64
   Elf_Internal_Ehdr *i_ehdrp;	/* Elf file header, internal form */
 
   i_ehdrp = elf_elfheader (abfd);
@@ -6036,4 +6041,7 @@ bfd_elf_fprintf_vma (abfd, stream, value
 	fprintf ((FILE *) stream, "%08lx",
 		 (unsigned long) (value & 0xffffffff));
     }
+#else
+  fprintf_vma ((FILE *) stream, value);
+#endif
 }

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

* Re: PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma
  2001-08-09 14:12       ` H . J . Lu
@ 2001-08-10  1:05         ` Alan Modra
  0 siblings, 0 replies; 8+ messages in thread
From: Alan Modra @ 2001-08-10  1:05 UTC (permalink / raw)
  To: binutils

bfd/ChangeLog
	* elf.c (bfd_elf_sprintf_vma): Add ATTRIBUTE_UNUSED to quiet
	warning if not BFD64.  Add braces so emacs auto format works.
	(bfd_elf_fprintf_vma): Likewise.

Applying to mainline.

-- 
Alan Modra

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.78
diff -u -p -r1.78 elf.c
--- elf.c	2001/08/09 21:10:25	1.78
+++ elf.c	2001/08/10 07:42:55
@@ -5997,7 +5997,7 @@ bfd_get_elf_phdrs (abfd, phdrs)
 
 void
 bfd_elf_sprintf_vma (abfd, buf, value)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      char *buf;
      bfd_vma value;
 {
@@ -6010,12 +6010,14 @@ bfd_elf_sprintf_vma (abfd, buf, value)
   else
     {
       if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+	{
 #if BFD_HOST_64BIT_LONG
-	sprintf (buf, "%016lx", value);
+	  sprintf (buf, "%016lx", value);
 #else
-	sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
-		 _bfd_int64_low (value));
+	  sprintf (buf, "%08lx%08lx", _bfd_int64_high (value),
+		   _bfd_int64_low (value));
 #endif
+	}
       else
 	sprintf (buf, "%08lx", (unsigned long) (value & 0xffffffff));
     }
@@ -6026,7 +6028,7 @@ bfd_elf_sprintf_vma (abfd, buf, value)
 
 void
 bfd_elf_fprintf_vma (abfd, stream, value)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      PTR stream;
      bfd_vma value;
 {
@@ -6039,12 +6041,14 @@ bfd_elf_fprintf_vma (abfd, stream, value
   else
     {
       if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
+	{
 #if BFD_HOST_64BIT_LONG
-	fprintf ((FILE *) stream, "%016lx", value);
+	  fprintf ((FILE *) stream, "%016lx", value);
 #else
-	fprintf ((FILE *) stream, "%08lx%08lx",
-		 _bfd_int64_high (value), _bfd_int64_low (value));
+	  fprintf ((FILE *) stream, "%08lx%08lx",
+		   _bfd_int64_high (value), _bfd_int64_low (value));
 #endif
+	}
       else
 	fprintf ((FILE *) stream, "%08lx",
 		 (unsigned long) (value & 0xffffffff));

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

* Re: PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma
  2001-08-09  9:03 ` H . J . Lu
  2001-08-09  9:27   ` Doug Evans
@ 2001-08-10  1:09   ` Maciej W. Rozycki
  2001-08-10  9:38     ` H . J . Lu
  1 sibling, 1 reply; 8+ messages in thread
From: Maciej W. Rozycki @ 2001-08-10  1:09 UTC (permalink / raw)
  To: H . J . Lu; +Cc: binutils

On Thu, 9 Aug 2001, H . J . Lu wrote:

> +void
> +bfd_sprintf_vma (abfd, buf, value)
> +     bfd *abfd;
> +     char *buf;
> +     bfd_vma value;
> +{
> +  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
> +    return bfd_elf_sprintf_vma (abfd, buf, value);
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +  sprintf_vma (buf, value);
> +}

 I don't think returning a value from a void function is the cleanest idea
ever.  Otherwise, I'll check the changes when my time permits.  Thanks. 

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

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

* Re: PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma
  2001-08-10  1:09   ` Maciej W. Rozycki
@ 2001-08-10  9:38     ` H . J . Lu
  0 siblings, 0 replies; 8+ messages in thread
From: H . J . Lu @ 2001-08-10  9:38 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: binutils

On Fri, Aug 10, 2001 at 10:11:20AM +0200, Maciej W. Rozycki wrote:
> On Thu, 9 Aug 2001, H . J . Lu wrote:
> 
> > +void
> > +bfd_sprintf_vma (abfd, buf, value)
> > +     bfd *abfd;
> > +     char *buf;
> > +     bfd_vma value;
> > +{
> > +  if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
> > +    return bfd_elf_sprintf_vma (abfd, buf, value);
>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > +  sprintf_vma (buf, value);
> > +}
> 
>  I don't think returning a value from a void function is the cleanest idea
> ever.  Otherwise, I'll check the changes when my time permits.  Thanks. 

Fixed.


H.J.

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

end of thread, other threads:[~2001-08-10  9:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-08 15:06 PATCH: Add bfd_sprintf_vma/bfd_fprintf_vma H . J . Lu
2001-08-09  9:03 ` H . J . Lu
2001-08-09  9:27   ` Doug Evans
2001-08-09  9:48     ` H . J . Lu
2001-08-09 14:12       ` H . J . Lu
2001-08-10  1:05         ` Alan Modra
2001-08-10  1:09   ` Maciej W. Rozycki
2001-08-10  9:38     ` H . J . Lu

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