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]

Updates to common.h for Oct 4, 1999 Draft of ELF ABI.


Hi Guys,

  Below is a patch to add the new constants defined by the October
  4th, 1999 draft of the ELF ABI spec.  (Which was sent to me by
  H.J. Lu - thanks H.J.)

  Note that there are a couple of conflicts that arise as a result of
  this patch:

    * The new spec defines a value of 10 in the e_machine field of the
      elf header as standing for a little endian MIPS R3000.  We
      currently have this as indicating a big endian MIPS R4000.

    * The new spec has redefined the value for SHT_HIUSER from
      0x8fffffff to 0xffffffff.  I am not sure if this is deliberate
      or a typo, but I have put it in.

    * The new spec defines a new macro ELF32_ST_OTHER which is
      supposed to get at the unused bits in the st_other field of
      the elf symbol structure.  However it defines this macro to be
      the same as the macro ELF32_ST_VISIBILITY which is used to get
      at the *used* bits of the st_other field.  I have taken the
      liberty of correcting the macro definition for ELF32_ST_OTHER.

    * The spec redefines the value of DT_LOOS from 0x60000000 to
      0x6000000d and DT_HIOS from 0x6fffffff to 0x6fff0000.  I have
      ignored both of these redefinitions.

    * The new spec defines the value of the new dynamic section tag
      DT_ENCODING as 32.  However this value conflicts with the
      following definition of the tag DT_PREINIT_ARRAY which also has
      a value of 32.  Since all of the preceeding tags have been in
      ascending numerical order, and since no tag was assigned the
      value of 31, I have assumed that this was a typo, and used the
      value of 31 instead.

  Any objections to my applying this patch ?

Cheers
	Nick


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

	* common.h: Upgrade to match Oct4, 1999 Draft ELF ABI Spec.
	(EM_MIPS_RS3_LE): New machine number.
	(EM_RCE): New machine number.
	(EM_MMA): New machine number.
	(EM_PCP): New machine number.
	(EM_NCPU): New machine number.
	(EM_NDR1): New machine number.
	(EM_STARCORE): New machine number.
	(EM_ME16): New machine number.
	(EM_ST100): New machine number.
	(EM_TINYJ): New machine number.
	(EM_FX66): New machine number.
	(EM_ST9PLUS): New machine number.
	(EM_ST7): New machine number.
	(EM_68HC16): New machine number.
	(EM_68HC11): New machine number.
	(EM_68HC08): New machine number.
	(EM_68HC05): New machine number.
	(EM_SVX): New machine number.
	(EM_VAX): New machine number.
	(PF_MASKOS): Change value.
	(SHT_INIT_ARRAY): New value for sh_type field.
	(SHT_FINI_ARRAY): New value for sh_type field.
	(SHT_PREINIT_ARRAY): New value for sh_type field.
	(SHT_HIUSER): Change value.
	(SHF_MERGE): New valye for sh_flags field.
	(SHF_STRINGS): New valye for sh_flags field.
	(SHF_INFO_LINK): New valye for sh_flags field.
	(SHF_OS_NONCONFORMING): New valye for sh_flags field.
	(SHF_MASKOS): Change value.
	(ELF_ST_VISIBILITY): New macro.
	(ELF_ST_OTHER): New macro.
	(STT_COMMON): New symbol type.
	(STV_DEFAULT): Value for symbol visibility.
	(STV_INTERNAL): Value for symbol visibility.
	(STV_HIDDEN): Value for symbol visibility.
	(STV_PROTECTED): Value for symbol visibility.
	(DT_RUNPATH): New dynamic section tag.
	(DT_FLAGS): New dynamic section tag.
	(DT_ENCODING): New dynamic section tag.
	(DT_PREINIT_ARRAY): New dynamic section tag.
	(DT_PREINIT_ARRAYSZ): New dynamic section tag.
	(DT_LOPROC): New dynamic section tag index.
	(DT_HIPROC): New dynamic section tag index.
	(DF_ORIGIN): Value for dynamic section flag.
	(DF_SYMBOLIC): Value for dynamic section flag.
	(DF_TEXTREL): Value for dynamic section flag.
	(DF_BIND_NOW): Value for dynamic section flag.

Index: include/elf/common.h
===================================================================
RCS file: /cvs/binutils/binutils/include/elf/common.h,v
retrieving revision 1.6
diff -p -r1.6 common.h
*** common.h	1999/12/07 23:51:14	1.6
--- common.h	1999/12/27 21:00:28
*************** Foundation, Inc., 59 Temple Place - Suit
*** 92,99 ****
--- 92,101 ----
  #define EM_MIPS		8	/* MIPS R3000 (officially, big-endian only) */
  #define EM_S370		9	/* Amdahl */
  #define EM_MIPS_RS4_BE 10	/* MIPS R4000 big-endian */
+ #define EM_MIPS_RS3_LE 10	/* MIPS R3000 little-endian (Oct 4 1999 Draft)*/
  
  #define EM_PARISC      15	/* HPPA */
+ 
  #define EM_VPP550      17       /* Fujitsu VPP500 */
  #define EM_SPARC32PLUS 18	/* Sun's "v8plus" */
  #define EM_960         19       /* Intel 80960 */
*************** Foundation, Inc., 59 Temple Place - Suit
*** 104,109 ****
--- 106,112 ----
  #define EM_FR20	       37	/* Fujitsu FR20 */
  #define EM_RH32	       38       /* TRW RH32 */
  #define EM_MCORE       39       /* Motorolla MCore */ /* May also be taken by Fujitsu MMA */
+ #define EM_RCE         39       /* Old name for MCore */
  #define EM_ARM	       40	/* ARM */
  #define EM_OLD_ALPHA   41	/* Digital Alpha */
  #define EM_SH	       42	/* Hitachi SH */
*************** Foundation, Inc., 59 Temple Place - Suit
*** 118,123 ****
--- 121,145 ----
  #define EM_MIPS_X      51       /* Stanford MIPS-X */
  #define EM_COLDFIRE    52       /* Motorola Coldfire */
  #define EM_68HC12      53       /* Motorola M68HC12 */
+ #define EM_MMA	       54	/* Fujitsu Multimedia Accelerator */
+ #define EM_PCP	       55	/* Siemens PCP */
+ #define EM_NCPU	       56	/* Sony nCPU embedded RISC processor */
+ #define EM_NDR1	       57	/* Denso NDR1 microprocesspr */
+ #define EM_STARCORE    58	/* Motorola Star*Core processor */
+ #define EM_ME16	       59	/* Toyota ME16 processor */
+ #define EM_ST100       60	/* STMicroelectronics ST100 processor */
+ #define EM_TINYJ       61	/* Advanced Logic Corp. TinyJ embedded processor */
+ 
+ #define EM_FX66	       66	/* Siemens FX66 microcontroller */
+ #define EM_ST9PLUS     67	/* STMicroelectronics ST9+ 8/16 bit microcontroller */
+ #define EM_ST7	       68	/* STMicroelectronics ST7 8-bit microcontroller */
+ #define EM_68HC16      69	/* Motorola MC68HC16 Microcontroller */
+ #define EM_68HC11      70	/* Motorola MC68HC11 Microcontroller */
+ #define EM_68HC08      71	/* Motorola MC68HC08 Microcontroller */
+ #define EM_68HC05      72	/* Motorola MC68HC05 Microcontroller */
+ #define EM_SVX         73	/* Silicon Graphics SVx */
+ #define EM_ST19        74	/* STMicroelectronics ST19 8-bit microcontroller */
+ #define EM_VAX         75	/* Digital VAX */
  
  #define EM_PJ          99       /* picoJava */
  
*************** Foundation, Inc., 59 Temple Place - Suit
*** 191,197 ****
  #define PF_X		(1 << 0)	/* Segment is executable */
  #define PF_W		(1 << 1)	/* Segment is writable */
  #define PF_R		(1 << 2)	/* Segment is readable */
! #define PF_MASKOS	0x0F000000	/* OS-specific reserved bits */
  #define PF_MASKPROC	0xF0000000	/* Processor-specific reserved bits */
  
  /* Values for section header, sh_type field */
--- 213,220 ----
  #define PF_X		(1 << 0)	/* Segment is executable */
  #define PF_W		(1 << 1)	/* Segment is writable */
  #define PF_R		(1 << 2)	/* Segment is readable */
! /* #define PF_MASKOS	0x0F000000    *//* OS-specific reserved bits */
! #define PF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
  #define PF_MASKPROC	0xF0000000	/* Processor-specific reserved bits */
  
  /* Values for section header, sh_type field */
*************** Foundation, Inc., 59 Temple Place - Suit
*** 209,214 ****
--- 232,241 ----
  #define SHT_SHLIB	10		/* Reserved, unspecified semantics */
  #define SHT_DYNSYM	11		/* Dynamic linking symbol table */
  
+ #define SHT_INIT_ARRAY  14		/* Array of pointers to init functions */
+ #define SHT_FINI_ARRAY  15		/* Array of pointers to finish functions */
+ #define SHT_PREINIT_ARRAY 16		/* Array of pointers to pre-init functions */
+ 
  #define SHT_LOOS        0x60000000      /* Operating system specific semantics, lo */
  #define SHT_HIOS        0x6fffffff      /* Operating system specific semantics, hi */
  
*************** Foundation, Inc., 59 Temple Place - Suit
*** 226,239 ****
  #define SHT_LOPROC	0x70000000	/* Processor-specific semantics, lo */
  #define SHT_HIPROC	0x7FFFFFFF	/* Processor-specific semantics, hi */
  #define SHT_LOUSER	0x80000000	/* Application-specific semantics */
! #define SHT_HIUSER	0x8FFFFFFF	/* Application-specific semantics */
  
  /* Values for section header, sh_flags field */
  
  #define SHF_WRITE	(1 << 0)	/* Writable data during execution */
  #define SHF_ALLOC	(1 << 1)	/* Occupies memory during execution */
  #define SHF_EXECINSTR	(1 << 2)	/* Executable machine instructions */
! #define SHF_MASKOS	0x0F000000	/* OS-specific semantics */
  #define SHF_MASKPROC	0xF0000000	/* Processor-specific semantics */
  
  /* Values of note segment descriptor types for core files. */
--- 253,274 ----
  #define SHT_LOPROC	0x70000000	/* Processor-specific semantics, lo */
  #define SHT_HIPROC	0x7FFFFFFF	/* Processor-specific semantics, hi */
  #define SHT_LOUSER	0x80000000	/* Application-specific semantics */
! /* #define SHT_HIUSER	0x8FFFFFFF    *//* Application-specific semantics */
! #define SHT_HIUSER	0xFFFFFFFF	/* New value, defined in Oct 4, 1999 Draft */
  
  /* Values for section header, sh_flags field */
  
  #define SHF_WRITE	(1 << 0)	/* Writable data during execution */
  #define SHF_ALLOC	(1 << 1)	/* Occupies memory during execution */
  #define SHF_EXECINSTR	(1 << 2)	/* Executable machine instructions */
! #define SHF_MERGE	(1 << 4)	/* Data in this section can be merged */
! #define SHF_STRINGS	(1 << 5)	/* Contains null terminated character strings */
! #define SHF_INFO_LINK	(1 << 6)	/* sh_info holds section header table index */
! #define SHF_LINK_ORDER  (1 << 7)	/* Preserve section ordering when linking */
! #define SHF_OS_NONCONFORMING (1 << 8)	/* OS specifci processing required */
! 
! /* #define SHF_MASKOS	0x0F000000    *//* OS-specific semantics */
! #define SHF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
  #define SHF_MASKPROC	0xF0000000	/* Processor-specific semantics */
  
  /* Values of note segment descriptor types for core files. */
*************** Foundation, Inc., 59 Temple Place - Suit
*** 242,249 ****
  #define NT_FPREGSET	2		/* Contains copy of fpregset struct */
  #define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */
  #define NT_TASKSTRUCT	4		/* Contains copy of task struct */
! #define NT_PRXFPREG     0x46e62b7f	/* Contains a user_xfpregs_struct;
! 					   note name must be "LINUX".  */
  
  /* Note segments for core files on dir-style procfs systems. */
  
--- 277,284 ----
  #define NT_FPREGSET	2		/* Contains copy of fpregset struct */
  #define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */
  #define NT_TASKSTRUCT	4		/* Contains copy of task struct */
! #define NT_PRXFPREG     0x46e62b7f	/* Contains a user_xfpregs_struct; */
! 					/*   note name must be "LINUX".  */
  
  /* Note segments for core files on dir-style procfs systems. */
  
*************** Foundation, Inc., 59 Temple Place - Suit
*** 266,271 ****
--- 301,327 ----
  #define ELF_ST_TYPE(val)		((val) & 0xF)
  #define ELF_ST_INFO(bind,type)		(((bind) << 4) + ((type) & 0xF))
  
