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


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 ?

Cheers
	Nick

1999-12-03  Nick Clifton  <nickc@cygnus.com>

	* readelf.c (enum print_mode): New type.
	(print_vma): New function.
	(dump_relocations): Use print_vma to display bfd_vma values.
	(process_file_header): Use print_vma to display bfd_vma values.
	(process_program_headers): Use print_vma to display bfd_vma values.
	(process_section_headers): Use print_vma to display bfd_vma values.
	(dynamic_segment_parisc_val): Use print_vma to display bfd_vma values.
	(process_dynamic_segment): Use print_vma to display bfd_vma values.
	(process_symbol_table): Use print_vma to display bfd_vma values.
	(process_mips_specific): Use print_vma to display bfd_vma values.

Index: readelf.c
===================================================================
RCS file: /cvs/binutils/binutils/binutils/readelf.c,v
retrieving revision 1.29
diff -p -r1.29 readelf.c
*** readelf.c	1999/11/25 11:08:25	1.29
--- readelf.c	1999/12/03 15:13:17
*************** static const char *       get_osabi_name
*** 201,207 ****
  static int		  guess_is_rela               PARAMS ((unsigned long));
  static char * 		  get_note_type		         PARAMS ((unsigned int));
  static int		  process_note		         PARAMS ((Elf32_Internal_Note *));
! static int		  process_corefile_note_segment  PARAMS ((FILE *, unsigned long, unsigned long));
  static int		  process_corefile_note_segments PARAMS ((FILE *));
  static int 		  process_corefile_contents	 PARAMS ((FILE *));
  
--- 201,207 ----
  static int		  guess_is_rela               PARAMS ((unsigned long));
  static char * 		  get_note_type		         PARAMS ((unsigned int));
  static int		  process_note		         PARAMS ((Elf32_Internal_Note *));
! static int		  process_corefile_note_segment  PARAMS ((FILE *, bfd_vma, bfd_vma));
  static int		  process_corefile_note_segments PARAMS ((FILE *));
  static int 		  process_corefile_contents	 PARAMS ((FILE *));
  
*************** byte_get_little_endian (field, size)
*** 378,383 ****
--- 378,474 ----
      }
  }
  
+ /* Print a VMA value.  */
+ typedef enum print_mode
+ {
+   HEX,
+   DEC,
+   DEC_5,
+   UNSIGNED,
+   PREFIX_HEX,
+   FULL_HEX,
+   LONG_HEX
+ }
+ print_mode;
+ 
+ static void print_vma PARAMS ((bfd_vma, print_mode));
+ 
+ static void
+ print_vma (vma, mode)
+      bfd_vma vma;
+      print_mode mode;
+ {
+ #ifdef BFD64
+   if (is_32bit_elf)
+ #endif
+     {
+       switch (mode)
+ 	{
+ 	case FULL_HEX: printf ("0x"); /* drop through */
+ 	case LONG_HEX: printf ("%08.8lx", 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;
+ 	}
+     }
+ #ifdef BFD64
+   else
+     {
+       switch (mode)
+ 	{
+ 	case FULL_HEX:
+ 	  printf ("0x");
+ 	  /* drop through */
+ 	  
+ 	case LONG_HEX:
+ 	  printf_vma (vma);
+ 	  break;
+ 	  
+ 	case PREFIX_HEX:
+ 	  printf ("0x");
+ 	  /* drop through */
+ 	  
+ 	case HEX:
+ #if BFD_HOST_64BIT_LONG
+ 	  printf ("%lx", vma);
+ #else
+ 	  if (_bfd_int64_high (vma))
+ 	    printf ("%lx%lx", _bfd_int64_high (vma), _bfd_int64_low (vma));
+ 	  else
+ 	    printf ("%lx", _bfd_int64_low (vma));
+ #endif
+ 	  break;
+ 
+ 	case DEC:
+ 	  if (_bfd_int64_high (vma))
+ 	    /* ugg */
+ 	    printf ("++%ld", _bfd_int64_low (vma));
+ 	  else
+ 	    printf ("%ld", _bfd_int64_low (vma));
+ 	  break;
+ 
+ 	case DEC_5:
+ 	  if (_bfd_int64_high (vma))
+ 	    /* ugg */
+ 	    printf ("++%ld", _bfd_int64_low (vma));
+ 	  else
+ 	    printf ("%5ld", _bfd_int64_low (vma));
+ 	  break;
+ 	  
+ 	case UNSIGNED:
+ 	  if (_bfd_int64_high (vma))
+ 	    /* ugg */
+ 	    printf ("++%lu", _bfd_int64_low (vma));
+ 	  else
+ 	    printf ("%lu", _bfd_int64_low (vma));
+ 	  break;
+ 	}
+     }
+ #endif
+ }
+ 
  static bfd_vma
  byte_get_big_endian (field, size)
       unsigned char * field;
*************** dump_relocations (file, rel_offset, rel_
*** 772,778 ****
  
  		  psym = symtab + symtab_index;
  
! 		  printf (" %08lx  ", (unsigned long) psym->st_value);
  
  		  if (psym->st_name == 0)
  		    printf ("%-25.25s",
--- 863,871 ----
  
  		  psym = symtab + symtab_index;
  
! 		  printf (" ");
! 		  print_vma (psym->st_value, LONG_HEX);
! 		  printf ("  ");
  
  		  if (psym->st_name == 0)
  		    printf ("%-25.25s",
*************** dump_relocations (file, rel_offset, rel_
*** 788,794 ****
  	    }
  	}
        else if (is_rela)
! 	printf ("%34c%lx", ' ', (unsigned long) relas[i].r_addend);
  
        if (elf_header.e_machine == EM_SPARCV9
  	  && !strcmp (rtype, "R_SPARC_OLO10"))
--- 881,890 ----
  	    }
  	}
        else if (is_rela)
! 	{
! 	  printf ("%*c", is_32bit_elf ? 34 : 26, ' ');
! 	  print_vma (relas[i].r_addend, LONG_HEX);
! 	}
  
        if (elf_header.e_machine == EM_SPARCV9
  	  && !strcmp (rtype, "R_SPARC_OLO10"))
*************** process_file_header ()
*** 1828,1839 ****
  	      get_machine_name (elf_header.e_machine));
        printf (_("  Version:                           0x%lx\n"),
  	      (unsigned long) elf_header.e_version);
