-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
Zephyr unconditionally enables the C compiler flag -ffreestanding which is only necessary when the environment does not include the standard C library. This may be necessary when using the minimal C library, but it's not helpful when using a POSIX compatible C library such as newlib or picolibc.
Not only does -freestanding disable many builtin functions, it also disables compile-time warnings about buffer overflows for libc functions, disables optimizations based on internal compiler knowledge of libc semantics and generally makes code less secure and less performant.
Disabling this option isn't something that can be done casually though; any code which redefines libc functions, or which uses libc functions in ways that the compiler may think could cause a buffer overflow will generate compile errors or warnings. Which makes this a project policy issue, not just a bug in the build system...