Skip to content

Conversation

@hujun260
Copy link
Contributor

Improve tls_get_info function availability in different build configurations

Simplify the conditional compilation logic for the tls_get_info() function in
libs/libc/tls/tls_getinfo.c. The function is essential for TLS management and
should be available in most build configurations. By removing the restrictive
CONFIG_TLS_ALIGNED dependency and implementing an explicit undef directive,
the implementation ensures broader availability while maintaining proper control
over macro definitions.

###Summary

  • Modify conditional compilation from complex multi-condition check to simpler up_tls_info check
  • Add explicit undef directive for tls_get_info to prevent macro definition conflicts
  • Ensure tls_get_info function is compiled and available in most configurations instead of being limited to kernel or non-aligned TLS builds

#TEST

In FlatBuild, if we use the CONFIG_TLS_ALIGNED=y and also utilize poll, the following compilation error will occur.

for example:
make distclean -j20; ./tools/configure.sh -l fvp-armv8r:nsh;make -j25;

LD: nuttx
aarch64-none-elf-ld: /home/hujun5/downloads/vela_sim/nuttx/staging/libfs.a(fs_poll.o): in function `poll':
/home/hujun5/downloads/vela_sim/nuttx/fs/vfs/fs_poll.c:470:(.text.poll+0x114): undefined reference to `tls_get_info'
aarch64-none-elf-ld: /home/hujun5/downloads/vela_sim/nuttx/fs/vfs/fs_poll.c:521:(.text.poll+0x14c): undefined reference to `tls_get_info'
Memory region         Used Size  Region Size  %age Used
           ksram:        288 KB       128 MB      0.22%

Simplify the compilation condition for tls_get_info() by removing the
CONFIG_TLS_ALIGNED check and adding an undef directive to ensure the function
is available in most cases rather than being limited to kernel or non-aligned TLS builds.

Signed-off-by: hujun5 <[email protected]>
@github-actions github-actions bot added Area: OS Components OS Components issues Size: XS The size of the change in this PR is very small labels Jan 30, 2026
@xiaoxiang781216 xiaoxiang781216 merged commit 71b7493 into apache:master Jan 30, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: OS Components OS Components issues Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants