glibc/sysdeps
Mihailo Stojanovic 23c1c256ae MIPS support for GNU hash
This patch is a reimplementation of [1], which was submitted back in
2015. Copyright issue has been sorted [2] last year. It proposed a new
section (.gnu.xhash) and related dynamic tag (GT_GNU_XHASH). The new
section would be virtually identical to the existing .gnu.hash except
for the translation table (xlat) which would contain correct MIPS
.dynsym indexes corresponding to the hashvals in chains. This is because
MIPS ABI imposes a different ordering of the dynsyms than the one
expected by the .gnu.hash section. Another addition would be a leading
word at the beggining of the section, which would contain the number of
entries in the translation table.

In this patch, the new section name and dynamic tag are changed to
reflect the fact that the section should be treated as MIPS specific
(.MIPS.xhash and DT_MIPS_XHASH).

This patch addresses the alignment issue reported in [3] which is caused
by the leading word of the .MIPS.xhash section. Leading word is now
removed in the corresponding binutils patch, and the number of entries
in the translation table is computed using DT_MIPS_SYMTABNO dynamic tag.

Since the MIPS specific dl-lookup.c file was removed following the
initial patch submission, I opted for the definition of three new macros
in the generic ldsodefs.h. ELF_MACHINE_GNU_HASH_ADDRIDX defines the
index of the dynamic tag in the l_info array. ELF_MACHINE_HASH_SYMIDX is
used to calculate the index of a symbol in GNU hash. On MIPS, it is
defined to look up the symbol index in the translation table.
ELF_MACHINE_XHASH_SETUP is defined for MIPS only. It initializes the
.MIPS.xhash pointer in the link_map_machine struct.

The other major change is bumping the highest EI_ABIVERSION value for
MIPS to suggest that the dynamic linker now supports GNU hash.

The patch was tested by running the glibc testsuite for the three MIPS
ABIs (o32, n32 and n64) and for x86_64-linux-gnu.

[1] https://sourceware.org/ml/binutils/2015-10/msg00057.html
[2] https://sourceware.org/ml/binutils/2018-03/msg00025.html
[3] https://sourceware.org/ml/binutils/2016-01/msg00006.html

	* elf/dl-addr.c (determine_info): Calculate the symbol index
	using the newly defined ELF_MACHINE_HASH_SYMIDX macro.
	* elf/dl-lookup.c (do_lookup_x): Ditto.
	(_dl_setup_hash): Initialize MIPS xhash translation table.
	* elf/elf.h (SHT_MIPS_XHASH): New define.
	(DT_MIPS_XHASH): New define.
	* sysdeps/generic/ldsodefs.h (ELF_MACHINE_GNU_HASH_ADDRIDX): New
	define.
	(ELF_MACHINE_HASH_SYMIDX): Ditto.
	(ELF_MACHINE_XHASH_SETUP): Ditto.
	* sysdeps/mips/ldsodefs.h (ELF_MACHINE_GNU_HASH_ADDRIDX): New
	define.
	(ELF_MACHINE_HASH_SYMIDX): Ditto.
	(ELF_MACHINE_XHASH_SETUP): Ditto.
	* sysdeps/mips/linkmap.h (struct link_map_machine): New member.
	* sysdeps/unix/sysv/linux/mips/ldsodefs.h: Increment valid ABI
	version.
	* sysdeps/unix/sysv/linux/mips/libc-abis: New ABI version.
2019-08-29 20:11:42 +00:00
..
aarch64 aarch64: Disable using DC ZVA in emag memset 2019-08-14 10:58:21 +08:00
alpha Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
arm arm: Split BE/LE abilist 2019-08-29 09:58:21 -03:00
csky Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
generic MIPS support for GNU hash 2019-08-29 20:11:42 +00:00
gnu login: Add nonstring attributes to struct utmp, struct utmpx [BZ #24899] 2019-08-15 16:09:43 +02:00
hppa Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
htl hurd: advertise *_setpshared as not supported 2019-01-02 22:21:34 +01:00
hurd Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
i386 Update i386 libm-test-ulps 2019-08-20 17:06:02 +02:00
ia64 Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
ieee754 Make totalorder and totalordermag functions take pointer arguments. 2019-08-15 15:18:34 +00:00
init_array Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
m68k Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
mach Refactor sigcontextinfo.h 2019-08-23 11:30:56 -03:00
microblaze microblaze: Split BE/LE abilist 2019-08-29 09:58:27 -03:00
mips MIPS support for GNU hash 2019-08-29 20:11:42 +00:00
nios2 Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
nptl nptl: Move pthread_attr_setdetachstate implementation into libc 2019-08-28 12:01:14 +02:00
posix Refactor sigcontextinfo.h 2019-08-23 11:30:56 -03:00
powerpc [powerpc] fegetenv_status: simplify instruction generation 2019-08-28 13:53:09 -05:00
pthread nptl: Add POSIX-proposed sem_clockwait 2019-07-12 13:36:23 +00:00
riscv Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
s390 Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
sh sh: Split BE/LE abilist 2019-08-29 09:58:31 -03:00
sparc Fix spellings of contributor names in comments and doc 2019-08-23 13:11:05 -07:00
unix MIPS support for GNU hash 2019-08-29 20:11:42 +00:00
wordsize-32 Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
wordsize-64 Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
x86 Declare most TS 18661-1 interfaces for C2X. 2019-08-13 11:28:51 +00:00
x86_64 x86-64: Compile branred.c with -mprefer-vector-width=128 [BZ #24603] 2019-07-24 14:48:43 -07:00