This is the mail archive of the binutils@sourceware.cygnus.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]

Re: readelf doesn't support ELF64 on 32bit host


On Fri, Dec 03, 1999 at 03:17:12PM +0000, Nick Clifton wrote:
> Hi Guys,
> 
>   What do you think of this version of the patch to provide readelf
>   with the ability to display the contenst of the 64bit ELF file on a
>   32 bit host?  I think this patch is ready for application.  It now
>   covers most of the places where bfd_vma's were being treated as
>   unsigned longs, (and any others that are left over can be handled by
>   future patches).  It implements a new function to print a bfd_vma
>   value, and it reformts the output for ELF64 files to cope with the
>   larger numbers.
> 
>   OK to apply ?
> 

I like this patch. Here is a small patch for compiler warnings.
Also it supports up to 999999 symbols from 999 symbols.


Thanks.


H.J.
---
--- readelf.c.nick	Sat Dec  4 14:15:54 1999
+++ readelf.c	Sat Dec  4 14:29:23 1999
@@ -405,12 +405,12 @@ print_vma (vma, mode)
       switch (mode)
 	{
 	case FULL_HEX: printf ("0x"); /* drop through */
-	case LONG_HEX: printf ("%08.8lx", vma); break;
+	case LONG_HEX: printf ("%8.8lx", (unsigned long) vma); break;
 	case PREFIX_HEX: printf ("0x"); /* drop through */
-	case HEX: printf ("%lx", vma); break;
-	case DEC: printf ("%ld", vma); break;
-	case DEC_5: printf ("%5ld", vma); break;
-	case UNSIGNED: printf ("%lu", vma); break;
+	case HEX: printf ("%lx", (unsigned long) vma); break;
+	case DEC: printf ("%ld", (unsigned long) vma); break;
+	case DEC_5: printf ("%5ld", (unsigned long) vma); break;
+	case UNSIGNED: printf ("%lu", (unsigned long) vma); break;
 	}
     }
 #ifdef BFD64
@@ -2503,7 +2503,7 @@ process_section_headers (file)
 	{
 	  putchar (' ');
 	  print_vma (section->sh_addr, LONG_HEX);
-	  printf ("  %08.8lx", section->sh_offset);
+	  printf ("  %8.8lx", section->sh_offset);
 	  printf ("\n       ");
 	  print_vma (section->sh_size, LONG_HEX);
 	  printf ("  ");
@@ -2751,7 +2751,7 @@ dynamic_segment_parisc_val (entry)
 	    { DT_HP_BIND_DEPTH_FIRST, "HP_BIND_DEPTH_FIRST" }
 	  };
 	int first = 1;
-	int cnt;
+	size_t cnt;
 	bfd_vma val = entry->d_un.d_val;
 
 	for (cnt = 0; cnt < sizeof (flags) / sizeof (flags[0]); ++cnt)
@@ -3970,7 +3970,7 @@ process_symbol_table (file)
   char   nb [4];
   char   nc [4];
   int    nbuckets = 0;
-  int    nchains;
+  int    nchains = 0;
   int *  buckets = NULL;
   int *  chains = NULL;
 
@@ -4069,9 +4069,9 @@ process_symbol_table (file)
 		  SECTION_NAME (section),
 		  (unsigned long) (section->sh_size / section->sh_entsize));
 	  if (is_32bit_elf)
-	    printf (_("  Num:    Value  Size Type    Bind   Ot  Ndx Name\n"));
+	    printf (_("   Num:    Value  Size Type    Bind   Ot  Ndx Name\n"));
 	  else
-	    printf (_("  Num:    Value          Size Type    Bind   Ot  Ndx Name\n"));
+	    printf (_("   Num:    Value          Size Type    Bind   Ot  Ndx Name\n"));
 
 	  symtab = GET_ELF_SYMBOLS (file, section->sh_offset,
 				    section->sh_size / section->sh_entsize);
@@ -4094,7 +4094,7 @@ process_symbol_table (file)
 	       si < section->sh_size / section->sh_entsize;
 	       si ++, psym ++)
 	    {
-	      printf ("  %3d: ", si);
+	      printf ("%6d: ", si);
 	      print_vma (psym->st_value, LONG_HEX);
 	      putchar (' ');
 	      print_vma (psym->st_size, DEC_5);

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