This is an automated email from the ASF dual-hosted git repository.
michallenc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 47e9f90e4a2 include/nuttx/compiler.h: use the user label prefix in asm
labels.
47e9f90e4a2 is described below
commit 47e9f90e4a2f706d09bd1133db79d6ce719041dd
Author: Parthiban Nallathambi <[email protected]>
AuthorDate: Sat Oct 31 18:32:15 2026 +0530
include/nuttx/compiler.h: use the user label prefix in asm labels.
v850 GCC prefixes C symbols with "_". The asm names in the builtin and
fortify wrappers now take the prefix into account, through a local
two-step stringify, so compiler.h does not define STRINGIFY for every
file that includes it. Targets without a prefix get the same names as
before.
Signed-off-by: Parthiban Nallathambi <[email protected]>
---
include/nuttx/compiler.h | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h
index 20ada7a7cec..a4b1c31d279 100644
--- a/include/nuttx/compiler.h
+++ b/include/nuttx/compiler.h
@@ -197,6 +197,16 @@
# define CONFIG_HAVE_BUILTIN_FFS 1
# define CONFIG_HAVE_BUILTIN_FFSL 1
# define CONFIG_HAVE_BUILTIN_FFSLL 1
+# endif
+
+ /* An __asm__ label carries __USER_LABEL_PREFIX__ ("_" on RH850 and RX) */
+
+# ifdef __USER_LABEL_PREFIX__
+# define __asm_symbol_str(x) #x
+# define __asm_symbol_xstr(x) __asm_symbol_str(x)
+# define __asm_symbol(fn) __asm_symbol_xstr(__USER_LABEL_PREFIX__) #fn
+# else
+# define __asm_symbol(fn) #fn
# endif
# if CONFIG_FORTIFY_SOURCE > 0
@@ -221,14 +231,16 @@
# if !defined(__clang__)
# define fortify_va_arg_pack __builtin_va_arg_pack
# endif
-# define fortify_real(fn) __typeof__(fn) __real_##fn __asm__(#fn)
+# define fortify_real(fn) __typeof__(fn) __real_##fn \
+ __asm__(__asm_symbol(fn))
# define fortify_function(fn) fortify_real(fn); \
extern __inline__ no_builtin(#fn) \
__attribute__((__always_inline__, \
__gnu_inline__,
__artificial__))
# elif defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 && \
defined(__has_builtin) && !defined(NUTTX_NO_EXTENSIONS)
-# define builtin_original(fn) __typeof__(fn) __orig_##fn __asm__(#fn)
+# define builtin_original(fn) __typeof__(fn) __orig_##fn \
+ __asm__(__asm_symbol(fn))
# define builtin_function(fn) builtin_original(fn); \
extern __inline__ no_builtin(#fn) \
__attribute__((__always_inline__, \