casaroli commented on code in PR #21498:
URL: https://github.com/apache/nuttx/pull/21498#discussion_r4501773301


##########
include/nuttx/compiler.h:
##########
@@ -199,6 +199,15 @@
 #    define CONFIG_HAVE_BUILTIN_FFSLL 1
 #  endif
 
+  /* An __asm__ label names the symbol with __USER_LABEL_PREFIX__ ("_" on
+   * RH850 and RX, empty on most targets).  The two-step stringify is local
+   * so that including compiler.h does not define STRINGIFY everywhere.
+   */
+
+#  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

Review Comment:
   This is in the `__GNUC__` section, which Green Hills also takes (it defines 
`__GNUC__`), and `fortify_real()` uses it without a `__has_builtin` check. If a 
compiler does not predefine `__USER_LABEL_PREFIX__`, the label becomes 
"__USER_LABEL_PREFIX__memcpy" and the link fails.
   Fix: `#ifdef __USER_LABEL_PREFIX__` around this define, with `#  define 
asm_symbol(fn) #fn` in the `#else`.



##########
include/nuttx/compiler.h:
##########
@@ -199,6 +199,15 @@
 #    define CONFIG_HAVE_BUILTIN_FFSLL 1
 #  endif
 
+  /* An __asm__ label names the symbol with __USER_LABEL_PREFIX__ ("_" on
+   * RH850 and RX, empty on most targets).  The two-step stringify is local
+   * so that including compiler.h does not define STRINGIFY everywhere.
+   */
+
+#  define asm_symbol_str(x)  #x

Review Comment:
   compiler.h is included by every program, so `asm_symbol`, `asm_symbol_str` 
and `asm_symbol_xstr` are now in every program's namespace, also with 
`NUTTX_NO_EXTENSIONS` (they are not in the push_macro/pop_macro lists of this 
file).
   Fix: use reserved names, for example `__asm_symbol`, `__asm_symbol_str` and 
`__asm_symbol_xstr`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to