v-zhangxiaomeng5 commented on code in PR #20723:
URL: https://github.com/apache/nuttx/pull/20723#discussion_r4320936972


##########
libs/libc/tls/CMakeLists.txt:
##########
@@ -20,7 +20,20 @@
 #
 # 
##############################################################################
 
-set(SRCS task_getinfo.c tls_getinfo.c)
+set(SRCS task_getinfo.c tls_getinfo.c tls_emutls.c)
+
+# Take the emutls functions from libc, not from libgcc: the apps refer to them
+# only after the linker has scanned libc (see tools/Config.mk).
+
+if(CONFIG_ARCH_TOOLCHAIN_GCC AND NOT CONFIG_ARCH_SIM)

Review Comment:
   But we shouldn't assume that host compiler always has native TLS, right?
   Below could be a proposal for tools/Config.mk changing:
      ifeq ($(CONFIG_ARCH_SIM),y)
      LDFLAGS += -Wl,--wrap=__emutls_get_address
      LDFLAGS += -Wl,--wrap=__emutls_register_common
      else
      LDFLAGS += --wrap=__emutls_get_address --wrap=__emutls_register_common
      endif
   



-- 
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