Update readelf to know about the new ELF constants

Nick Clifton nickc@redhat.com
Wed Nov 22 15:49:00 GMT 2000


Hi Guys,

  New numbers in common.h means new strings in readelf.c, so here they
  are.  I have also tweaked the -S output a teeny bit (for 32-bit
  binaries) so that the layout is slightly nicer for 80 column
  terminals.

Cheers
	Nick

2000-11-22  Nick Clifton  <nickc@redhat.com>

	* readelf.c (get_machine_name): Add EM_JAVELIN, EM_FIREPATH,
	EM_ZSP, EM_MMIX, EM_HUANY, EM_PRISM.
	(get_section_type_name): Add SHT_GROUP and SHT_SYMTAB_SHNDX.
	(get_elf_section_flags: Add SHF_GROUP.
	(process_section_headers): Adjust output for 32-bit binaries
	to look nice on an 80 column terminal.

Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src//src/binutils/readelf.c,v
retrieving revision 1.73
diff -p -r1.73 readelf.c
*** readelf.c	2000/11/20 23:47:41	1.73
--- readelf.c	2000/11/22 23:43:37
*************** get_machine_name (e_machine)
*** 1261,1266 ****
--- 1261,1273 ----
      case EM_VAX:      	return "Digital VAX";
      case EM_AVR:              return "Atmel AVR 8-bit microcontroller";
      case EM_CRIS:		return "Axis Communications 32-bit embedded processor";
+     case EM_JAVELIN:     	return "Infineon Technologies 32-bit embedded cpu";
+     case EM_FIREPATH:    	return "Element 14 64-bit DSP processor";
+     case EM_ZSP:         	return "LSI Logic's 16-bit DSP processor";
+     case EM_MMIX:	        return "Donald Knuth's educational 64-bit processor";
+     case EM_HUANY:       	return "Harvard Universitys's machine-independent object format";
+     case EM_PRISM:       	return "SiTera Prism";
+       
      default:
        sprintf (buff, _("<unknown>: %x"), e_machine);
        return buff;
*************** get_section_type_name (sh_type)
*** 1742,1747 ****
--- 1749,1756 ----
      case SHT_INIT_ARRAY:	return "INIT_ARRAY";
      case SHT_FINI_ARRAY:	return "FINI_ARRAY";
      case SHT_PREINIT_ARRAY:	return "PREINIT_ARRAY";
+     case SHT_GROUP:		return "GROUP";
+     case SHT_SYMTAB_SHNDX:	return "SYMTAB SECTION INDICIES";
      case SHT_GNU_verdef:	return "VERDEF";
      case SHT_GNU_verneed:	return "VERNEED";
      case SHT_GNU_versym:	return "VERSYM";
*************** get_elf_section_flags (sh_flags)
*** 2622,2627 ****
--- 2631,2637 ----
  	case SHF_INFO_LINK:        strcat (buff, "I"); break;
  	case SHF_LINK_ORDER:       strcat (buff, "L"); break;
  	case SHF_OS_NONCONFORMING: strcat (buff, "O"); break;
+ 	case SHF_GROUP:            strcat (buff, "G"); break;
  
  	default:
  	  if (flag & SHF_MASKOS)
*************** process_section_headers (file)
*** 2772,2778 ****
  
  	  printf (" %3s ", get_elf_section_flags (section->sh_flags));
  
! 	  printf (" %2ld %3lx %ld\n",
  		  (unsigned long) section->sh_link,
  		  (unsigned long) section->sh_info,
  		  (unsigned long) section->sh_addralign);
--- 2782,2788 ----
  
  	  printf (" %3s ", get_elf_section_flags (section->sh_flags));
  
! 	  printf ("%2ld %3lx %2ld\n",
  		  (unsigned long) section->sh_link,
  		  (unsigned long) section->sh_info,
  		  (unsigned long) section->sh_addralign);
*************** process_section_headers (file)
*** 2796,2804 ****
  	}
      }
  
!   printf (_("Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings)\n"));
!   printf (_("              I (info), L (link order), O (extra OS processing required)\n"));
!   printf (_("              o (os specific), p (processor specific) x (unknown)\n"));
  
    return 1;
  }
--- 2806,2815 ----
  	}
      }
  
!   printf (_("Key to Flags:\n"));
!   printf (_("  W (write), A (alloc), X (execute), M (merge), S (strings)\n"));
!   printf (_("  I (info), L (link order), G (group), x (unknown)\n"));
!   printf (_("  O (extra OS processing required) o (OS specific), p (processor specific)\n"));
  
    return 1;
  }




More information about the Binutils mailing list