!       printf (_("  Entry point address:               0x%lx\n"),
! 	      (unsigned long) elf_header.e_entry);
!       printf (_("  Start of program headers:          %ld (bytes into file)\n"),
! 	      (long) elf_header.e_phoff);
!       printf (_("  Start of section headers:          %ld (bytes into file)\n"),
! 	      (long) elf_header.e_shoff);
        printf (_("  Flags:                             0x%lx%s\n"),
  	      (unsigned long) elf_header.e_flags,
  	      get_machine_flags (elf_header.e_flags, elf_header.e_machine));
--- 1924,1938 ----
  	      get_machine_name (elf_header.e_machine));
        printf (_("  Version:                           0x%lx\n"),
  	      (unsigned long) elf_header.e_version);
!       
!       printf (_("  Entry point address:               "));
!       print_vma ((bfd_vma) elf_header.e_entry, PREFIX_HEX);
!       printf (_("\n  Start of program headers:          "));
!       print_vma ((bfd_vma) elf_header.e_phoff, DEC);
!       printf (_(" (bytes into file)\n  Start of section headers:          "));
!       print_vma ((bfd_vma) elf_header.e_shoff, DEC);
!       printf (_(" (bytes into file)\n"));
! 	
        printf (_("  Flags:                             0x%lx%s\n"),
  	      (unsigned long) elf_header.e_flags,
  	      get_machine_flags (elf_header.e_flags, elf_header.e_machine));
*************** process_program_headers (file)
*** 1938,1947 ****
  
    if (do_segments && !do_header)
      {
!       printf (_("\nElf file is %s\n"), get_file_type (elf_header.e_type));
!       printf (_("Entry point 0x%lx\n"), (unsigned long) elf_header.e_entry);
!       printf (_("There are %d program headers, starting at offset %lx:\n"),
! 	      elf_header.e_phnum, (unsigned long) elf_header.e_phoff);
      }
  
    program_headers = (Elf_Internal_Phdr *) malloc
--- 2037,2049 ----
  
    if (do_segments && !do_header)
      {
!       printf (_("\nElf file type is %s\n"), get_file_type (elf_header.e_type));
!       printf (_("Entry point "));
!       print_vma ((bfd_vma) elf_header.e_entry, PREFIX_HEX);
!       printf (_("\nThere are %d program headers, starting at offset "),
! 	      elf_header.e_phnum);
!       print_vma ((bfd_vma) elf_header.e_phoff, DEC);
!       printf ("\n");
      }
  
    program_headers = (Elf_Internal_Phdr *) malloc
