This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 593768e11edbe00383462a1bf01c25de7d68d660
Author: yinshengkai <[email protected]>
AuthorDate: Wed Sep 18 21:34:17 2024 +0800

    sim/gcov: Fix conflicts between fprofile-orderate and __asan_default_options
    
    Signed-off-by: yinshengkai <[email protected]>
---
 arch/sim/src/sim/sim_head.c |  6 +++---
 include/nuttx/compiler.h    | 13 +++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/arch/sim/src/sim/sim_head.c b/arch/sim/src/sim/sim_head.c
index e2c3af1934..3c9fd79a6d 100644
--- a/arch/sim/src/sim/sim_head.c
+++ b/arch/sim/src/sim/sim_head.c
@@ -108,7 +108,7 @@ static void allsyms_relocate(void)
  ****************************************************************************/
 
 #ifdef CONFIG_SIM_ASAN
-const char *__asan_default_options(void)
+noprofile_function const char *__asan_default_options(void)
 {
   return "abort_on_error=1"
          " alloc_dealloc_mismatch=0"
@@ -119,7 +119,7 @@ const char *__asan_default_options(void)
          " detect_stack_use_after_return=0";
 }
 
-const char *__lsan_default_options(void)
+noprofile_function const char *__lsan_default_options(void)
 {
   /* The fast-unwind implementation of leak-sanitizer will obtain the
    * current stack top/bottom and frame address(Stack Pointer) for
@@ -141,7 +141,7 @@ const char *__lsan_default_options(void)
 #endif
 
 #ifdef CONFIG_SIM_UBSAN
-const char *__ubsan_default_options(void)
+noprofile_function const char *__ubsan_default_options(void)
 {
 #ifdef CONFIG_SIM_UBSAN_DUMMY
   return "";
diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h
index 6f82b6f9f9..fd4ce63336 100644
--- a/include/nuttx/compiler.h
+++ b/include/nuttx/compiler.h
@@ -250,6 +250,13 @@
 
 #  define noinstrument_function __attribute__((no_instrument_function))
 
+/* The no_profile_instrument_function attribute on functions is used to
+ * inform the compiler that it should not process any profile feedback
+ * based optimization code instrumentation.
+ */
+
+#  define noprofile_function __attribute__((no_profile_instrument_function))
+
 /* The nooptimiziation_function attribute no optimize */
 
 #  define nooptimiziation_function __attribute__((optimize(0)))
@@ -580,6 +587,7 @@
 #  define inline_function inline
 #  define noinline_function
 #  define noinstrument_function
+#  define noprofile_function
 #  define nooptimiziation_function
 #  define nosanitize_address
 #  define nosanitize_undefined
@@ -726,6 +734,7 @@
 #  define inline_function inline
 #  define noinline_function
 #  define noinstrument_function
+#  define noprofile_function
 #  define nooptimiziation_function
 #  define nosanitize_address
 #  define nosanitize_undefined
@@ -840,6 +849,7 @@
 #  define inline_function inline
 #  define noinline_function
 #  define noinstrument_function
+#  define noprofile_function
 #  define nooptimiziation_function
 #  define nosanitize_address
 #  define nosanitize_undefined
@@ -933,6 +943,7 @@
 #  define inline_function __forceinline
 #  define noinline_function
 #  define noinstrument_function
+#  define noprofile_function
 #  define nooptimiziation_function
 #  define nosanitize_address
 #  define nosanitize_undefined
@@ -1016,6 +1027,7 @@
 #  define inline_function               __attribute__((always_inline)) inline
 #  define noinline_function             __attribute__((noinline))
 #  define noinstrument_function
+#  define noprofile_function
 #  define nooptimiziation_function      __attribute__((optimize(0)))
 #  define nosanitize_address
 #  define nosanitize_undefined
@@ -1084,6 +1096,7 @@
 #  define inline_function
 #  define noinline_function
 #  define noinstrument_function
+#  define noprofile_function
 #  define nooptimiziation_function
 #  define nosanitize_address
 #  define nosanitize_undefined

Reply via email to