zephyr/cmake/compiler
Keith Packard cdc686eecc compiler/gcc: _FORTIFY_SOURCE=1 doesn't mean compile-time only checks
_FORTIFY_SOURCE=1 differs from _FORTIFY_SOURCE=2 only in the bounds
checking mode that it uses.

With _FORTIFY_SOURCE=1, bounds checks are 'loose', allowing access to the
whole underlying object, not just the subset referenced in the expression
(e.g, the bounds of a struct member is the whole struct, not just the
member).

With _FORTIFY_SOURCE=2, bounds checks are strict, meaning that the bounds
of an expression are limited to the referenced value.

Both of these perform their checks at runtime, calling _chk_fail if the
bounds check fails. That's done in the __*_chk functions included in the C
library. These are always called when _FORTIFY_SOURCE > 0, unless the
compiler replaces the call with inline code.

GCC already does all of the compile-time bounds checking for string and mem
functions when not using -ffreestanding, so there's nothing we need to add
for that to work. That means the security_fortify_compile_time property
should be empty.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-01-10 20:50:51 -05:00
..
arcmwdt cmake/compiler/: drop ERROR_QUIET when looking for compiler --version 2023-12-04 16:38:08 +00:00
armclang cmake/compiler/: drop ERROR_QUIET when looking for compiler --version 2023-12-04 16:38:08 +00:00
clang clang: target: Include gcc-m-fpu.cmake file 2023-10-23 16:04:39 +02:00
gcc compiler/gcc: _FORTIFY_SOURCE=1 doesn't mean compile-time only checks 2024-01-10 20:50:51 -05:00
host-gcc cmake: provide a useful error msg when native compiler is missing 2023-02-09 22:10:16 +09:00
icx cmake: enable -Wshadow partially for in-tree code 2023-08-22 11:39:58 +02:00
xcc xcc/cmake: don't discard stderr; don't (ever!) use ERROR_QUIET 2023-11-30 10:07:25 +01:00
xt-clang cmake: enable -Wshadow partially for in-tree code 2023-08-22 11:39:58 +02:00
compiler_features.cmake cmake: CMake compile features support 2021-10-01 14:40:33 -04:00
compiler_flags_template.cmake cmake: compiler: Add compiler property for no-builtin 2023-11-13 10:21:41 +01:00