Commit graph

9 commits

Author SHA1 Message Date
Warner Losh 559a218c9b libc: Purge unneeded cdefs.h
These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D42385
2023-11-01 16:44:30 -06:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Dmitry Chagin 241a55b461 libc/csu: Do not compile the finalizer() for PIC build
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D41148
2023-07-22 11:56:06 +03:00
Konstantin Belousov c383f4857f lib/csu: do not compile the body of handle_static_init() for PIC build at all
The referenced symbols that provide init array boundaries are weak,
hidden, and undefined.  The code that iterates over that arrays is not
used for the case when libc is compiled as dso.

This should fix linking with ld.bfd.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2023-03-12 23:47:41 +02:00
Konstantin Belousov 94e3409e2d libc/csu: add powerpcspe
Reported and tested by:	alfredo
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2023-03-12 23:47:41 +02:00
Konstantin Belousov c5c9d980c4 libc/csu: rename ignore_init.c to libc_start1.c
The current name was a historical curiosity that started when init array
support was added, and then the file appeared a convenient place for the
addition of the MI common code to csu.  It is now referenced by name in
single place and the rename is easy, so do it.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2023-03-12 00:56:46 +02:00
Konstantin Belousov 0c6f0c0db7 libc: move declaration of 'char **environ' to common private header
Suggested by:	imp
Reviewed by:	markj
Tested by:	markj (aarch64)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D37220
2023-03-12 00:50:04 +02:00
Konstantin Belousov 0303938539 x86: microoptimize static PIE startup
Do not call CPUID on each ireloc, instead call it once and cache
results, similar to how it is done on powerpc64.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D37220
2023-03-12 00:50:04 +02:00
Konstantin Belousov 51015e6d0f 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
2023-03-12 00:50:03 +02:00