glibc/sysdeps/generic
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
..
net Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
netinet Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
nfs Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
sys Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
_G_config.h Post-cleanup 2: minimize _G_config.h. 2018-02-07 10:10:32 -05:00
_itoa.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
a.out.h
abort-instr.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
adaptive_spin_count.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
aio_misc.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
allocalim.h
asm-syntax.h
atomic-machine.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
c++-types.data
confstr.h
device-nrs.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dirstream.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-cache.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-dtprocnum.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-dtv.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-fcntl.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-fileid.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-fptr.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-hash.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-irel.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-librecon.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-lookupcfg.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-machine.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-mman.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-osinfo.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-procinfo.c
dl-procinfo.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-procruntime.c ld.so: Add architecture specific fields 2017-11-13 08:02:52 -08:00
dl-prop.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-sysdep.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dl-tls.h
dl-unistd.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
dwarf2.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
elide.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
eloop-threshold.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
entry.h
errqueue.h
exit-thread.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
fd_to_filename.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
fenv_private.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
fips-private.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
fix-fp-int-compare-invalid.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
fix-fp-int-convert-overflow.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
fix-int-fp-convert-zero.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
float128-abi.h Move some float128 symbol version definitions. 2017-10-16 22:04:42 +00:00
fork.h
fpu_control.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
framestate.c Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
gcc-compat.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
gccframe.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
get-rounding-mode.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
gmp-mparam.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
hp-timing-common.h Refactor hp-timing rtld usage 2019-03-22 17:30:44 -03:00
hp-timing.h Add generic hp-timing support 2019-03-22 17:30:44 -03:00
ifreq.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
ifunc-init.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
ifunc-sel.h
internal-signals.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
intr-msg.h
ld.abilist
ldbl-classify-compat.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
ldconfig.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
ldsodefs.h MIPS support for GNU hash 2019-08-29 20:11:42 +00:00
libanl.abilist
libBrokenLocale.abilist
libc-lock.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
libc-mmap.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
libc-start.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
libc-tsd.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
libc.abilist
libcrypt.abilist
libdl.abilist
libm-alias-double.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
libm-alias-float128.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
libm-alias-float.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
libm-alias-ldouble.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
libm-test-ulps Replace gen-libm-test.pl with gen-libm-test.py. 2018-08-09 15:34:12 +00:00
libm-test-ulps-name
libm.abilist
libnsl.abilist
libnss_compat.abilist
libnss_db.abilist
libnss_dns.abilist
libnss_files.abilist
libnss_hesiod.abilist
libnss_nis.abilist
libnss_nisplus.abilist
libpthread.abilist
libresolv.abilist
librt.abilist
libutil.abilist
link_map.h ld.so: Add architecture specific fields 2017-11-13 08:02:52 -08:00
linkmap.h
local-setxid.h
localplt.data ld.so: Introduce struct dl_exception 2017-08-10 16:54:57 +02:00
machine-gmon.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
machine-lock.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
machine-sp.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
Makefile Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
malloc-alignment.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
malloc-machine.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
malloc-sysdep.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math_ldbl_opt.h Use PRINTF_LDBL_IS_DBL instead of __ldbl_is_dbl. 2018-12-05 18:15:43 -02:00
math_ldbl.h
math_private_calls.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math_private.h Add new pow implementation 2018-09-19 10:04:51 +01:00
math-barriers.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-nan-payload-double.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-nan-payload-float.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests-arch.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests-exceptions.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests-rounding.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests-snan-cast.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests-snan-payload.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests-snan.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests-trap-force.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests-trap.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-tests.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-type-macros-double.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-type-macros-float128.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-type-macros-float.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-type-macros-ldouble.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
math-type-macros.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
memcopy.h Add some spaces before '('. 2019-02-27 13:55:45 +00:00
memusage.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
mmap_info.h posix: Fix large mmap64 offset for mips64n32 (BZ#24699) 2019-07-10 16:52:50 -03:00
nan-high-order-bit.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
not-cancel.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
not-errno.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
nscd-types.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
pagecopy.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
paths.h
profil-counter.h Refactor sigcontextinfo.h 2019-08-23 11:30:56 -03:00
pty-private.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
register-dump.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
rtld-lowlevel.h
safe-fatal.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
setjmpP.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
sigcontextinfo.h Refactor sigcontextinfo.h 2019-08-23 11:30:56 -03:00
siglist.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
sigset-cvt-mask.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
sigsetops.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
single-thread.h Add RTLD_SINGLE_THREAD_P on generic single-thread.h 2019-08-23 11:30:27 -03:00
stackguard-macros.h
stackinfo.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
stap-probe-machine.h arm: Use "nr" constraint for Systemtap probes [BZ #24164] 2019-02-05 13:01:08 +01:00
startup.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
stdio-lock.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
string_private.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
symbol-hacks.h Break more lines before not after operators. 2019-02-25 13:19:19 +00:00
sysdep-cancel.h nptl: Remove tst-cancel-wrappers test and related macros 2019-01-03 18:38:08 -02:00
sysdep.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
thread_state.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
tininess.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
tls-macros.h
tls-setup.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
tls.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
tst-audit.h
tst-stack-align.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
unsecvars.h Ignore and remove LD_HWCAP_MASK for AT_SECURE programs (bug #21209) 2017-03-07 20:52:04 +05:30
unwind-dw2-fde-glibc.c Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
unwind-dw2-fde.c Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
unwind-dw2-fde.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
unwind-dw2.c Add some spaces before '('. 2019-02-27 13:55:45 +00:00
unwind-pe.c
unwind-pe.h Add some spaces before '('. 2019-02-27 13:55:45 +00:00
unwind-resume.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
unwind.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
utmp-equal.h login: Assume that _HAVE_UT_* constants are true 2019-08-13 12:09:32 +02:00