e278d94bca
The MIPS ABI does not require the second GOT entry to be reserved for use by the runtime linker as on other architectures. Instead, static linkers use a special value in the second GOT entry to indicate if the entry is reserved. This value is supposed to consist of an address with the MSB set and the rest of the bits all zero which is an invalid user address. However, the old binutils currently in the tree uses the 32-bit mask value (2^31) on 64-bit MIPS instead of 2^63. This was fixed in upstream binutils in 2008 to use 2^63 on 64-bit MIPS. The first part of this change changes the runtime check in init_pltgot() to check for both values (2^31 and 2^63) when deciding whether to store the current object pointer in GOT[1] which fixes dynamic N64 binaries compiled with modern binutils. However, the initial version of this fix exposed another related bug in that _rtld_relocate_nonplt_self() was only checking for the new value (2^63) in GOT[1] and incorrectly treated GOT[1] as a local GOT entry (and did not relocate the final local GOT entry). To handle this, fix all of the places that check for GOT[1]'s status to use the same macro that checks for both values on N64. Reviewed by: kan, imp Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D9708 |
||
---|---|---|
.. | ||
aarch64 | ||
amd64 | ||
arm | ||
i386 | ||
mips | ||
powerpc | ||
powerpc64 | ||
riscv | ||
sparc64 | ||
tests | ||
debug.c | ||
debug.h | ||
libmap.c | ||
libmap.h | ||
Makefile | ||
Makefile.depend | ||
malloc.c | ||
map_object.c | ||
paths.h | ||
rtld_lock.c | ||
rtld_lock.h | ||
rtld_printf.c | ||
rtld_printf.h | ||
rtld_tls.h | ||
rtld_utrace.h | ||
rtld.1 | ||
rtld.c | ||
rtld.h | ||
Symbol.map | ||
xmalloc.c |