haiku/headers
Niels Sascha Reedijk 3fb092979e kernel: provide kernel-level equivalents for math.h and stdlib.h
GCC 13 is more strict about what C++ features are available in a freestanding
(= build without standard library) build. The `stdlib.h` and `math.h` headers
are redefined as part of libstdc++. If the object is built as freestanding, it
should be assumed that none of the standard library functions are available.

The solution in Haiku has been to add part of the standard library into the
kernel shared object. The method of exposing them has been to allow the
use of `stdlib.h` and `math.h` in the kernel and in kernel add-ons.

This change allows that approach to continue. What it does, is that it defines
specific headers which will be picked up when a module is built using private
kernel headers. When building for the kernel (or for the boot module), it will
bypass GCC 13's libstdc++ default behaviour of not including the POSIX/platform
header with all the function definitions.

An alternative to be considered for the longer term is to specifically define
the parts of the C/C++ standard library that is available in the kernel in
these headers, or create custom headers when building kernel modules (which is
how Linux approaches it).

Change-Id: Icab4614f642219fa77732b02401570708ee9a963
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6645
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-06-28 07:11:17 +00:00
..
build libroot_build & fs_shell: Provide _kern_ functions for readv/writev... 2023-02-14 00:49:52 -05:00
compatibility headers/bsd: Export pthread_attr_get_np 2023-05-08 01:38:41 +00:00
config riscv: cleanup architecture macro checks 2021-09-01 18:04:59 +00:00
cpp build fix. 2015-11-12 22:24:16 +01:00
glibc Make public glibc header printf.h usable. 2013-07-17 18:07:56 +02:00
libs Removed 'register' storage class compiler warnings 2022-09-12 14:03:28 +00:00
os strace: Print detailed signal information 2023-05-31 16:34:12 +00:00
posix pthread: Use 1 for PTHREAD_BARRIER_SERIAL_THREAD. 2023-06-07 15:12:11 +00:00
private kernel: provide kernel-level equivalents for math.h and stdlib.h 2023-06-28 07:11:17 +00:00
tools cppunit: Enable CPPUNIT_HAVE_SSTREAM for the non-legacy GCC. 2022-03-29 19:09:38 -04:00