On 01/16/18 11:51, Martin Pieuchot wrote:
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.
The patch looks good if you are OK with adding values which are no
longer in spec. IMHO I do not see value in those,
so I would kill everything which is not in spec and does not break
OpenBSD build or any of ports. Related comments 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 */
+
Here, _NONE, _MONTEREY are not in specs. If you insist on them, you may
also use correct defines of specs values
and based on those define no-longer-in-spec values. So I would do:
#define ELFOSABI_SYSV 0
...
#define ELFOSABI_AIX 7
...
/* no longer in spec! */
#define ELFOSABI_NONE ELFOSABI_SYSV
#define ELFOSABI_MONTEREY ELFOSABI_AIX
Besides this _HURD, _86OPEN, _ARM and _STANDALONE are no longer is spec
too.
-/* 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. */
I would add following if you are adding STB_LOOS
+#define STB_HIOS 12 /* End of operating system reserved range. */