hujun260 opened a new pull request, #18048:
URL: https://github.com/apache/nuttx/pull/18048

   ## Summary
   
   This PR adjusts the TLS_ALIGNED configuration default to be enabled for 
protected builds (BUILD_PROTECTED mode) in addition to kernel builds. Protected 
mode requires stack alignment similar to kernel mode to properly manage thread 
local storage at the beginning of stack memory allocations. This ensures 
consistent TLS behavior across both build modes.
   
   ### Changes Made
   - Modify TLS_ALIGNED default in libs/libc/tls/Kconfig
   - Change default from `BUILD_KERNEL` to `BUILD_KERNEL || BUILD_PROTECTED`
   - Ensure TLS stack alignment is automatically enabled for protected mode
   
   ### Impact
   
   • Functionality: Ensures proper TLS management in protected build mode
   • Compatibility: Automatically enables required alignment for protected 
builds
   • Consistency: Aligns TLS configuration requirements between kernel and 
protected modes
   • User Experience: Reduces configuration errors from missing TLS_ALIGNED in 
protected mode
   
   ### Testing
   
   Test Environment:
   
   • Host: Linux x86_64
   • Board: sim with protected build mode
   • Configuration: NuttX with BUILD_PROTECTED enabled
   
   Test Procedure:
   
   1. Built NuttX with BUILD_PROTECTED=y without explicit TLS_ALIGNED setting
   2. Verified TLS_ALIGNED was automatically enabled via default
   3. Created multiple threads and verified TLS data properly allocated at 
stack base
   4. Tested TLS_ALIGNED automatic disabling with other build modes (USER, FLAT)
   5. Verified backward compatibility with existing configurations
   6. Tested task creation and TLS initialization in protected mode
   7. Verified no regressions in kernel mode (BUILD_KERNEL) TLS handling
   
   Test Results:
   
   Protected Build Mode Configuration:
   - BUILD_PROTECTED=y (default)
   - TLS_ALIGNED: Automatically set to y ✅
   
   Thread Local Storage Verification:
   - Task 1: TLS properly allocated at stack base ✅
   - Task 2: TLS properly allocated at stack base ✅
   - Task 3: TLS properly allocated at stack base ✅
   
   Configuration Verification:
   - BUILD_KERNEL=y → TLS_ALIGNED=y ✅
   - BUILD_PROTECTED=y → TLS_ALIGNED=y ✅
   - BUILD_FLAT=y → TLS_ALIGNED=n ✅
   
   Verification:
   
   • ✅ TLS_ALIGNED automatically enabled for protected builds
   • ✅ TLS data structure properly allocated at stack base
   • ✅ No manual configuration needed for protected mode
   • ✅ Backward compatibility maintained for kernel mode
   • ✅ Flat and user build modes unaffected
   • ✅ No regressions in existing functionality
   • ✅ OSTest passed without issues
   
   ### Related Issues
   
   Ensures proper TLS configuration defaults for protected build mode in NuttX.


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