You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/05/07 18:06:30 UTC

[incubator-nuttx] branch errno updated (1ad03a5 -> a6da3c2)

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

gnutt pushed a change to branch errno
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 1ad03a5  syscall: Generate STUB prototype automatically
     new c2244a2  Remove CONFIG_TLS
     new e74899f  arch/risc-v/src/common/riscv_createstack.c: Fix the stack_color name.
     new a6da3c2  arch/*/*_checkstack.c: Get aligned address only when CONFIG_TLS_ALIGNED is       enabled.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 TODO                                         |  2 +-
 arch/Kconfig                                 |  2 --
 arch/arm/include/tls.h                       |  3 ---
 arch/arm/src/common/arm_checkstack.c         |  1 +
 arch/arm/src/common/arm_createstack.c        | 16 +---------------
 arch/arm/src/common/arm_usestack.c           |  6 ------
 arch/avr/include/tls.h                       |  3 ---
 arch/avr/src/avr/up_createstack.c            |  5 +----
 arch/avr/src/avr/up_usestack.c               |  2 --
 arch/avr/src/avr32/up_createstack.c          |  4 ----
 arch/avr/src/avr32/up_usestack.c             |  2 --
 arch/hc/include/tls.h                        |  3 ---
 arch/hc/src/common/up_createstack.c          |  4 ----
 arch/hc/src/common/up_usestack.c             |  2 --
 arch/mips/include/tls.h                      |  3 ---
 arch/mips/src/common/mips_createstack.c      |  4 ----
 arch/mips/src/common/mips_usestack.c         |  2 --
 arch/misoc/include/tls.h                     |  3 ---
 arch/misoc/src/lm32/lm32_createstack.c       |  4 ----
 arch/misoc/src/minerva/minerva_createstack.c |  4 ----
 arch/or1k/include/tls.h                      |  3 ---
 arch/or1k/src/common/up_checkstack.c         |  3 ++-
 arch/or1k/src/common/up_createstack.c        | 16 +---------------
 arch/renesas/include/tls.h                   |  3 ---
 arch/renesas/src/common/up_createstack.c     |  4 ----
 arch/renesas/src/common/up_usestack.c        |  2 --
 arch/risc-v/include/tls.h                    |  3 ---
 arch/risc-v/src/common/riscv_checkstack.c    |  3 ++-
 arch/risc-v/src/common/riscv_createstack.c   | 17 ++---------------
 arch/risc-v/src/common/riscv_usestack.c      |  2 --
 arch/sim/include/tls.h                       |  3 ---
 arch/sim/src/sim/up_createstack.c            | 20 +++-----------------
 arch/sim/src/sim/up_usestack.c               |  2 --
 arch/x86/include/tls.h                       |  3 ---
 arch/x86/src/i486/up_createstack.c           |  4 ----
 arch/x86/src/i486/up_usestack.c              |  2 --
 arch/x86_64/include/tls.h                    |  3 ---
 arch/x86_64/src/intel64/up_createstack.c     |  4 ----
 arch/x86_64/src/intel64/up_usestack.c        |  2 --
 arch/xtensa/include/tls.h                    |  3 ---
 arch/xtensa/src/common/xtensa_checkstack.c   |  4 +++-
 arch/xtensa/src/common/xtensa_createstack.c  |  4 ----
 arch/xtensa/src/common/xtensa_usestack.c     |  2 --
 arch/z16/include/tls.h                       |  3 ---
 arch/z16/src/common/z16_createstack.c        |  4 ----
 arch/z16/src/common/z16_usestack.c           |  2 --
 arch/z80/include/tls.h                       |  3 ---
 arch/z80/src/common/z80_createstack.c        |  4 ----
 arch/z80/src/common/z80_usestack.c           |  2 --
 include/nuttx/arch.h                         |  2 --
 include/nuttx/tls.h                          |  3 ---
 libs/libc/tls/Kconfig                        | 17 -----------------
 libs/libc/tls/Make.defs                      |  2 +-
 libs/libc/tls/tls_getelem.c                  |  4 ++--
 libs/libc/tls/tls_setelem.c                  |  4 ++--
 55 files changed, 22 insertions(+), 215 deletions(-)


[incubator-nuttx] 01/03: Remove CONFIG_TLS

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch errno
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit c2244a2382cf9c62937cc558cc947fae9f211b81
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Thu May 7 09:46:47 2020 -0600

    Remove CONFIG_TLS
    
    A first step in implementing the user-space error is force TLS to be enabled at all times.  It is no longer optional
---
 TODO                                         |  2 +-
 arch/Kconfig                                 |  2 --
 arch/arm/include/tls.h                       |  3 ---
 arch/arm/src/common/arm_createstack.c        | 16 +---------------
 arch/arm/src/common/arm_usestack.c           |  6 ------
 arch/avr/include/tls.h                       |  3 ---
 arch/avr/src/avr/up_createstack.c            |  5 +----
 arch/avr/src/avr/up_usestack.c               |  2 --
 arch/avr/src/avr32/up_createstack.c          |  4 ----
 arch/avr/src/avr32/up_usestack.c             |  2 --
 arch/hc/include/tls.h                        |  3 ---
 arch/hc/src/common/up_createstack.c          |  4 ----
 arch/hc/src/common/up_usestack.c             |  2 --
 arch/mips/include/tls.h                      |  3 ---
 arch/mips/src/common/mips_createstack.c      |  4 ----
 arch/mips/src/common/mips_usestack.c         |  2 --
 arch/misoc/include/tls.h                     |  3 ---
 arch/misoc/src/lm32/lm32_createstack.c       |  4 ----
 arch/misoc/src/minerva/minerva_createstack.c |  4 ----
 arch/or1k/include/tls.h                      |  3 ---
 arch/or1k/src/common/up_checkstack.c         |  6 +-----
 arch/or1k/src/common/up_createstack.c        | 16 +---------------
 arch/renesas/include/tls.h                   |  3 ---
 arch/renesas/src/common/up_createstack.c     |  4 ----
 arch/renesas/src/common/up_usestack.c        |  2 --
 arch/risc-v/include/tls.h                    |  3 ---
 arch/risc-v/src/common/riscv_checkstack.c    |  6 +-----
 arch/risc-v/src/common/riscv_createstack.c   | 15 +--------------
 arch/risc-v/src/common/riscv_usestack.c      |  2 --
 arch/sim/include/tls.h                       |  3 ---
 arch/sim/src/sim/up_createstack.c            | 20 +++-----------------
 arch/sim/src/sim/up_usestack.c               |  2 --
 arch/x86/include/tls.h                       |  3 ---
 arch/x86/src/i486/up_createstack.c           |  4 ----
 arch/x86/src/i486/up_usestack.c              |  2 --
 arch/x86_64/include/tls.h                    |  3 ---
 arch/x86_64/src/intel64/up_createstack.c     |  4 ----
 arch/x86_64/src/intel64/up_usestack.c        |  2 --
 arch/xtensa/include/tls.h                    |  3 ---
 arch/xtensa/src/common/xtensa_checkstack.c   |  4 ----
 arch/xtensa/src/common/xtensa_createstack.c  |  4 ----
 arch/xtensa/src/common/xtensa_usestack.c     |  2 --
 arch/z16/include/tls.h                       |  3 ---
 arch/z16/src/common/z16_createstack.c        |  4 ----
 arch/z16/src/common/z16_usestack.c           |  2 --
 arch/z80/include/tls.h                       |  3 ---
 arch/z80/src/common/z80_createstack.c        |  4 ----
 arch/z80/src/common/z80_usestack.c           |  2 --
 include/nuttx/arch.h                         |  2 --
 include/nuttx/tls.h                          |  3 ---
 libs/libc/tls/Kconfig                        | 17 -----------------
 libs/libc/tls/Make.defs                      |  2 +-
 libs/libc/tls/tls_getelem.c                  |  4 ++--
 libs/libc/tls/tls_setelem.c                  |  4 ++--
 54 files changed, 15 insertions(+), 225 deletions(-)

diff --git a/TODO b/TODO
index 5daf843..ed09fbc 100644
--- a/TODO
+++ b/TODO
@@ -1029,7 +1029,7 @@ o Kernel/Protected Build
                would not be an issue in the more general case.
 
                Update:
-               One solution might be to used CONFIG_TLS, add the PID to struct
+               One solution might be to use TLS, add the PID to struct
                tls_info_s.  Then the PID could be obtained without a system call.
                TLS is not very useful in the FLAT build, however.  TLS works by
                putting per-thread data at the bottom of an aligned stack.  The
diff --git a/arch/Kconfig b/arch/Kconfig
index 3c2000e..d157c4d 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -10,7 +10,6 @@ choice
 config ARCH_ARM
 	bool "ARM"
 	select ARCH_HAVE_INTERRUPTSTACK
-	select ARCH_HAVE_TLS
 	select ARCH_HAVE_VFORK
 	select ARCH_HAVE_STACKCHECK
 	select ARCH_HAVE_CUSTOMOPT
@@ -68,7 +67,6 @@ config ARCH_SIM
 	bool "Simulation"
 	select ARCH_HAVE_MULTICPU
 	select ARCH_HAVE_RTC_SUBSECONDS
-	select ARCH_HAVE_TLS
 	select ARCH_HAVE_TICKLESS
 	select ARCH_HAVE_POWEROFF
 	select ARCH_HAVE_TESTSET
diff --git a/arch/arm/include/tls.h b/arch/arm/include/tls.h
index 49c5045..c6d86fd 100644
--- a/arch/arm/include/tls.h
+++ b/arch/arm/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -92,5 +90,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_ARM_INCLUDE_TLS_H */
diff --git a/arch/arm/src/common/arm_createstack.c b/arch/arm/src/common/arm_createstack.c
index 62195dd..94a5855 100644
--- a/arch/arm/src/common/arm_createstack.c
+++ b/arch/arm/src/common/arm_createstack.c
@@ -102,7 +102,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -118,7 +117,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -190,7 +188,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 
   if (tcb->stack_alloc_ptr)
     {
-#if defined(CONFIG_TLS) && defined(CONFIG_STACK_COLORATION)
+#if defined(CONFIG_STACK_COLORATION)
       uintptr_t stack_base;
 #endif
       size_t top_of_stack;
@@ -224,7 +222,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
@@ -242,17 +239,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       arm_stack_color((FAR void *)stack_base, stack_size);
 
 #endif /* CONFIG_STACK_COLORATION */
-#else /* CONFIG_TLS */
-#ifdef CONFIG_STACK_COLORATION
-      /* If stack debug is enabled, then fill the stack with a
-       * recognizable value that we can use later to test for high
-       * water marks.
-       */
-
-      arm_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
-
-#endif /* CONFIG_STACK_COLORATION */
-#endif /* CONFIG_TLS */
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/arm/src/common/arm_usestack.c b/arch/arm/src/common/arm_usestack.c
index 7aee3e8..9605ffa 100644
--- a/arch/arm/src/common/arm_usestack.c
+++ b/arch/arm/src/common/arm_usestack.c
@@ -137,24 +137,18 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
 #ifdef CONFIG_STACK_COLORATION
   /* If stack debug is enabled, then fill the stack with a recognizable
    * value that we can use later to test for high water marks.
    */
 
-#ifdef CONFIG_TLS
   arm_stack_color((FAR void *)((uintptr_t)tcb->stack_alloc_ptr +
                  sizeof(struct tls_info_s)),
                  tcb->adj_stack_size - sizeof(struct tls_info_s));
-#else
-  arm_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
-#endif
 #endif
 
   return OK;
diff --git a/arch/avr/include/tls.h b/arch/avr/include/tls.h
index 06ed9f3..b308f77 100644
--- a/arch/avr/include/tls.h
+++ b/arch/avr/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_AVR_INCLUDE_TLS_H */
diff --git a/arch/avr/src/avr/up_createstack.c b/arch/avr/src/avr/up_createstack.c
index 859cb42..b29e186 100644
--- a/arch/avr/src/avr/up_createstack.c
+++ b/arch/avr/src/avr/up_createstack.c
@@ -101,7 +101,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -117,7 +116,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -139,6 +137,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
        * then create a zeroed stack to make stack dumps easier to trace.
        * If TLS is enabled, then we must allocate aligned stacks.
        */
+
 #ifdef CONFIG_TLS_ALIGNED
 #ifdef CONFIG_MM_KERNEL_HEAP
       /* Use the kernel allocator if this is a kernel thread */
@@ -212,11 +211,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (FAR void *)top_of_stack;
       tcb->adj_stack_size = stack_size;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
 #if defined(ARCH_HAVE_LEDS)
       board_autoled_on(LED_STACKCREATED);
diff --git a/arch/avr/src/avr/up_usestack.c b/arch/avr/src/avr/up_usestack.c
index 03d741d..c55279b 100644
--- a/arch/avr/src/avr/up_usestack.c
+++ b/arch/avr/src/avr/up_usestack.c
@@ -135,11 +135,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (FAR void *)top_of_stack;
   tcb->adj_stack_size = stack_size;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/avr/src/avr32/up_createstack.c b/arch/avr/src/avr32/up_createstack.c
index 8c6aba8..e5f6b04 100644
--- a/arch/avr/src/avr32/up_createstack.c
+++ b/arch/avr/src/avr32/up_createstack.c
@@ -106,7 +106,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -122,7 +121,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -226,11 +224,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (FAR void *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/avr/src/avr32/up_usestack.c b/arch/avr/src/avr32/up_usestack.c
index 8a4986c..7e33fe3 100644
--- a/arch/avr/src/avr32/up_usestack.c
+++ b/arch/avr/src/avr32/up_usestack.c
@@ -144,11 +144,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (FAR void *)top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/hc/include/tls.h b/arch/hc/include/tls.h
index a8a5bf6..a390f0b 100644
--- a/arch/hc/include/tls.h
+++ b/arch/hc/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -89,5 +87,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_HC_INCLUDE_TLS_H */
diff --git a/arch/hc/src/common/up_createstack.c b/arch/hc/src/common/up_createstack.c
index 5496859..8af9b4a 100644
--- a/arch/hc/src/common/up_createstack.c
+++ b/arch/hc/src/common/up_createstack.c
@@ -103,7 +103,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -119,7 +118,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -225,11 +223,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/hc/src/common/up_usestack.c b/arch/hc/src/common/up_usestack.c
index d3d5836..551aa7f 100644
--- a/arch/hc/src/common/up_usestack.c
+++ b/arch/hc/src/common/up_usestack.c
@@ -135,11 +135,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/mips/include/tls.h b/arch/mips/include/tls.h
index bd88d26..d29c0a0 100644
--- a/arch/mips/include/tls.h
+++ b/arch/mips/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -89,5 +87,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_MIPS_INCLUDE_TLS_H */
diff --git a/arch/mips/src/common/mips_createstack.c b/arch/mips/src/common/mips_createstack.c
index bc57aba..cfc6f9b 100644
--- a/arch/mips/src/common/mips_createstack.c
+++ b/arch/mips/src/common/mips_createstack.c
@@ -124,7 +124,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -140,7 +139,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -252,11 +250,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/mips/src/common/mips_usestack.c b/arch/mips/src/common/mips_usestack.c
index dc52292..246783c 100644
--- a/arch/mips/src/common/mips_usestack.c
+++ b/arch/mips/src/common/mips_usestack.c
@@ -161,11 +161,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/misoc/include/tls.h b/arch/misoc/include/tls.h
index 4b093ea..3fc95a1 100644
--- a/arch/misoc/include/tls.h
+++ b/arch/misoc/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -87,5 +85,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_MISOC_INCLUDE_TLS_H */
diff --git a/arch/misoc/src/lm32/lm32_createstack.c b/arch/misoc/src/lm32/lm32_createstack.c
index 6071440..f4bb62a 100644
--- a/arch/misoc/src/lm32/lm32_createstack.c
+++ b/arch/misoc/src/lm32/lm32_createstack.c
@@ -124,7 +124,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -140,7 +139,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -245,11 +243,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (FAR uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/misoc/src/minerva/minerva_createstack.c b/arch/misoc/src/minerva/minerva_createstack.c
index b493de1..702c483 100644
--- a/arch/misoc/src/minerva/minerva_createstack.c
+++ b/arch/misoc/src/minerva/minerva_createstack.c
@@ -116,7 +116,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -132,7 +131,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size? Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -238,11 +236,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr = (FAR uint32_t *) top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/or1k/include/tls.h b/arch/or1k/include/tls.h
index 1b8fd22..85759e2 100644
--- a/arch/or1k/include/tls.h
+++ b/arch/or1k/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -91,5 +89,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_OR1K_INCLUDE_TLS_H */
diff --git a/arch/or1k/src/common/up_checkstack.c b/arch/or1k/src/common/up_checkstack.c
index 506ec5e..964e600 100644
--- a/arch/or1k/src/common/up_checkstack.c
+++ b/arch/or1k/src/common/up_checkstack.c
@@ -97,7 +97,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
-#ifdef CONFIG_TLS
   if (!int_stack)
     {
       /* Skip over the TLS data structure at the bottom of the stack */
@@ -109,10 +108,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
     {
       start = alloc & ~3;
     }
-#else
-  UNUSED(int_stack);
-  start = alloc & ~3;
-#endif
+
   end   = (alloc + size + 3) & ~3;
 
   /* Get the adjusted size based on the top and bottom of the stack */
diff --git a/arch/or1k/src/common/up_createstack.c b/arch/or1k/src/common/up_createstack.c
index ffa8d80..5ad1c92 100644
--- a/arch/or1k/src/common/up_createstack.c
+++ b/arch/or1k/src/common/up_createstack.c
@@ -117,7 +117,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -133,7 +132,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -205,7 +203,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 
   if (tcb->stack_alloc_ptr)
     {
-#if defined(CONFIG_TLS) && defined(CONFIG_STACK_COLORATION)
+#if defined(CONFIG_STACK_COLORATION)
       uintptr_t stack_base;
 #endif
       size_t top_of_stack;
@@ -220,7 +218,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
@@ -238,17 +235,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       up_stack_color((FAR void *)stack_base, stack_size);
 
 #endif /* CONFIG_STACK_COLORATION */
-#else /* CONFIG_TLS */
-#ifdef CONFIG_STACK_COLORATION
-      /* If stack debug is enabled, then fill the stack with a
-       * recognizable value that we can use later to test for high
-       * water marks.
-       */
-
-      up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
-
-#endif /* CONFIG_STACK_COLORATION */
-#endif /* CONFIG_TLS */
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/renesas/include/tls.h b/arch/renesas/include/tls.h
index 8998cd8..97fd18e 100644
--- a/arch/renesas/include/tls.h
+++ b/arch/renesas/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_RENESAS_INCLUDE_TLS_H */
diff --git a/arch/renesas/src/common/up_createstack.c b/arch/renesas/src/common/up_createstack.c
index 88e6720..4b39bec 100644
--- a/arch/renesas/src/common/up_createstack.c
+++ b/arch/renesas/src/common/up_createstack.c
@@ -103,7 +103,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -119,7 +118,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -225,11 +223,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/renesas/src/common/up_usestack.c b/arch/renesas/src/common/up_usestack.c
index f7525e8..8ada7ba 100644
--- a/arch/renesas/src/common/up_usestack.c
+++ b/arch/renesas/src/common/up_usestack.c
@@ -134,11 +134,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr = top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/risc-v/include/tls.h b/arch/risc-v/include/tls.h
index 70afee9..a999b08 100644
--- a/arch/risc-v/include/tls.h
+++ b/arch/risc-v/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_RISCV_INCLUDE_TLS_H */
diff --git a/arch/risc-v/src/common/riscv_checkstack.c b/arch/risc-v/src/common/riscv_checkstack.c
index 3c87d67..c42707a 100644
--- a/arch/risc-v/src/common/riscv_checkstack.c
+++ b/arch/risc-v/src/common/riscv_checkstack.c
@@ -91,7 +91,6 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
-#ifdef CONFIG_TLS
   if (!int_stack)
     {
       /* Skip over the TLS data structure at the bottom of the stack */
@@ -103,10 +102,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
     {
       start = alloc & ~3;
     }
-#else
-  UNUSED(int_stack);
-  start = alloc & ~3;
-#endif
+
   end   = (alloc + size + 3) & ~3;
 
   /* Get the adjusted size based on the top and bottom of the stack */
diff --git a/arch/risc-v/src/common/riscv_createstack.c b/arch/risc-v/src/common/riscv_createstack.c
index 472e097..d6725d6 100644
--- a/arch/risc-v/src/common/riscv_createstack.c
+++ b/arch/risc-v/src/common/riscv_createstack.c
@@ -124,7 +124,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -140,7 +139,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -212,7 +210,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 
   if (tcb->stack_alloc_ptr)
     {
-#if defined(CONFIG_TLS) && defined(CONFIG_STACK_COLORATION)
+#if defined(CONFIG_STACK_COLORATION)
       uintptr_t stack_base;
 #endif
       size_t top_of_stack;
@@ -240,7 +238,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (FAR uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
@@ -258,16 +255,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       riscv_stack_color((FAR void *)stack_base, stack_size);
 
 #endif /* CONFIG_STACK_COLORATION */
-#else /* CONFIG_TLS */
-#ifdef CONFIG_STACK_COLORATION
-      /* If stack debug is enabled, then fill the stack with a
-       * recognizable value that we can use later to test for high
-       * water marks.
-       */
-
-      up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
-#endif /* CONFIG_STACK_COLORATION */
-#endif /* CONFIG_TLS */
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/risc-v/src/common/riscv_usestack.c b/arch/risc-v/src/common/riscv_usestack.c
index 8da809d..a6e07d9 100644
--- a/arch/risc-v/src/common/riscv_usestack.c
+++ b/arch/risc-v/src/common/riscv_usestack.c
@@ -155,11 +155,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (uintptr_t *)top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/sim/include/tls.h b/arch/sim/include/tls.h
index 0576cbd..a621069 100644
--- a/arch/sim/include/tls.h
+++ b/arch/sim/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -73,5 +71,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_SIM_INCLUDE_TLS_H */
diff --git a/arch/sim/src/sim/up_createstack.c b/arch/sim/src/sim/up_createstack.c
index 8a85f93..c268e05 100644
--- a/arch/sim/src/sim/up_createstack.c
+++ b/arch/sim/src/sim/up_createstack.c
@@ -106,7 +106,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
   FAR uint8_t *stack_alloc_ptr;
   int ret = ERROR;
 
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -122,7 +121,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Move up to next even word boundary if necessary */
 
@@ -133,15 +131,15 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 #ifdef CONFIG_TLS_ALIGNED
   stack_alloc_ptr = (FAR uint8_t *)kumm_memalign(TLS_STACK_ALIGN,
                                                  adj_stack_size);
-#else /* CONFIG_TLS */
+#else
   stack_alloc_ptr = (FAR uint8_t *)kumm_malloc(adj_stack_size);
-#endif /* CONFIG_TLS */
+#endif
 
   /* Was the allocation successful? */
 
   if (stack_alloc_ptr)
     {
-#if defined(CONFIG_TLS) && defined(CONFIG_STACK_COLORATION)
+#if defined(CONFIG_STACK_COLORATION)
       uintptr_t stack_base;
 #endif
 
@@ -160,7 +158,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->stack_alloc_ptr = stack_alloc_ptr;
       tcb->adj_stack_ptr   = (FAR void *)adj_stack_addr;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(stack_alloc_ptr, 0, sizeof(struct tls_info_s));
@@ -177,17 +174,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       up_stack_color((FAR void *)stack_base, stack_size);
 
 #endif /* CONFIG_STACK_COLORATION */
-#else /* CONFIG_TLS */
-#ifdef CONFIG_STACK_COLORATION
-      /* If stack debug is enabled, then fill the stack with a
-       * recognizable value that we can use later to test for high
-       * water marks.
-       */
-
-      up_stack_color(tcb->stack_alloc_ptr, tcb->adj_stack_size);
-
-#endif /* CONFIG_STACK_COLORATION */
-#endif /* CONFIG_TLS */
 
       ret = OK;
     }
diff --git a/arch/sim/src/sim/up_usestack.c b/arch/sim/src/sim/up_usestack.c
index 9325568..7174e2b 100644
--- a/arch/sim/src/sim/up_usestack.c
+++ b/arch/sim/src/sim/up_usestack.c
@@ -126,11 +126,9 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, size_t stack_size)
   tcb->stack_alloc_ptr = stack;
   tcb->adj_stack_ptr   = (FAR void *)adj_stack_addr;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(stack, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/x86/include/tls.h b/arch/x86/include/tls.h
index fbec9a2..0298349 100644
--- a/arch/x86/include/tls.h
+++ b/arch/x86/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_X86_INCLUDE_TLS_H */
diff --git a/arch/x86/src/i486/up_createstack.c b/arch/x86/src/i486/up_createstack.c
index 7e9a308..c629a83 100644
--- a/arch/x86/src/i486/up_createstack.c
+++ b/arch/x86/src/i486/up_createstack.c
@@ -105,7 +105,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -121,7 +120,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -225,11 +223,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/x86/src/i486/up_usestack.c b/arch/x86/src/i486/up_usestack.c
index 347d48c..77e1e24 100644
--- a/arch/x86/src/i486/up_usestack.c
+++ b/arch/x86/src/i486/up_usestack.c
@@ -134,11 +134,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/x86_64/include/tls.h b/arch/x86_64/include/tls.h
index e9462ab..51856b9 100644
--- a/arch/x86_64/include/tls.h
+++ b/arch/x86_64/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -74,5 +72,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_X86_64_INCLUDE_TLS_H */
diff --git a/arch/x86_64/src/intel64/up_createstack.c b/arch/x86_64/src/intel64/up_createstack.c
index 4d23d8f..c094171 100644
--- a/arch/x86_64/src/intel64/up_createstack.c
+++ b/arch/x86_64/src/intel64/up_createstack.c
@@ -90,7 +90,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -106,7 +105,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -213,11 +211,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (uint64_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/x86_64/src/intel64/up_usestack.c b/arch/x86_64/src/intel64/up_usestack.c
index dd5720f..0525c13 100644
--- a/arch/x86_64/src/intel64/up_usestack.c
+++ b/arch/x86_64/src/intel64/up_usestack.c
@@ -122,11 +122,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (uint64_t *)top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/xtensa/include/tls.h b/arch/xtensa/include/tls.h
index 33735ca..e351cf8 100644
--- a/arch/xtensa/include/tls.h
+++ b/arch/xtensa/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -91,5 +89,4 @@ static inline FAR struct tls_info_s *up_tls_info(void)
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_XTENSA_INCLUDE_TLS_H */
diff --git a/arch/xtensa/src/common/xtensa_checkstack.c b/arch/xtensa/src/common/xtensa_checkstack.c
index 7136a88..d9509c9 100644
--- a/arch/xtensa/src/common/xtensa_checkstack.c
+++ b/arch/xtensa/src/common/xtensa_checkstack.c
@@ -91,14 +91,10 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
-#ifdef CONFIG_TLS
   /* Skip over the TLS data structure at the bottom of the stack */
 
   DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
   start = alloc + sizeof(struct tls_info_s);
-#else
-  start = alloc & ~3;
-#endif
   end   = (alloc + size + 3) & ~3;
 
   /* Get the adjusted size based on the top and bottom of the stack */
diff --git a/arch/xtensa/src/common/xtensa_createstack.c b/arch/xtensa/src/common/xtensa_createstack.c
index 1166272..3f81596 100644
--- a/arch/xtensa/src/common/xtensa_createstack.c
+++ b/arch/xtensa/src/common/xtensa_createstack.c
@@ -121,7 +121,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
   uintptr_t cpstart;
 #endif
 
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -137,7 +136,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -287,11 +285,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (FAR uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/xtensa/src/common/xtensa_usestack.c b/arch/xtensa/src/common/xtensa_usestack.c
index 71fa7ba..b40f078 100644
--- a/arch/xtensa/src/common/xtensa_usestack.c
+++ b/arch/xtensa/src/common/xtensa_usestack.c
@@ -147,11 +147,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/z16/include/tls.h b/arch/z16/include/tls.h
index d2a1a16..be7de1d 100644
--- a/arch/z16/include/tls.h
+++ b/arch/z16/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -70,5 +68,4 @@
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_Z16_INCLUDE_TLS_H */
diff --git a/arch/z16/src/common/z16_createstack.c b/arch/z16/src/common/z16_createstack.c
index e77edec..c34f09e 100644
--- a/arch/z16/src/common/z16_createstack.c
+++ b/arch/z16/src/common/z16_createstack.c
@@ -84,7 +84,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -100,7 +99,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -204,11 +202,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/z16/src/common/z16_usestack.c b/arch/z16/src/common/z16_usestack.c
index 3ced8aa..9b6d649 100644
--- a/arch/z16/src/common/z16_usestack.c
+++ b/arch/z16/src/common/z16_usestack.c
@@ -119,11 +119,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_size = top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/arch/z80/include/tls.h b/arch/z80/include/tls.h
index 381a103..436976d 100644
--- a/arch/z80/include/tls.h
+++ b/arch/z80/include/tls.h
@@ -30,8 +30,6 @@
 #include <nuttx/arch.h>
 #include <nuttx/tls.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Inline Functions
  ****************************************************************************/
@@ -70,5 +68,4 @@
 #  define up_tls_info() tls_get_info()
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __ARCH_Z80_INCLUDE_TLS_H */
diff --git a/arch/z80/src/common/z80_createstack.c b/arch/z80/src/common/z80_createstack.c
index 59ab44d..bf70d66 100644
--- a/arch/z80/src/common/z80_createstack.c
+++ b/arch/z80/src/common/z80_createstack.c
@@ -88,7 +88,6 @@
 
 int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
 {
-#ifdef CONFIG_TLS
   /* Add the size of the TLS information structure */
 
   stack_size += sizeof(struct tls_info_s);
@@ -104,7 +103,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       stack_size = TLS_MAXSTACK;
     }
 #endif
-#endif
 
   /* Is there already a stack allocated of a different size?  Because of
    * alignment issues, stack_size might erroneously appear to be of a
@@ -209,11 +207,9 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
       tcb->adj_stack_ptr  = (FAR uint32_t *)top_of_stack;
       tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
       /* Initialize the TLS data structure */
 
       memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
       board_autoled_on(LED_STACKCREATED);
       return OK;
diff --git a/arch/z80/src/common/z80_usestack.c b/arch/z80/src/common/z80_usestack.c
index 2e746c0..3168ecf 100644
--- a/arch/z80/src/common/z80_usestack.c
+++ b/arch/z80/src/common/z80_usestack.c
@@ -118,11 +118,9 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
   tcb->adj_stack_size = top_of_stack;
   tcb->adj_stack_size = size_of_stack;
 
-#ifdef CONFIG_TLS
   /* Initialize the TLS data structure */
 
   memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s));
-#endif
 
   return OK;
 }
diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h
index 4551a10..53c6566 100644
--- a/include/nuttx/arch.h
+++ b/include/nuttx/arch.h
@@ -1695,14 +1695,12 @@ int up_timer_start(FAR const struct timespec *ts);
  *
  ****************************************************************************/
 
-#ifdef CONFIG_TLS
 /* struct tls_info_s;
  * FAR struct tls_info_s *up_tls_info(void);
  *
  * The actual declaration or definition is provided in arch/tls.h.  The
  * actual implementation may be a MACRO or and inline function.
  */
-#endif
 
 /****************************************************************************
  * Multiple CPU support
diff --git a/include/nuttx/tls.h b/include/nuttx/tls.h
index ba7a0c9..fb085ba 100644
--- a/include/nuttx/tls.h
+++ b/include/nuttx/tls.h
@@ -29,8 +29,6 @@
 
 #include <sys/types.h>
 
-#ifdef CONFIG_TLS
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -148,5 +146,4 @@ void tls_set_element(int elem, uintptr_t value);
 FAR struct tls_info_s *tls_get_info(void);
 #endif
 
-#endif /* CONFIG_TLS */
 #endif /* __INCLUDE_NUTTX_TLS_H */
diff --git a/libs/libc/tls/Kconfig b/libs/libc/tls/Kconfig
index 76b53ad..40a5180 100644
--- a/libs/libc/tls/Kconfig
+++ b/libs/libc/tls/Kconfig
@@ -3,23 +3,7 @@
 # see the file kconfig-language.txt in the NuttX tools repository.
 #
 
-config ARCH_HAVE_TLS
-	bool
-	default n
-	---help---
-		Selected by the configuration system if the current architecture
-		supports TLS.
-
 menu "Thread Local Storage (TLS)"
-	depends on ARCH_HAVE_TLS
-
-config TLS
-	bool "Thread Local Storage (TLS)"
-	default n
-	---help---
-		Build in support for stack based thread local storage (TLS).
-
-if TLS
 
 config TLS_ALIGNED
 	bool "Require stack alignment"
@@ -66,5 +50,4 @@ config TLS_NELEM
 		The number of unique TLS elements.  These can be accessed with
 		the user library functions tls_get_element() and tls_set_element().
 
-endif # TLS
 endmenu # Thread Local Storage (TLS)
diff --git a/libs/libc/tls/Make.defs b/libs/libc/tls/Make.defs
index e2fbbfb..934bcfa 100644
--- a/libs/libc/tls/Make.defs
+++ b/libs/libc/tls/Make.defs
@@ -18,7 +18,7 @@
 #
 ############################################################################
 
-ifeq ($(CONFIG_TLS),y)
+ifneq ($(CONFIG_TLS_NELEM),0)
 
 CSRCS += tls_setelem.c tls_getelem.c
 
diff --git a/libs/libc/tls/tls_getelem.c b/libs/libc/tls/tls_getelem.c
index cfa7cd6..af03e22 100644
--- a/libs/libc/tls/tls_getelem.c
+++ b/libs/libc/tls/tls_getelem.c
@@ -31,7 +31,7 @@
 #include <nuttx/tls.h>
 #include <arch/tls.h>
 
-#ifdef CONFIG_TLS
+#if CONFIG_TLS_NELEM > 0
 
 /****************************************************************************
  * Public Functions
@@ -75,4 +75,4 @@ uintptr_t tls_get_element(int elem)
   return ret;
 }
 
-#endif /* CONFIG_TLS */
+#endif /* CONFIG_TLS_NELEM > 0 */
diff --git a/libs/libc/tls/tls_setelem.c b/libs/libc/tls/tls_setelem.c
index 67121c7..6d301b8 100644
--- a/libs/libc/tls/tls_setelem.c
+++ b/libs/libc/tls/tls_setelem.c
@@ -31,7 +31,7 @@
 #include <nuttx/tls.h>
 #include <arch/tls.h>
 
-#ifdef CONFIG_TLS
+#if CONFIG_TLS_NELEM > 0
 
 /****************************************************************************
  * Public Functions
@@ -71,4 +71,4 @@ void tls_set_element(int elem, uintptr_t value)
     }
 }
 
-#endif /* CONFIG_TLS */
+#endif /* CONFIG_TLS_NELEM > 0 */


[incubator-nuttx] 02/03: arch/risc-v/src/common/riscv_createstack.c: Fix the stack_color name.

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch errno
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit e74899ff6d73faa05f548b8d92a28c2f44dd72f2
Author: Ouss4 <ab...@gmail.com>
AuthorDate: Thu May 7 18:31:02 2020 +0100

    arch/risc-v/src/common/riscv_createstack.c: Fix the stack_color name.
---
 arch/risc-v/src/common/riscv_createstack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/risc-v/src/common/riscv_createstack.c b/arch/risc-v/src/common/riscv_createstack.c
index d6725d6..318f798 100644
--- a/arch/risc-v/src/common/riscv_createstack.c
+++ b/arch/risc-v/src/common/riscv_createstack.c
@@ -252,7 +252,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
                    sizeof(struct tls_info_s);
       stack_size = tcb->adj_stack_size -
                    sizeof(struct tls_info_s);
-      riscv_stack_color((FAR void *)stack_base, stack_size);
+      up_stack_color((FAR void *)stack_base, stack_size);
 
 #endif /* CONFIG_STACK_COLORATION */
 


[incubator-nuttx] 03/03: arch/*/*_checkstack.c: Get aligned address only when CONFIG_TLS_ALIGNED is enabled.

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch errno
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit a6da3c2cb6a214b642fa09c48638f1442fdf9117
Author: Ouss4 <ab...@gmail.com>
AuthorDate: Thu May 7 18:50:07 2020 +0100

    arch/*/*_checkstack.c: Get aligned address only when CONFIG_TLS_ALIGNED is
          enabled.
---
 arch/arm/src/common/arm_checkstack.c       | 1 +
 arch/or1k/src/common/up_checkstack.c       | 5 +++++
 arch/risc-v/src/common/riscv_checkstack.c  | 5 +++++
 arch/xtensa/src/common/xtensa_checkstack.c | 6 ++++++
 4 files changed, 17 insertions(+)

diff --git a/arch/arm/src/common/arm_checkstack.c b/arch/arm/src/common/arm_checkstack.c
index 5ac36fd..ebdab95 100644
--- a/arch/arm/src/common/arm_checkstack.c
+++ b/arch/arm/src/common/arm_checkstack.c
@@ -108,6 +108,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
   UNUSED(int_stack);
   start = alloc & ~3;
 #endif
+
   end   = (alloc + size + 3) & ~3;
 
   /* Get the adjusted size based on the top and bottom of the stack */
diff --git a/arch/or1k/src/common/up_checkstack.c b/arch/or1k/src/common/up_checkstack.c
index 964e600..e6f4cd9 100644
--- a/arch/or1k/src/common/up_checkstack.c
+++ b/arch/or1k/src/common/up_checkstack.c
@@ -97,6 +97,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
+#ifdef CONFIG_TLS_ALIGNED
   if (!int_stack)
     {
       /* Skip over the TLS data structure at the bottom of the stack */
@@ -108,6 +109,10 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
     {
       start = alloc & ~3;
     }
+#else
+  UNUSED(int_stack);
+  start = alloc & ~3;
+#endif
 
   end   = (alloc + size + 3) & ~3;
 
diff --git a/arch/risc-v/src/common/riscv_checkstack.c b/arch/risc-v/src/common/riscv_checkstack.c
index c42707a..a8f28fa 100644
--- a/arch/risc-v/src/common/riscv_checkstack.c
+++ b/arch/risc-v/src/common/riscv_checkstack.c
@@ -91,6 +91,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
+#ifdef CONFIG_TLS_ALIGNED
   if (!int_stack)
     {
       /* Skip over the TLS data structure at the bottom of the stack */
@@ -102,6 +103,10 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
     {
       start = alloc & ~3;
     }
+#else
+  UNUSED(int_stack);
+  start = alloc & ~3;
+#endif
 
   end   = (alloc + size + 3) & ~3;
 
diff --git a/arch/xtensa/src/common/xtensa_checkstack.c b/arch/xtensa/src/common/xtensa_checkstack.c
index d9509c9..cbac16a 100644
--- a/arch/xtensa/src/common/xtensa_checkstack.c
+++ b/arch/xtensa/src/common/xtensa_checkstack.c
@@ -91,10 +91,16 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size)
 
   /* Get aligned addresses of the top and bottom of the stack */
 
+#ifdef CONFIG_TLS_ALIGNED
+
   /* Skip over the TLS data structure at the bottom of the stack */
 
   DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
   start = alloc + sizeof(struct tls_info_s);
+#else
+  start = alloc & ~3;
+#endif
+
   end   = (alloc + size + 3) & ~3;
 
   /* Get the adjusted size based on the top and bottom of the stack */