On 15/01/18(Mon) 23:11, Karel Gardas wrote:
> patch below defines SHT_SYMTAB_SHNDX which is required for usage of 
> SHN_XINDEX which got added/defined during October 2017 by mpi.
> 
> See: http://www.sco.com/developers/gabi/latest/ch4.sheader.html:
> 
> SHT_SYMTAB_SHNDX
>     This section is associated with a symbol table section and is required if 
> any of the section header indexes referenced by that symbol table contain the 
> escape value SHN_XINDEX. The section is an array of Elf32_Word values. Each 
> value corresponds one to one with a symbol table entry and appear in the same 
> order as those entries. The values represent the section header indexes 
> against which the symbol table entries are defined. Only if the corresponding 
> symbol table entry's st_shndx field contains the escape value SHN_XINDEX will 
> the matching Elf32_Word hold the actual section header index; otherwise, the 
> entry must be SHN_UNDEF (0).

Thanks, I took some time to pull more of the defines included in
FreeBSD's r153502 where SHT_SYMTAB_SHNDX got introduced.  I'd like to
commit the diff below.

Index: sys/sys/exec_elf.h
===================================================================
RCS file: /cvs/src/sys/sys/exec_elf.h,v
retrieving revision 1.78
diff -u -p -r1.78 exec_elf.h
--- sys/sys/exec_elf.h  9 Dec 2017 06:35:08 -0000       1.78
+++ sys/sys/exec_elf.h  16 Jan 2018 10:48:02 -0000
@@ -99,22 +99,27 @@ typedef __uint16_t  Elf64_Quarter;
 #define ELFDATANUM     3               /* number of data encode defines */
 
 /* e_ident[] Operating System/ABI */
-#define ELFOSABI_SYSV          0       /* UNIX System V ABI */
+#define ELFOSABI_NONE          0       /* UNIX System V ABI */
 #define ELFOSABI_HPUX          1       /* HP-UX operating system */
 #define ELFOSABI_NETBSD                2       /* NetBSD */
 #define ELFOSABI_LINUX         3       /* GNU/Linux */
 #define ELFOSABI_HURD          4       /* GNU/Hurd */
 #define ELFOSABI_86OPEN                5       /* 86Open common IA32 ABI */
 #define ELFOSABI_SOLARIS       6       /* Solaris */
-#define ELFOSABI_MONTEREY      7       /* Monterey */
+#define ELFOSABI_AIX           7       /* AIX */
 #define ELFOSABI_IRIX          8       /* IRIX */
 #define ELFOSABI_FREEBSD       9       /* FreeBSD */
 #define ELFOSABI_TRU64         10      /* TRU64 UNIX */
 #define ELFOSABI_MODESTO       11      /* Novell Modesto */
 #define ELFOSABI_OPENBSD       12      /* OpenBSD */
+#define ELFOSABI_OPENVMS       13      /* Open VMS */
+#define ELFOSABI_NSK           14      /* HP Non-Stop Kernel */
 #define ELFOSABI_ARM           97      /* ARM */
 #define ELFOSABI_STANDALONE    255     /* Standalone (embedded) application */
 