*************** process_program_headers (file)
*** 1968,1975 ****
      {
        printf
  	(_("\nProgram Header%s:\n"), elf_header.e_phnum > 1 ? "s" : "");
!       printf
! 	(_("  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align\n"));
      }
  
    loadaddr = -1;
--- 2070,2086 ----
      {
        printf
  	(_("\nProgram Header%s:\n"), elf_header.e_phnum > 1 ? "s" : "");
!       
!       if (is_32bit_elf)
! 	printf
! 	  (_("  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align\n"));
!       else
! 	{
! 	  printf
! 	    (_("  Type           Offset             VirtAddr           PhysAddr\n"));
! 	  printf
! 	    (_("                 FileSiz            MemSiz              Flags  Align\n"));
! 	}
      }
  
    loadaddr = -1;
*************** process_program_headers (file)
*** 1983,1998 ****
        if (do_segments)
  	{
  	  printf ("  %-14.14s ", get_segment_type (segment->p_type));
! 	  printf ("0x%6.6lx ", (unsigned long) segment->p_offset);
! 	  printf ("0x%8.8lx ", (unsigned long) segment->p_vaddr);
! 	  printf ("0x%8.8lx ", (unsigned long) segment->p_paddr);
! 	  printf ("0x%5.5lx ", (unsigned long) segment->p_filesz);
! 	  printf ("0x%5.5lx ", (unsigned long) segment->p_memsz);
! 	  printf ("%c%c%c ",
! 		  (segment->p_flags & PF_R ? 'R' : ' '),
! 		  (segment->p_flags & PF_W ? 'W' : ' '),
! 		  (segment->p_flags & PF_X ? 'E' : ' '));
! 	  printf ("%#lx", (unsigned long) segment->p_align);
  	}
  
        switch (segment->p_type)
--- 2094,2130 ----
        if (do_segments)
  	{
  	  printf ("  %-14.14s ", get_segment_type (segment->p_type));
! 
! 	  if (is_32bit_elf)
! 	    {
! 	      printf ("0x%6.6lx ", (unsigned long) segment->p_offset);
! 	      printf ("0x%8.8lx ", (unsigned long) segment->p_vaddr);
! 	      printf ("0x%8.8lx ", (unsigned long) segment->p_paddr);
! 	      printf ("0x%5.5lx ", (unsigned long) segment->p_filesz);
! 	      printf ("0x%5.5lx ", (unsigned long) segment->p_memsz);
! 	      printf ("%c%c%c ",
! 		      (segment->p_flags & PF_R ? 'R' : ' '),
! 		      (segment->p_flags & PF_W ? 'W' : ' '),
! 		      (segment->p_flags & PF_X ? 'E' : ' '));
! 	      printf ("%#lx", (unsigned long) segment->p_align);
! 	    }
! 	  else
! 	    {
! 	      print_vma (segment->p_offset, FULL_HEX);
! 	      putchar (' ');
! 	      print_vma (segment->p_vaddr, FULL_HEX);
! 	      putchar (' ');
! 	      print_vma (segment->p_paddr, FULL_HEX);
! 	      printf ("\n                 ");
! 	      print_vma (segment->p_filesz, FULL_HEX);
! 	      putchar (' ');
! 	      print_vma (segment->p_memsz, FULL_HEX);
! 	      printf ("  %c%c%c    ",
! 		      (segment->p_flags & PF_R ? 'R' : ' '),
! 		      (segment->p_flags & PF_W ? 'W' : ' '),
! 		      (segment->p_flags & PF_X ? 'E' : ' '));
! 	      print_vma (segment->p_align, HEX);
! 	    }
  	}
  
        switch (segment->p_type)
*************** process_program_headers (file)
*** 2012,2018 ****
  	  break;
  
  	case PT_INTERP:
