DynamicLoader: Fix TLS on 32 bit platform

There were two problems with my previous implementation
- TLS was not allocated if nothing used it. There is a fallback
  initialization in _init_libc, but this was not enough if one of the
  init functions tried to access errno.
- __tls_get_addr was not resolved. If __tls_get_addr was called through
  a plt entry, everything would just break :(
This commit is contained in:
2025-06-06 16:27:07 +03:00
parent 00c6820825
commit 5ad7d7edb1
3 changed files with 22 additions and 16 deletions

View File

@@ -64,10 +64,6 @@ target_compile_definitions(objlibc PRIVATE __arch=${BANAN_ARCH})
target_compile_options(objlibc PRIVATE -O2 -g -Wstack-usage=512 -fno-exceptions -fpic -nolibc)
target_compile_options(objlibc PUBLIC -Wall -Wextra -Werror -Wno-error=stack-usage=)
if("${BANAN_ARCH}" STREQUAL "i686")
target_compile_definitions(objlibc PRIVATE __disable_thread_local_storage)
endif()
function(add_crtx crtx)
add_custom_target(${crtx}
COMMAND ${CMAKE_CXX_COMPILER} -c -o ${CMAKE_INSTALL_LIBDIR}/${crtx}.o ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/${crtx}.S