freebsd-dev/libexec/rtld-elf
Fangrui Song e6c7696203 rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0
For a Variant II architecture, the TP offset of a TLS symbol is st_value -
tlsoffset + r_addend. tlsoffset is computed by either calculate_tls_offset
or calculate_first_tls_offset.

The return value of calculate_first_tls_offset is the smallest integer
satisfying res >= size and (-res) % p_align = p_vaddr % p_align
(= p_offset % p_align).  (The formula is a bit contrived. The basic idea
is to subtract the minimum integer from size + align - 1 so that the result
ihas the expected remainder.)

Reviewed by:	kib
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31538
Differential revision:	https://reviews.freebsd.org/D31541
2021-08-16 13:55:34 +03:00
..
aarch64 rtld/arm64: Remove checks for undefined symbols when processing TPREL64 2021-07-15 22:41:10 -04:00
amd64 rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0 2021-08-16 13:55:34 +03:00
arm rtld: define TLS_DTV_OFFSET on all architectures 2021-04-09 23:46:24 +03:00
i386 rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0 2021-08-16 13:55:34 +03:00
mips rtld: use _get_tp() in __tls_get_addr() 2021-04-09 23:46:24 +03:00
powerpc rtld-elf(1): remove obsolete pre_init() hook 2020-12-25 19:47:46 +01:00
powerpc64 rtld-elf(1): remove obsolete pre_init() hook 2020-12-25 19:47:46 +01:00
riscv rtld-elf(1): remove obsolete pre_init() hook 2020-12-25 19:47:46 +01:00
rtld-libc rtld: avoid recursing on rtld_bind_lock for write 2021-04-09 23:46:24 +03:00
tests rtld/tests: Avoid function name conflict with libc opendir() 2021-07-06 10:51:57 +01:00
debug.c libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
debug.h Use rtld_putstr() instead of write() for the rtld msg() macro 2019-06-26 15:43:26 +00:00
libmap.c rtld: call close(2) after errno is saved 2021-01-02 04:43:32 +02:00
libmap.conf Move libmap.conf to libexec/rtld-elf/ 2018-09-18 00:25:00 +00:00
libmap.h rtld-elf: make it compile with WARNS=3 2018-10-29 21:08:11 +00:00
Makefile Add build system support for ASAN+UBSAN instrumentation 2021-08-02 14:33:24 +01:00
Makefile.depend new depends 2015-06-16 23:37:19 +00:00
map_object.c rtld: Round down relro_size 2021-08-13 12:58:53 +03:00
paths.h rtld-elf: compile with WANRS=4 warnings other than -Wcast-align 2018-10-29 21:08:19 +00:00
rtld_lock.c rtld: initialize default dlerror_seen_val as true 2021-05-13 02:31:29 +03:00
rtld_lock.h rtld_lock.h: add some comments about versioning of struct RtldLockInfo 2021-04-11 11:16:13 +03:00
rtld_malloc.c Remove remnants of optimization for > pagesize allocations. 2019-09-02 08:03:29 +00:00
rtld_malloc.h Add header file missed in r343564. 2019-01-29 22:45:24 +00:00
rtld_printf.c Reduce size of rtld by 22% by pulling in less code from libc 2019-06-30 11:49:58 +00:00
rtld_printf.h Use rtld_putstr() instead of write() for the rtld msg() macro 2019-06-26 15:43:26 +00:00
rtld_tls.h Remove sparc64 specific parts of rtld-elf. 2020-02-26 18:49:25 +00:00
rtld_utrace.h Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
rtld.1 rtld: Rename -t option to -u (ignore LD_ vars) 2021-06-03 01:55:08 +03:00
rtld.c rtld: Round down relro_size 2021-08-13 12:58:53 +03:00
rtld.h rtld: unstaticise lockinfo and obj_from_addr() 2021-04-10 17:33:33 +03:00
Symbol.map rtld dl_iterate_phdr(): dlpi_tls_data is wrong 2021-04-06 03:23:08 +03:00
xmalloc.c Make p_vaddr % p_align == p_offset % p_align for (some) TLS segments. 2020-04-04 22:37:50 +00:00