This is the mail archive of the binutils@sources.redhat.com 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]

PATCH: Use Replace printf_vma with bfd_printf_vma.


I'd like to check this patch shortly.


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

	* nm.c (print_value): Add one arg, bfd *.
	(print_value): Replace fprintf_vma with bfd_fprintf_vma.
	(print_symbol_info_bsd): Also pass `abfd' to print_value ().
	(print_symbol_info_sysv): Likewise.
	(print_symbol_info_posix): Likewise.

	* objdump.c (dump_section_header): Replace printf_vma with
	bfd_printf_vma.
	(print_section_stabs): Likewise.
	(dump_bfd_header): Likewise.
	(objdump_print_value): Replace sprintf_vma with
	bfd_sprintf_vma.
	(disassemble_bytes): Likewise.
	(dump_reloc_set): Likewise.

Index: binutils/nm.c
===================================================================
RCS file: /work/cvs/gnu/binutils/binutils/nm.c,v
retrieving revision 1.16
diff -u -p -r1.16 nm.c
--- binutils/nm.c	2001/04/13 18:47:25	1.16
+++ binutils/nm.c	2001/08/09 20:15:22
@@ -152,7 +152,7 @@ print_symbol_filename_posix PARAMS ((bfd
 
 
 static void
-print_value PARAMS ((bfd_vma));
+print_value PARAMS ((bfd *, bfd_vma));
 
 static void
 print_symbol_info_bsd PARAMS ((symbol_info * info, bfd * abfd));
@@ -1438,7 +1438,8 @@ print_symbol_filename_posix (archive_bfd
 /* Print a symbol value.  */
 
 static void
-print_value (val)
+print_value (abfd, val)
+     bfd *abfd;
      bfd_vma val;
 {
 #if ! defined (BFD64) || BFD_HOST_64BIT_LONG
@@ -1446,7 +1447,7 @@ print_value (val)
 #else
   /* We have a 64 bit value to print, but the host is only 32 bit.  */
   if (print_radix == 16)
-    fprintf_vma (stdout, val);
+    bfd_fprintf_vma (abfd, stdout, val);
   else
     {
       char buf[30];
@@ -1481,7 +1482,7 @@ print_symbol_info_bsd (info, abfd)
       printf ("        ");
     }
   else
-    print_value (info->value);
+    print_value (abfd, info->value);
   printf (" %c", info->type);
   if (info->type == '-')
     {
@@ -1504,7 +1505,7 @@ print_symbol_info_sysv (info, abfd)
   if (bfd_is_undefined_symclass (info->type))
     printf ("        ");	/* Value */
   else
-    print_value (info->value);
+    print_value (abfd, info->value);
   printf ("|   %c  |", info->type);	/* Class */
   if (info->type == '-')
     {
@@ -1527,7 +1528,7 @@ print_symbol_info_posix (info, abfd)
   if (bfd_is_undefined_symclass (info->type))
     printf ("        ");
   else
-    print_value (info->value);
+    print_value (abfd, info->value);
   /* POSIX.2 wants the symbol size printed here, when applicable;
      BFD currently doesn't provide it, so we take the easy way out by
      considering it to never be applicable.  */
Index: binutils/objdump.c
===================================================================
RCS file: /work/cvs/gnu/binutils/binutils/objdump.c,v
retrieving revision 1.32
diff -u -p -r1.32 objdump.c
--- binutils/objdump.c	2001/08/04 00:17:46	1.32
+++ binutils/objdump.c	2001/08/09 20:15:22
@@ -346,9 +346,9 @@ dump_section_header (abfd, section, igno
   printf ("%3d %-13s %08lx  ", section->index,
 	  bfd_get_section_name (abfd, section),
 	  (unsigned long) bfd_section_size (abfd, section) / opb);
-  printf_vma (bfd_get_section_vma (abfd, section));
+  bfd_printf_vma (abfd, bfd_get_section_vma (abfd, section));
   printf ("  ");
-  printf_vma (section->lma);
+  bfd_printf_vma (abfd, section->lma);
   printf ("  %08lx  2**%u", section->filepos,
 	  bfd_get_section_alignment (abfd, section));
   if (! wide_output)
@@ -670,8 +670,10 @@ objdump_print_value (vma, info, skip_zer
 {
   char buf[30];
   char *p;
+  struct objdump_disasm_info *aux
+    = (struct objdump_disasm_info *) info->application_data;
 
-  sprintf_vma (buf, vma);
+  bfd_sprintf_vma (aux->abfd, buf, vma);
   if (! skip_zeroes)
     p = buf;
   else
@@ -1281,8 +1283,10 @@ disassemble_bytes (info, disassemble_fn,
       char buf[30];
       char *s;
 
-      sprintf_vma (buf, section->vma + 
-                   bfd_section_size (section->owner, section) / opb);
+      bfd_sprintf_vma
+	(aux->abfd, buf,
+	 (section->vma
+	  + bfd_section_size (section->owner, section) / opb));
       s = buf;
       while (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0'
 	     && s[4] == '0')
@@ -1344,7 +1348,7 @@ disassemble_bytes (info, disassemble_fn,
 	    {
 	      char *s;
 
-	      sprintf_vma (buf, section->vma + addr_offset);
+	      bfd_sprintf_vma (aux->abfd, buf, section->vma + addr_offset);
 	      for (s = buf + skip_addr_chars; *s == '0'; s++)
 		*s = ' ';
 	      if (*s == '\0')
@@ -1481,7 +1485,7 @@ disassemble_bytes (info, disassemble_fn,
 		  putchar ('\n');
 		  j = addr_offset * opb + pb;
 
-		  sprintf_vma (buf, section->vma + j / opb);
+		  bfd_sprintf_vma (aux->abfd, buf, section->vma + j / opb);
 		  for (s = buf + skip_addr_chars; *s == '0'; s++)
 		    *s = ' ';
 		  if (*s == '\0')
@@ -2008,7 +2012,7 @@ print_section_stabs (abfd, stabsect_name
       else
 	printf ("%-6d", type);
       printf (" %-6d %-6d ", other, desc);
-      printf_vma (value);
+      bfd_printf_vma (abfd, value);
       printf (" %-6lu", strx);
 
       /* Symbols with type == 0 (N_UNDF) specify the length of the
@@ -2092,7 +2096,7 @@ dump_bfd_header (abfd)
   PF (D_PAGED, "D_PAGED");
   PF (BFD_IS_RELAXABLE, "BFD_IS_RELAXABLE");
   printf (_("\nstart address 0x"));
-  printf_vma (abfd->start_address);
+  bfd_printf_vma (abfd, abfd->start_address);
   printf ("\n");
 }
 
@@ -2541,7 +2545,7 @@ dump_reloc_set (abfd, sec, relpp, relcou
     if (width == 0)
       {
 	char buf[30];
-	sprintf_vma (buf, (bfd_vma) -1);
+	bfd_sprintf_vma (abfd, buf, (bfd_vma) -1);
 	width = strlen (buf) - 7;
       }
     printf ("OFFSET %*s TYPE %*s VALUE \n", width, "", 12, "");
@@ -2609,7 +2613,7 @@ dump_reloc_set (abfd, sec, relpp, relcou
 	}
       if (sym_name)
 	{
-	  printf_vma (q->address);
+	  bfd_printf_vma (abfd, q->address);
 	  if (q->howto->name)
 	    printf (" %-16s  ", q->howto->name);
 	  else
@@ -2621,7 +2625,7 @@ dump_reloc_set (abfd, sec, relpp, relcou
 	{
 	  if (section_name == (CONST char *) NULL)
 	    section_name = "*unknown*";
-	  printf_vma (q->address);
+	  bfd_printf_vma (abfd, q->address);
 	  printf (" %-16s  [%s]",
 		  q->howto->name,
 		  section_name);
@@ -2629,7 +2633,7 @@ dump_reloc_set (abfd, sec, relpp, relcou
       if (q->addend)
 	{
 	  printf ("+0x");
-	  printf_vma (q->addend);
+	  bfd_printf_vma (abfd, q->addend);
 	}
       printf ("\n");
     }


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