+ /* The 64bit and 32bit versions of these macros are identical, but
+    the ELF spec defines them, so here they are.  */
+ #define ELF32_ST_BIND  ELF_ST_BIND
+ #define ELF32_ST_TYPE  ELF_ST_TYPE
+ #define ELF32_ST_INFO  ELF_ST_INFO
+ #define ELF64_ST_BIND  ELF_ST_BIND
+ #define ELF64_ST_TYPE  ELF_ST_TYPE
+ #define ELF64_ST_INFO  ELF_ST_INFO
+ 
+ /* These two macros disassemble and assemble a symbol's visibility into
+    the st_other field.  The STV_ defines specificy the actual visibility.  */
+ 
+ #define ELF_ST_VISIBILITY(v)		((v) & 0x3)
+ #define ELF_ST_OTHER(o)			((o) & ~0x3)
+ 
+ #define ELF32_ST_VISIBILITY  ELF_ST_VISIBILITY
+ #define ELF32_ST_OTHER       ELF_ST_OTHER
+ #define ELF64_ST_VISIBILITY  ELF_ST_VISIBILITY
+ #define ELF64_ST_OTHER       ELF_ST_OTHER
+ 
+ 
  #define STN_UNDEF	0		/* undefined symbol index */
  
  #define STB_LOCAL	0		/* Symbol not visible outside obj */
*************** Foundation, Inc., 59 Temple Place - Suit
*** 281,286 ****
--- 337,343 ----
  #define STT_FUNC	2		/* Symbol is a code object */
  #define STT_SECTION	3		/* Symbol associated with a section */
  #define STT_FILE	4		/* Symbol gives a file name */
+ #define STT_COMMON	5		/* An uninitialised common block */
  #define STT_LOOS        10		/* OS-specific semantics */
  #define STT_HIOS        12		/* OS-specific semantics */
  #define STT_LOPROC	13		/* Application-specific semantics */
*************** Foundation, Inc., 59 Temple Place - Suit
*** 299,304 ****
--- 356,370 ----
  #define SHN_COMMON	0xFFF2		/* Associated symbol is in common */
  #define SHN_HIRESERVE	0xFFFF		/* End range of reserved indices */
  
+ /* The following constants control how a symbol may be accessed once it has
+    become part of an executable or shared library.  */
+ 					   
+ #define STV_DEFAULT	0		/* Visibility is specified by binding type */
+ #define STV_INTERNAL	1		/* OS specific version of STV_HIDDEN */
+ #define STV_HIDDEN	2		/* Can only be seen inside currect component */
+ #define STV_PROTECTED	3		/* Treat as STB_LOCAL inside current component */
+ 					   
+ 
  /* relocation info handling macros */
  
  #define ELF32_R_SYM(i)		((i) >> 8)
*************** Foundation, Inc., 59 Temple Place - Suit
*** 340,349 ****
  #define DT_FINI_ARRAY   26
  #define DT_INIT_ARRAYSZ 27
  #define DT_FINI_ARRAYSZ 28
  
- #define DT_LOOS         0x60000000
- #define DT_HIOS         0x6fffffff
- 
  /* The next four dynamic tags are used on Solaris.  We support them
     everywhere.  */
  #define DT_VALRNGLO	0x6ffffd00
--- 406,422 ----
  #define DT_FINI_ARRAY   26
  #define DT_INIT_ARRAYSZ 27
  #define DT_FINI_ARRAYSZ 28
+ #define DT_RUNPATH      29
+ #define DT_FLAGS        30
+ #define DT_ENCODING     31 /* Note: Oct 4, 1999 Draft specifies this as 32, but this conflicts with DT_PREINIT_ARRAY */
+ #define DT_PREINIT_ARRAY 32
+ #define DT_PREINIT_ARRAYSZ 33
+ 
+ #define DT_LOOS         0x60000000 /* Note: Oct 4, 1999 draft has this as 0x6fff000d */
+ #define DT_HIOS         0x6fffffff /* Note: Oct 4, 1999 draft has this as 0x6fff0000 */
+ #define DT_LOPROC       0x70000000
+ #define DT_HIPROC       0x7fffffff
  
  /* The next four dynamic tags are used on Solaris.  We support them
     everywhere.  */
  #define DT_VALRNGLO	0x6ffffd00
*************** Foundation, Inc., 59 Temple Place - Suit
*** 400,405 ****
--- 473,484 ----
  #define DF_1_DIRECT	0x00000100
  #define DF_1_TRANS	0x00000200
  #define DF_1_INTERPOSE	0x00000400
+ 
+ /* Flag values for the DT_FLAGS entry.  */
+ #define DF_ORIGIN	(1 << 0)
+ #define DF_SYMBOLIC	(1 << 1)
+ #define DF_TEXTREL	(1 << 2)
+ #define DF_BIND_NOW	(1 << 3)
  
  /* These constants are used for the version number of a Elf32_Verdef
     structure.  */

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