+#define ELFOSABI_SYSV          ELFOSABI_NONE   /* symbol used in old spec */
+#define ELFOSABI_MONTEREY      ELFOSABI_AIX    /* Monterey */
+
 /* e_ident */
 #define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
                       (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
@@ -164,8 +169,10 @@ typedef struct {
 #define ET_DYN         3               /* shared object file */
 #define ET_CORE                4               /* core file */
 #define ET_NUM         5               /* number of types */
-#define ET_LOPROC      0xff00          /* reserved range for processor */
-#define ET_HIPROC      0xffff          /*  specific e_type */
+#define ET_LOOS                0xfe00          /* First operating system 
specific. */
+#define ET_HIOS                0xfeff          /* Last operating 
system-specific. */
+#define ET_LOPROC      0xff00          /* First processor-specific. */
+#define ET_HIPROC      0xffff          /*  Last processor-specific. */
 
 /* e_machine */
 #define EM_NONE                0               /* No Machine */
@@ -241,25 +248,31 @@ typedef struct {
 #define SHN_LORESERVE  0xff00          /* lower bounds of reserved indexes */
 #define SHN_LOPROC     0xff00          /* reserved range for processor */
 #define SHN_HIPROC     0xff1f          /*   specific section indexes */
+#define SHN_LOOS       0xff20          /* First operating system-specific. */
+#define SHN_HIOS       0xff3f          /* Last operating system-specific. */
 #define SHN_ABS                0xfff1          /* absolute value */
 #define SHN_COMMON     0xfff2          /* common symbol */
 #define SHN_XINDEX     0xffff          /* Escape -- index stored elsewhere. */
 #define SHN_HIRESERVE  0xffff          /* upper bounds of reserved indexes */
 
 /* sh_type */
-#define SHT_NULL       0               /* inactive */
-#define SHT_PROGBITS   1               /* program defined information */
-#define SHT_SYMTAB     2               /* symbol table section */
-#define SHT_STRTAB     3               /* string table section */
-#define SHT_RELA       4               /* relocation section with addends*/
-#define SHT_HASH       5               /* symbol hash table section */
-#define SHT_DYNAMIC    6               /* dynamic section */
-#define SHT_NOTE       7               /* note section */
-#define SHT_NOBITS     8               /* no space section */
-#define SHT_REL                9               /* relation section without 
addends */
-#define SHT_SHLIB      10              /* reserved - purpose unknown */
-#define SHT_DYNSYM     11              /* dynamic symbol table section */
-#define SHT_NUM                12              /* number of section types */
+#define SHT_NULL               0       /* inactive */
+#define SHT_PROGBITS           1       /* program defined information */
+#define SHT_SYMTAB             2       /* symbol table section */
+#define SHT_STRTAB             3       /* string table section */
+#define SHT_RELA               4       /* relocation section with addends*/
+#define SHT_HASH               5       /* symbol hash table section */
+#define SHT_DYNAMIC            6       /* dynamic section */
+#define SHT_NOTE               7       /* note section */
+#define SHT_NOBITS             8       /* no space section */
+#define SHT_REL                        9       /* relation section without 
addends */
+#define SHT_SHLIB              10      /* reserved - purpose unknown */
+#define SHT_DYNSYM             11      /* dynamic symbol table section */
+#define SHT_INIT_ARRAY         14      /* Initialization function pointers. */
+#define SHT_FINI_ARRAY         15      /* Termination function pointers. */
+#define SHT_PREINIT_ARRAY      16      /* Pre-initialization function ptrs. */
+#define SHT_GROUP              17      /* Section group. */
+#define SHT_SYMTAB_SHNDX       18      /* Section indexes (see SHN_XINDEX). */
 #define SHT_LOPROC     0x70000000      /* reserved range for processor */
 #define SHT_HIPROC     0x7fffffff      /*  specific section header types */
 #define SHT_LOUSER     0x80000000      /* reserved range for application */
@@ -338,15 +351,16 @@ typedef struct {
 #define ELF64_ST_TYPE(x)       (((unsigned int) x) & 0xf)
 #define ELF64_ST_INFO(b,t)     (((b) << 4) + ((t) & 0xf))
 
-/* Symbol Binding - ELF32_ST_BIND - st_info */
+/* Symbol Binding - ELFNN_ST_BIND - st_info */
 #define STB_LOCAL      0               /* Local symbol */
 #define STB_GLOBAL     1               /* Global symbol */
 #define STB_WEAK       2               /* like global - lower precedence */
 #define STB_NUM                3               /* number of symbol bindings */
+#define STB_LOOS       10      /* Start of operating system reserved range. */
 #define STB_LOPROC     13              /* reserved range for processor */
 #define STB_HIPROC     15              /*  specific symbol bindings */
 
-/* Symbol type - ELF32_ST_TYPE - st_info */
+/* Symbol type - ELFNN_ST_TYPE - st_info */
 #define STT_NOTYPE     0               /* not specified */
 #define STT_OBJECT     1               /* data object */
 #define STT_FUNC       2               /* function */

Reply via email to