freebsd-dev/libexec/rtld-elf
Alex Richardson b54a59f3ba Reduce size of rtld by 22% by pulling in less code from libc
Currently RTLD is linked against libc_nossp_pic which means that any libc
symbol used in rtld can pull in a lot of depedencies. This was causing
symbol such as __libc_interposing and all the pthread stubs to be included
in RTLD even though they are not required. It turns out most of these
dependencies can easily be avoided by providing overrides inside of rtld.

This change is motivated by CHERI, where we have an experimental ABI that
requires additional relocation processing to allow the use of function
pointers inside of rtld. Instead of adding this self-relocation code to
RTLD I attempted to remove most function pointers from RTLD and discovered
that most of them came from the libc dependencies instead of being actually
used inside rtld.

A nice side-effect of this change is that rtld is now 22% smaller on amd64.

   text	   data	    bss	    dec	    hex	filename
0x21eb6	  0xce0	  0xe60	 145910	  239f6	/home/alr48/ld-elf-x86.before.so.1
0x1a6ed	  0x728	  0xdd8	 113645	  1bbed	/home/alr48/ld-elf-x86.after.so.1

The number of R_X86_64_RELATIVE relocations that need to be processed on
startup has also gone down from 368 to 187 (almost 50% less).

Reviewed By:	kib
Differential Revision: https://reviews.freebsd.org/D20663
2019-06-30 11:49:58 +00:00
..
aarch64 Improve R_AARCH64_TLSDESC relocation. 2018-12-15 10:38:07 +00:00
amd64 Improve R_AARCH64_TLSDESC relocation. 2018-12-15 10:38:07 +00:00
arm rtld: attempt to fix reloc_nonplt_object TLS allocation 2019-03-29 14:35:23 +00:00
i386 rtld: pacify -Wmaybe-uninitialized from gcc6 2019-02-01 23:16:59 +00:00
mips rtld: attempt to fix reloc_non_plt TLS allocation on MIPS 2019-03-29 15:07:00 +00:00
powerpc powerpc: Transition to Secure-PLT, like most other OSs 2019-06-25 00:40:44 +00:00
powerpc64 Fix rtld-elf compilation warning for powerpc64 ELFv2 ABI 2019-01-13 02:33:20 +00:00
riscv Improve R_AARCH64_TLSDESC relocation. 2018-12-15 10:38:07 +00:00
rtld-libc Reduce size of rtld by 22% by pulling in less code from libc 2019-06-30 11:49:58 +00:00
sparc64 Improve R_AARCH64_TLSDESC relocation. 2018-12-15 10:38:07 +00:00
tests Fix regression tests broken by r337067. 2018-08-02 11:55:16 +00: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 Reduce size of rtld by 22% by pulling in less code from libc 2019-06-30 11:49:58 +00: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 Reduce size of rtld by 22% by pulling in less code from libc 2019-06-30 11:49:58 +00:00
Makefile.depend new depends 2015-06-16 23:37:19 +00:00
map_object.c Remove Obj_Entry textsize member. 2018-11-04 00:32:28 +00: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 Reduce size of rtld by 22% by pulling in less code from libc 2019-06-30 11:49:58 +00:00
rtld_lock.h libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
rtld_malloc.c rtld_malloc.c: cleanup morepages(). 2019-05-16 13:13:33 +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 libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
rtld_utrace.h Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
rtld.1 Add serial comma. 2017-09-01 16:56:37 +00:00
rtld.c Reduce size of rtld by 22% by pulling in less code from libc 2019-06-30 11:49:58 +00:00
rtld.h powerpc: Transition to Secure-PLT, like most other OSs 2019-06-25 00:40:44 +00:00
Symbol.map Add rtld private interface for dso to detect dynamic loading 2015-01-03 18:09:53 +00:00
xmalloc.c Reduce size of rtld by 22% by pulling in less code from libc 2019-06-30 11:49:58 +00:00