! 	  if (fseek (file, segment->p_offset, SEEK_SET))
  	    error (_("Unable to find program interpreter name\n"));
  	  else
  	    {
--- 2144,2150 ----
  	  break;
  
  	case PT_INTERP:
! 	  if (fseek (file, (long) segment->p_offset, SEEK_SET))
  	    error (_("Unable to find program interpreter name\n"));
  	  else
  	    {
*************** process_section_headers (file)
*** 2343,2350 ****
      return 1;
  
    printf (_("\nSection Header%s:\n"), elf_header.e_shnum > 1 ? "s" : "");
!   printf
!     (_("  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al\n"));
  
    for (i = 0, section = section_headers;
         i < elf_header.e_shnum;
--- 2475,2488 ----
      return 1;
  
    printf (_("\nSection Header%s:\n"), elf_header.e_shnum > 1 ? "s" : "");
!   if (is_32bit_elf)
!     printf
!       (_("  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al\n"));
!   else
!     {
!       printf (_("  [Nr] Name              Type             Address           Offset\n"));
!       printf (_("       Size              EntSize          Flags  Link  Info  Align\n"));
!     }
  
    for (i = 0, section = section_headers;
         i < elf_header.e_shnum;
*************** process_section_headers (file)
*** 2355,2373 ****
  	      SECTION_NAME (section),
  	      get_section_type_name (section->sh_type));
  
!       printf ( "%8.8lx %6.6lx %6.6lx %2.2lx",
! 	       (unsigned long) section->sh_addr,
! 	       (unsigned long) section->sh_offset,
! 	       (unsigned long) section->sh_size,
! 	       (unsigned long) section->sh_entsize);
! 
!       printf (" %c%c%c %2ld %3lx %ld\n",
! 	      (section->sh_flags & SHF_WRITE ? 'W' : ' '),
! 	      (section->sh_flags & SHF_ALLOC ? 'A' : ' '),
! 	      (section->sh_flags & SHF_EXECINSTR ? 'X' : ' '),
! 	      (unsigned long) section->sh_link,
! 	      (unsigned long) section->sh_info,
! 	      (unsigned long) section->sh_addralign);
      }
  
    return 1;
--- 2493,2535 ----
  	      SECTION_NAME (section),
  	      get_section_type_name (section->sh_type));
  
!       if (is_32bit_elf)
! 	{
! 	  print_vma (section->sh_addr, LONG_HEX);
!       
! 	  printf ( " %6.6lx %6.6lx %2.2lx",
! 		   (unsigned long) section->sh_offset,
! 		   (unsigned long) section->sh_size,
! 		   (unsigned long) section->sh_entsize);
! 	  
! 	  printf (" %c%c%c %2ld %3lx %ld\n",
! 		  (section->sh_flags & SHF_WRITE ? 'W' : ' '),
! 		  (section->sh_flags & SHF_ALLOC ? 'A' : ' '),
! 		  (section->sh_flags & SHF_EXECINSTR ? 'X' : ' '),
! 		  (unsigned long) section->sh_link,
! 		  (unsigned long) section->sh_info,
! 		  (unsigned long) section->sh_addralign);
! 	}
!       else
! 	{
! 	  putchar (' ');
! 	  print_vma (section->sh_addr, LONG_HEX);
! 	  printf ("  %08.8lx", section->sh_offset);
! 	  printf ("\n       ");
! 	  print_vma (section->sh_size, LONG_HEX);
! 	  printf ("  ");
! 	  print_vma (section->sh_entsize, LONG_HEX);
! 	  
! 	  printf (" %c%c%c",
! 		  (section->sh_flags & SHF_WRITE ? 'W' : ' '),
! 		  (section->sh_flags & SHF_ALLOC ? 'A' : ' '),
! 		  (section->sh_flags & SHF_EXECINSTR ? 'X' : ' '));
! 	  
! 	  printf ("     %2ld   %3lx     %ld\n",
! 		  (unsigned long) section->sh_link,
! 		  (unsigned long) section->sh_info,
! 		  (unsigned long) section->sh_addralign);
! 	}
      }
  
    return 1;
*************** dynamic_segment_parisc_val (entry)
*** 2601,2607 ****
  	  };
  	int first = 1;
  	int cnt;
! 	long int val = entry->d_un.d_val;
  
  	for (cnt = 0; cnt < sizeof (flags) / sizeof (flags[0]); ++cnt)
  	  if (val & flags[cnt].bit)
--- 2763,2769 ----
  	  };
  	int first = 1;
  	int cnt;
! 	bfd_vma val = entry->d_un.d_val;
  
  	for (cnt = 0; cnt < sizeof (flags) / sizeof (flags[0]); ++cnt)
  	  if (val & flags[cnt].bit)
