From ac26e83a452528661bf2607b5ff2026ce9d4932f Mon Sep 17 00:00:00 2001 From: yanghuatao Date: Tue, 23 Apr 2024 20:07:42 +0800 Subject: [PATCH] toolchain/ghs: Fix unknown attribute warnings "string/lib_strlen.c", line 54: warning #1097-D: unknown attribute "no_sanitize_address" nosanitize_address "string/lib_strncpy.c", line 81: warning #1097-D: unknown attribute "no_sanitize_address" nosanitize_address "string/lib_strncmp.c", line 58: warning #1097-D: unknown attribute "no_sanitize_address" nosanitize_address "string/lib_strchr.c", line 73: warning #1097-D: unknown attribute "no_sanitize_address" nosanitize_address "string/lib_strcpy.c", line 68: warning #1097-D: unknown attribute "no_sanitize_address" nosanitize_address "procfs/fs_procfstcbinfo.c", line 185: warning #1097-D: unknown attribute "optimize" nooptimiziation_function Signed-off-by: yanghuatao --- include/nuttx/compiler.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index 088bc9eda3..2aac80e67a 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -258,6 +258,16 @@ # define nosanitize_address __attribute__((no_sanitize_address)) +/* the Greenhills compiler do not support the following atttributes */ + +# if defined(__ghs__) +# undef nooptimiziation_function +# define nooptimiziation_function + +# undef nosanitize_address +# define nosanitize_address +# endif + /* The nosanitize_undefined attribute informs GCC don't sanitize it */ # define nosanitize_undefined __attribute__((no_sanitize("undefined")))