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

linguini pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit bda9ab92876100e39a2730475e0642a2cd202d81
Author: buxiasen <[email protected]>
AuthorDate: Wed Feb 19 16:48:50 2025 +0800

    libc/localtime: tz_lock/unlock should not touch tcb except FLAT
    
    Causing kernel build report undefined reference 'g_nx_initstate'
    Also protect build, as user elf have no access of kernel objects.
    
    Signed-off-by: buxiasen <[email protected]>
---
 libs/libc/time/lib_localtime.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c
index 414f0cb6eae..4745e20344d 100644
--- a/libs/libc/time/lib_localtime.c
+++ b/libs/libc/time/lib_localtime.c
@@ -392,7 +392,7 @@ static int  tzparse(FAR const char *name, FAR struct 
state_s *sp,
 
 static inline void tz_lock(FAR rmutex_t *lock)
 {
-#ifndef __KERNEL__
+#if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT)
   if (up_interrupt_context() || (sched_idletask() && OSINIT_IDLELOOP()))
     {
       return;
@@ -404,7 +404,7 @@ static inline void tz_lock(FAR rmutex_t *lock)
 
 static inline void tz_unlock(FAR rmutex_t *lock)
 {
-#ifndef __KERNEL__
+#if defined(__KERNEL__) || defined(CONFIG_BUILD_FLAT)
   if (up_interrupt_context() || (sched_idletask() && OSINIT_IDLELOOP()))
     {
       return;

Reply via email to