*************** dynamic_segment_parisc_val (entry)
*** 2613,2625 ****
               val ^= flags[cnt].bit;
             }
  	if (val != 0 || first)
! 	  printf ("%s%#lx", first ? "" : " ", val);
! 	puts ("");
        }
        break;
  
      default:
!       printf ("%#lx\n", (long) entry->d_un.d_ptr);
      }
  }
  
--- 2775,2791 ----
               val ^= flags[cnt].bit;
             }
  	if (val != 0 || first)
! 	  {
! 	    if (! first)
! 	      putchar (' ');
! 	    print_vma (val, HEX);
! 	  }
        }
        break;
  
      default:
!       print_vma (entry->d_un.d_ptr, PREFIX_HEX);
!       break;
      }
  }
  
*************** process_dynamic_segment (file)
*** 2866,2876 ****
         i++, entry ++)
      {
        if (do_dynamic)
! 	printf (_("  0x%-8.8lx (%s)%*s"),
! 		(unsigned long) entry->d_tag,
! 		get_dynamic_type (entry->d_tag),
! 		27 - strlen (get_dynamic_type (entry->d_tag)),
! 		" ");
  
        switch (entry->d_tag)
  	{
--- 3032,3045 ----
         i++, entry ++)
      {
        if (do_dynamic)
! 	{
! 	  putchar (' ');
! 	  print_vma (entry->d_tag, FULL_HEX);
! 	  printf (" (%s)%*s",
! 		  get_dynamic_type (entry->d_tag),
! 		  (is_32bit_elf ? 27 : 19) - strlen (get_dynamic_type (entry->d_tag)),
! 		  " ");
! 	}
  
        switch (entry->d_tag)
  	{
*************** process_dynamic_segment (file)
*** 2886,2892 ****
  	      if (dynamic_strings)
  		printf (": [%s]\n", dynamic_strings + entry->d_un.d_val);
  	      else
! 		printf (": %#lx\n", (long) entry->d_un.d_val);
  	    }
  	  break;
  
--- 3055,3065 ----
  	      if (dynamic_strings)
  		printf (": [%s]\n", dynamic_strings + entry->d_un.d_val);
  	      else
! 		{
! 		  printf (": ");
! 		  print_vma (entry->d_un.d_val, PREFIX_HEX);
! 		  putchar ('\n');
! 		}
  	    }
  	  break;
  
*************** process_dynamic_segment (file)
*** 3047,3072 ****
  		    case DT_NEEDED:
  		      printf (_("Shared library: [%s]"), name);
  
! 		      if (strcmp (name, program_interpreter))
! 			printf ("\n");
! 		      else
! 			printf (_(" program interpreter\n"));
  		      break;
  
  		    case DT_SONAME:
! 		      printf (_("Library soname: [%s]\n"), name);
  		      break;
  
  		    case DT_RPATH:
! 		      printf (_("Library rpath: [%s]\n"), name);
  		      break;
  
  		    default:
! 		      printf ("%#lx\n", (long) entry->d_un.d_val);
  		    }
  		}
  	      else
! 		printf ("%#lx\n", (long) entry->d_un.d_val);
  	    }
  	  break;
  
--- 3220,3246 ----
  		    case DT_NEEDED:
  		      printf (_("Shared library: [%s]"), name);
  
! 		      if (strcmp (name, program_interpreter) == 0)
! 			printf (_(" program interpreter"));
  		      break;
  
  		    case DT_SONAME:
! 		      printf (_("Library soname: [%s]"), name);
  		      break;
  
  		    case DT_RPATH:
! 		      printf (_("Library rpath: [%s]"), name);
  		      break;
  
  		    default:
! 		      print_vma (entry->d_un.d_val, PREFIX_HEX);
! 		      break;
  		    }
  		}
  	      else
! 		print_vma (entry->d_un.d_val, PREFIX_HEX);
! 
! 	      putchar ('\n');
  	    }
  	  break;
  
*************** process_dynamic_segment (file)
*** 3083,3089 ****
  	case DT_INIT_ARRAYSZ:
  	case DT_FINI_ARRAYSZ:
  	  if (do_dynamic)
! 	    printf ("%lu (bytes)\n", (unsigned long) entry->d_un.d_val);
  	  break;
  
  	case DT_VERDEFNUM:
