mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'fix/newlib_builds' into 'master'
Fix: newlib compatibility with libraries built with picolibc headers Closes IDF-15962 See merge request espressif/esp-idf!51013
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
-
|
||||||
|
re: "errno: TLS reference in ([^ ]+\\.a)\\([^)]*\\) mismatches non-TLS definition"
|
||||||
|
hint: "The library '{}' accessed errno as a TLS symbol, which is incompatible with CONFIG_LIBC_NEWLIB=y (errno via __errno()). Contact the library maintainer to rebuild it with the latest ESP-IDF, or pass -D__PICOLIBC_ERRNO_FUNCTION=__errno if the library is built outside ESP-IDF. Alternatively keep CONFIG_LIBC_PICOLIBC=y, which still provides the TLS errno symbol for older prebuilts."
|
||||||
|
match_to_output: True
|
||||||
@@ -11,13 +11,17 @@ if(CONFIG_IDF_TOOLCHAIN_GCC)
|
|||||||
idf_toolchain_remove_flags(COMPILE_OPTIONS "-mdisable-hardware-atomics")
|
idf_toolchain_remove_flags(COMPILE_OPTIONS "-mdisable-hardware-atomics")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
idf_toolchain_remove_flags(COMPILE_OPTIONS "-specs=picolibc.specs")
|
||||||
|
idf_toolchain_remove_flags(COMPILE_OPTIONS "-D__STDC_WANT_LIB_EXT1__=0")
|
||||||
|
# TODO GCC-495:remove
|
||||||
|
idf_toolchain_remove_flags(COMPILE_OPTIONS "-D__PICOLIBC_ERRNO_FUNCTION=__errno")
|
||||||
if(CONFIG_LIBC_PICOLIBC)
|
if(CONFIG_LIBC_PICOLIBC)
|
||||||
idf_toolchain_add_flags(COMPILE_OPTIONS "-specs=picolibc.specs")
|
idf_toolchain_add_flags(COMPILE_OPTIONS "-specs=picolibc.specs")
|
||||||
if(LIBC_PICOLIBC_NEWLIB_COMPATIBILITY)
|
# TODO GCC-495:remove
|
||||||
|
idf_toolchain_add_flags(COMPILE_OPTIONS "-D__PICOLIBC_ERRNO_FUNCTION=__errno")
|
||||||
|
if(CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY)
|
||||||
idf_toolchain_add_flags(COMPILE_OPTIONS "-D__STDC_WANT_LIB_EXT1__=0")
|
idf_toolchain_add_flags(COMPILE_OPTIONS "-D__STDC_WANT_LIB_EXT1__=0")
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
idf_toolchain_remove_flags(COMPILE_OPTIONS "-specs=picolibc.specs")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_LIBC_NEWLIB_NANO_FORMAT)
|
if(CONFIG_LIBC_NEWLIB_NANO_FORMAT)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -12,11 +12,10 @@
|
|||||||
* 'errno' is defined in the TDATA section. The linker script ensures that
|
* 'errno' is defined in the TDATA section. The linker script ensures that
|
||||||
* it is positioned at the beginning of the TDATA segment.
|
* it is positioned at the beginning of the TDATA segment.
|
||||||
*/
|
*/
|
||||||
|
#undef errno
|
||||||
__thread int errno __attribute__((section(".tdata.errno"))) = 0;
|
__thread int errno __attribute__((section(".tdata.errno"))) = 0;
|
||||||
|
|
||||||
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
|
|
||||||
int *__errno(void)
|
int *__errno(void)
|
||||||
{
|
{
|
||||||
return &errno;
|
return &errno;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ void IRAM_ATTR syscall_exit_tee(void)
|
|||||||
* 'errno' is defined in the TDATA section. The linker script ensures that
|
* 'errno' is defined in the TDATA section. The linker script ensures that
|
||||||
* it is positioned at the beginning of the TDATA segment.
|
* it is positioned at the beginning of the TDATA segment.
|
||||||
*/
|
*/
|
||||||
|
#undef errno
|
||||||
__thread int errno __attribute__((section(".tdata.errno"))) = 0;
|
__thread int errno __attribute__((section(".tdata.errno"))) = 0;
|
||||||
|
|
||||||
int *__errno(void)
|
int *__errno(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user