mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
Support gcc FORTIFY_SOURCE features for nuttx libc
This function will use gcc's function __builtin_dynamic_object_size and __builtin_object_size Its function is to obtain the size of the object through compilation, so as to judge whether there are out-of-bounds operations in commonly used functions. It should be noted that the option -O2 and above is required to enable this function Signed-off-by: anjiahao <1090959677@qq.com>
This commit is contained in:
@@ -597,6 +597,18 @@ endmenu # Customize Header Files
|
||||
|
||||
menu "Debug Options"
|
||||
|
||||
config FORTIFY_SOURCE
|
||||
int "Fortify Source"
|
||||
default 0
|
||||
range 0 3
|
||||
---help---
|
||||
Detect overflows of buffers in common string and memory functions
|
||||
where the compiler can determine and validate the buffer sizes.
|
||||
0 does not have any checks.
|
||||
1 will only check for out-of-bounds at compile time.
|
||||
2 will only perform out-of-bounds checks on stack variables.
|
||||
3 On the basis of 2, add an out-of-bounds check for dynamically allocated variables.
|
||||
|
||||
config NDEBUG
|
||||
bool "Define NDEBUG globally"
|
||||
default !DEBUG_ASSERTIONS
|
||||
|
||||
Reference in New Issue
Block a user