--- 3257,3266 ----
  	case DT_INIT_ARRAYSZ:
  	case DT_FINI_ARRAYSZ:
  	  if (do_dynamic)
! 	    {
! 	      print_vma (entry->d_un.d_val, UNSIGNED);
! 	      printf (" (bytes)\n");
! 	    }
  	  break;
  
  	case DT_VERDEFNUM:
*************** process_dynamic_segment (file)
*** 3091,3097 ****
  	case DT_RELACOUNT:
  	case DT_RELCOUNT:
  	  if (do_dynamic)
! 	    printf ("%lu\n", (unsigned long) entry->d_un.d_val);
  	  break;
  
  	case DT_SYMINSZ:
--- 3268,3277 ----
  	case DT_RELACOUNT:
  	case DT_RELCOUNT:
  	  if (do_dynamic)
! 	    {
! 	      print_vma (entry->d_un.d_val, UNSIGNED);
! 	      putchar ('\n');
! 	    }
  	  break;
  
  	case DT_SYMINSZ:
*************** process_dynamic_segment (file)
*** 3115,3121 ****
  		    }
  		}
  
! 	      printf ("%#lx\n", (long) entry->d_un.d_val);
  	    }
  	  break;
  
--- 3295,3302 ----
  		    }
  		}
  
! 	      print_vma (entry->d_un.d_val, PREFIX_HEX);
! 	      putchar ('\n');
  	    }
  	  break;
  
*************** process_dynamic_segment (file)
*** 3140,3146 ****
  		  dynamic_segment_parisc_val (entry);
  		  break;
  		default:
! 		  printf ("%#lx\n", (long) entry->d_un.d_ptr);
  		}
  	    }
  	  break;
--- 3321,3328 ----
  		  dynamic_segment_parisc_val (entry);
  		  break;
  		default:
! 		  print_vma (entry->d_un.d_val, PREFIX_HEX);
! 		  putchar ('\n');
  		}
  	    }
  	  break;
*************** process_symbol_table (file)
*** 3844,3866 ****
        int    si;
  
        printf (_("\nSymbol table for image:\n"));
