]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
csu: move common code to libc
authorKonstantin Belousov <kib@FreeBSD.org>
Sun, 30 Oct 2022 23:47:44 +0000 (01:47 +0200)
committerKonstantin Belousov <kib@FreeBSD.org>
Sat, 11 Mar 2023 22:50:03 +0000 (00:50 +0200)
commit51015e6d0f570239b0c2088dc6cf2b018928375d
treebac148baabfb85020f64956855b2e2c7c2cab1cd
parent3c3a434f8ee867e6e4a69de07bf0811f2ae0c46e
csu: move common code to libc

Why? Most trivial point, it shaves around 600 bytes from the dynamic
binaries on amd64. Less trivial, the removed code is no longer part of
the ABI, and we can ship updates to it with libc updates. Right now most
of the csu is linked into the binaries and require us to do somewhat
tricky ABI compat when it needs to change. For instance, the init_array
change would be much simpler and does not require note tagging if we
have init calling code in libc.

This could be improved more, by splitting dynamic and static
initialization. For instance, &_DYNAMIC tests can be removed then.
Such change, nonetheless, would require building libc three times.
I left this for later, after this change stabilizes, if ever.

Reviewed by: markj
Discussed with: jrtc27 (some objections, see the review), imp
Tested by: markj (aarch64)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D37220
31 files changed:
lib/csu/aarch64/Makefile
lib/csu/aarch64/crt1_c.c
lib/csu/amd64/Makefile
lib/csu/amd64/crt1_c.c
lib/csu/arm/Makefile
lib/csu/arm/crt1_c.c
lib/csu/common/csu_common.h [new file with mode: 0644]
lib/csu/i386/Makefile
lib/csu/i386/crt1_c.c
lib/csu/powerpc/Makefile
lib/csu/powerpc/crt1_c.c
lib/csu/powerpc64/Makefile
lib/csu/powerpc64/crt1_c.c
lib/csu/riscv/Makefile
lib/csu/riscv/crt1_c.c
lib/libc/Makefile
lib/libc/csu/Makefile.inc [new file with mode: 0644]
lib/libc/csu/Symbol.map [new file with mode: 0644]
lib/libc/csu/aarch64/Makefile.inc [new file with mode: 0644]
lib/libc/csu/aarch64/reloc.c [moved from lib/csu/aarch64/reloc.c with 100% similarity]
lib/libc/csu/amd64/Makefile.inc [new file with mode: 0644]
lib/libc/csu/amd64/reloc.c [moved from lib/csu/amd64/reloc.c with 100% similarity]
lib/libc/csu/arm/Makefile.inc [new file with mode: 0644]
lib/libc/csu/i386/Makefile.inc [new file with mode: 0644]
lib/libc/csu/i386/reloc.c [moved from lib/csu/i386/reloc.c with 100% similarity]
lib/libc/csu/ignore_init.c [moved from lib/csu/common/ignore_init.c with 77% similarity]
lib/libc/csu/powerpc/Makefile.inc [new file with mode: 0644]
lib/libc/csu/powerpc64/Makefile.inc [new file with mode: 0644]
lib/libc/csu/powerpc64/reloc.c [moved from lib/csu/powerpc64/reloc.c with 74% similarity]
lib/libc/csu/riscv/Makefile.inc [new file with mode: 0644]
lib/libc/include/libc_private.h