!       printf (_("  Num Buc:    Value  Size   Type   Bind Ot Ndx Name\n"));
  
        for (hn = 0; hn < nbuckets; hn++)
  	{
  	  if (! buckets [hn])
  	    continue;
  
! 	  for (si = buckets [hn]; si; si = chains [si])
  	    {
  	      Elf_Internal_Sym * psym;
  
  	      psym = dynamic_symbols + si;
  
! 	      printf ("  %3d %3d: %8lx %5ld %6s %6s %2d ",
! 		      si, hn,
! 		      (unsigned long) psym->st_value,
! 		      (unsigned long) psym->st_size,
  		      get_symbol_type (ELF_ST_TYPE (psym->st_info)),
  		      get_symbol_binding (ELF_ST_BIND (psym->st_info)),
  		      psym->st_other);
--- 4026,4053 ----
        int    si;
  
        printf (_("\nSymbol table for image:\n"));
!       if (is_32bit_elf)
! 	printf (_("  Num Buc:    Value  Size   Type   Bind Ot Ndx Name\n"));
!       else
! 	printf (_("  Num Buc:    Value          Size   Type   Bind Ot Ndx Name\n"));
  
        for (hn = 0; hn < nbuckets; hn++)
  	{
  	  if (! buckets [hn])
  	    continue;
  
! 	  for (si = buckets [hn]; si < nchains && si > 0; si = chains [si])
  	    {
  	      Elf_Internal_Sym * psym;
  
  	      psym = dynamic_symbols + si;
  
! 	      printf ("  %3d %3d: ", si, hn);
! 	      print_vma (psym->st_value, LONG_HEX);
! 	      putchar (' ' );
! 	      print_vma (psym->st_size,  DEC_5);
! 		      
! 	      printf ("  %6s %6s %2d ",
  		      get_symbol_type (ELF_ST_TYPE (psym->st_info)),
  		      get_symbol_binding (ELF_ST_BIND (psym->st_info)),
  		      psym->st_other);
*************** process_symbol_table (file)
*** 3892,3899 ****
  	  printf (_("\nSymbol table '%s' contains %lu entries:\n"),
  		  SECTION_NAME (section),
  		  (unsigned long) (section->sh_size / section->sh_entsize));
! 	  fputs (_("  Num:    Value  Size Type    Bind   Ot  Ndx Name\n"),
! 		 stdout);
  
  	  symtab = GET_ELF_SYMBOLS (file, section->sh_offset,
  				    section->sh_size / section->sh_entsize);
--- 4079,4088 ----
  	  printf (_("\nSymbol table '%s' contains %lu entries:\n"),
  		  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"));
! 	  else
! 	    printf (_("  Num:    Value          Size Type    Bind   Ot  Ndx Name\n"));
  
  	  symtab = GET_ELF_SYMBOLS (file, section->sh_offset,
  				    section->sh_size / section->sh_entsize);
*************** process_symbol_table (file)
*** 3916,3925 ****
  	       si < section->sh_size / section->sh_entsize;
  	       si ++, psym ++)
  	    {
! 	      printf ("  %3d: %8lx %5ld %-7s %-6s %2d ",
! 		      si,
! 		      (unsigned long) psym->st_value,
! 		      (unsigned long) psym->st_size,
  		      get_symbol_type (ELF_ST_TYPE (psym->st_info)),
  		      get_symbol_binding (ELF_ST_BIND (psym->st_info)),
  		      psym->st_other);
--- 4105,4115 ----
  	       si < section->sh_size / section->sh_entsize;
  	       si ++, psym ++)
  	    {
! 	      printf ("  %3d: ", si);
! 	      print_vma (psym->st_value, LONG_HEX);
! 	      putchar (' ');
! 	      print_vma (psym->st_size, DEC_5);
! 	      printf (" %-7s %-6s %2d ",
  		      get_symbol_type (ELF_ST_TYPE (psym->st_info)),
  		      get_symbol_binding (ELF_ST_BIND (psym->st_info)),
  		      psym->st_other);
*************** process_symbol_table (file)
*** 4090,4100 ****
  	  if (! buckets [hn])
  	    continue;
  
! 	  for (si = buckets[hn]; si; si = chains[si])
  	    {
! 	      ++nsyms;
  	      if (maxlength < ++lengths[hn])
! 		++maxlength;
  	    }
  	}
  
--- 4280,4290 ----
  	  if (! buckets [hn])
  	    continue;
  
! 	  for (si = buckets[hn]; si > 0 && si < nchains; si = chains[si])
  	    {
! 	      ++ nsyms;
  	      if (maxlength < ++lengths[hn])
! 		++ maxlength;
  	    }
  	}
  
*************** process_mips_specific (file)
*** 6570,6581 ****
  	{
  	  Elf_Internal_Sym * psym = &dynamic_symbols[iconf[cnt]];
  
! 	  printf ("%5u: %8lu  %#10lx  %s\n",
! 		  cnt, iconf[cnt], (unsigned long) psym->st_value,
! 		  dynamic_strings + psym->st_name);
  	}
  
- 
        free (iconf);
      }
  
--- 6760,6770 ----
  	{
  	  Elf_Internal_Sym * psym = &dynamic_symbols[iconf[cnt]];
  
! 	  printf ("%5u: %8lu  ", cnt, iconf[cnt]);
! 	  print_vma (psym->st_value, FULL_HEX);
! 	  printf ("  %s\n", dynamic_strings + psym->st_name);
  	}
  
        free (iconf);
      }
  
*************** process_note (pnote)
*** 6624,6631 ****
  static int
  process_corefile_note_segment (file, offset, length)
       FILE * file;
!      unsigned long offset;
!      unsigned long length;
  {
    Elf_External_Note *  pnotes;
    Elf_External_Note *  external;
--- 6813,6820 ----
  static int
  process_corefile_note_segment (file, offset, length)
       FILE * file;
!      bfd_vma offset;
!      bfd_vma length;
  {
    Elf_External_Note *  pnotes;
    Elf_External_Note *  external;
*************** process_corefile_note_segments (file)
*** 6726,6733 ****
      {
        if (segment->p_type == PT_NOTE)
  	res &= process_corefile_note_segment (file,
! 					      (unsigned long)segment->p_offset,
! 					      (unsigned long)segment->p_filesz);
      }
  
    free (program_headers);
--- 6915,6922 ----
      {
        if (segment->p_type == PT_NOTE)
  	res &= process_corefile_note_segment (file,
! 					      (bfd_vma)segment->p_offset,
! 					      (bfd_vma)segment->p_filesz);
      }
  
    free (program_headers);

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