Merge branch 'feature/update-toolchain-to-esp-15.2.0_20250929.4-6d3fdb7' into 'master'

Make Picolibc the default libc

See merge request espressif/esp-idf!43620
This commit is contained in:
Alexey Lapshin
2025-12-04 01:14:01 +04:00
114 changed files with 1693 additions and 546 deletions

View File

@@ -69,7 +69,9 @@
* And so forth...
*/
*(.rela.*)
#if CONFIG_LIBC_NEWLIB
*(.got .got.plt) /* TODO: GCC-382 */
#endif
#if !EH_FRAME_LINKING_ENABLED
*(.eh_frame_hdr)
*(.eh_frame)

View File

@@ -395,12 +395,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -428,12 +430,24 @@ SECTIONS
/* TLS data. */
ALIGNED_SYMBOL(4, _thread_local_start)
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata)
*(.tdata.*)
*(.tbss)
*(.tbss.*)
_thread_local_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_PICOLIBC_REENT_STUB()
_flash_rodata_align = ALIGNOF(.flash.rodata);

View File

@@ -217,6 +217,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -228,12 +231,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -288,24 +293,42 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
. = ALIGN(ALIGNOF(.flash.tbss));
_thread_local_data_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -318,7 +341,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
mapping[rodata_noload]

View File

@@ -346,6 +346,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -357,12 +360,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -417,24 +422,42 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
. = ALIGN(ALIGNOF(.flash.tbss));
_thread_local_data_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -447,7 +470,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
mapping[rodata_noload]

View File

@@ -402,6 +402,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -413,12 +416,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -473,32 +478,48 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
_thread_local_data_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.tbss));
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
#if CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
/* Align the end of flash rodata region as per PMP granularity to allow using the
* page alignment gap created while mapping the flash region into the PSRAM memory.
*/
. = ALIGN(_esp_pmp_align_size);
#endif // CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
_thread_local_data_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -511,7 +532,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
mapping[rodata_noload]

View File

@@ -398,6 +398,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -409,12 +412,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -469,24 +474,42 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
. = ALIGN(ALIGNOF(.flash.tbss));
_thread_local_data_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -499,7 +522,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
mapping[rodata_noload]

View File

@@ -244,6 +244,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -255,6 +258,7 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
@@ -262,6 +266,7 @@ SECTIONS
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -316,32 +321,48 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
_thread_local_data_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.tbss));
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
#if CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
/* Align the end of flash rodata region as per PMP granularity to allow using the
* page alignment gap created while mapping the flash region into the PSRAM memory.
*/
. = ALIGN(_esp_pmp_align_size);
#endif // CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
_thread_local_data_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -354,7 +375,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
mapping[rodata_noload]

View File

@@ -400,6 +400,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -411,12 +414,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -471,24 +476,42 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
. = ALIGN(ALIGNOF(.flash.tbss));
_thread_local_data_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -501,7 +524,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
mapping[rodata_noload]

View File

@@ -389,6 +389,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -400,12 +403,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -460,24 +465,42 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
. = ALIGN(ALIGNOF(.flash.tbss));
_thread_local_data_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -490,7 +513,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
mapping[rodata_noload]

View File

@@ -218,6 +218,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -229,12 +232,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -289,24 +294,42 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
. = ALIGN(ALIGNOF(.flash.tbss));
_thread_local_data_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
} > default_rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -319,7 +342,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
mapping[rodata_noload]

View File

@@ -426,6 +426,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -443,12 +446,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -503,32 +508,48 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
_thread_local_data_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.tbss));
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
#if CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
/* Align the end of flash rodata region as per PMP granularity to allow using the
* page alignment gap created while mapping the flash region into the PSRAM memory.
*/
. = ALIGN(_esp_pmp_align_size);
#endif // CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
_thread_local_data_end = ABSOLUTE(.);
} > rodata_seg_low
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
} > rodata_seg_low
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -541,7 +562,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
arrays[rodata_noload]

View File

@@ -388,6 +388,9 @@ SECTIONS
arrays[flash_rodata]
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -405,12 +408,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -460,11 +465,37 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
_thread_local_data_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.tbss));
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
#if CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
/* Align the end of flash rodata region as per PMP granularity to allow using the
@@ -472,20 +503,11 @@ SECTIONS
*/
. = ALIGN(_esp_pmp_align_size);
#endif // CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
_thread_local_data_end = ABSOLUTE(.);
} > rodata_seg_low
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
} > rodata_seg_low
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -498,7 +520,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
arrays[rodata_noload]
mapping[rodata_noload]

View File

@@ -397,12 +397,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -430,12 +432,24 @@ SECTIONS
/* TLS data. */
ALIGNED_SYMBOL(4, _thread_local_start)
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata)
*(.tdata.*)
*(.tbss)
*(.tbss.*)
_thread_local_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_PICOLIBC_REENT_STUB()
_flash_rodata_align = ALIGNOF(.flash.rodata);

View File

@@ -409,12 +409,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -442,12 +444,24 @@ SECTIONS
/* TLS data. */
ALIGNED_SYMBOL(4, _thread_local_start)
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata)
*(.tdata.*)
*(.tbss)
*(.tbss.*)
_thread_local_end = ABSOLUTE(.);
} > default_rodata_seg
ASSERT_PICOLIBC_REENT_STUB()
_flash_rodata_align = ALIGNOF(.flash.rodata);

View File

@@ -219,6 +219,9 @@ SECTIONS
mapping[flash_rodata]
#if CONFIG_LIBC_PICOLIBC
*(.got .got.plt) /* TODO: GCC-439 */
#endif
*(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */
*(.gnu.linkonce.r.*)
*(.rodata1)
@@ -236,12 +239,14 @@ SECTIONS
* Excluding crtbegin.o/crtend.o since IDF doesn't use the toolchain crt.
*/
ALIGNED_SYMBOL(4, __preinit_array_start)
ALIGNED_SYMBOL(4, __bothinit_array_start)
KEEP (*(.preinit_array))
__preinit_array_end = ABSOLUTE(.);
ALIGNED_SYMBOL(4, __init_array_start)
KEEP (*(SORT_BY_INIT_PRIORITY(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array.*)))
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);
__bothinit_array_end = ABSOLUTE(.);
/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
ALIGNED_SYMBOL(4, soc_reserved_memory_region_start)
@@ -296,32 +301,48 @@ SECTIONS
.flash.tdata :
{
/* Keep tdata and tbss sections contiguous (no gaps between them).
* The TLS runtime code calculates offsets assuming these sections are
* adjacent. Gaps would cause incorrect address calculations, leading
* to accessing wrong memory.
*
* Storing all TLS structures in flash increases binary size, but avoids
* runtime issues and reduces TLS allocations on the stack.
*/
/* tdata sections */
_thread_local_data_start = ABSOLUTE(.);
#if CONFIG_LIBC_PICOLIBC
_picolibc_reent_stub_start = ABSOLUTE(.);
KEEP(*(.tdata.errno))
#if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
/* Reproduce the public fields from struct _reent. */
KEEP(*(.tdata.tls_stdin))
KEEP(*(.tdata.tls_stdout))
KEEP(*(.tdata.tls_stderr))
#endif // CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
_picolibc_reent_stub_end = ABSOLUTE(.);
#endif // CONFIG_LIBC_PICOLIBC
*(.tdata .tdata.* .gnu.linkonce.td.*)
_thread_local_data_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.tbss));
/* tbss sections */
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
. = ALIGN(ALIGNOF(.flash.rodata_noload));
#if CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
/* Align the end of flash rodata region as per PMP granularity to allow using the
* page alignment gap created while mapping the flash region into the PSRAM memory.
*/
. = ALIGN(_esp_pmp_align_size);
#endif // CONFIG_SPIRAM_RODATA && CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION
_thread_local_data_end = ABSOLUTE(.);
} > rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.tbss)
.flash.tbss (NOLOAD) :
{
_thread_local_bss_start = ABSOLUTE(.);
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon .tcommon.*)
_thread_local_bss_end = ABSOLUTE(.);
} > rodata_seg
ASSERT_SECTIONS_GAP(.flash.tdata, .flash.rodata_noload)
ASSERT(_thread_local_data_end == _thread_local_bss_start,
"tdata and tbss must be contiguous.")
ASSERT_PICOLIBC_REENT_STUB()
/**
* This section contains all the rodata that is not used
@@ -334,7 +355,7 @@ SECTIONS
* driver to maintain the virtual address.
* NOLOAD rodata may not be included in this section.
*/
_rodata_reserved_end = ADDR(.flash.tbss);
_rodata_reserved_end = .;
arrays[rodata_noload]

View File

@@ -120,3 +120,14 @@ ASSERT((ADDR(NEXT_SECTION) == ADDR(PREV_SECTION) + SIZEOF(PREV_SECTION)), \
#else
#define FAST_REFLASHING_PADDING
#endif
#if CONFIG_LIBC_PICOLIBC
# if CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
# define PICOLIBC_REENT_STUB 16
# else
# define PICOLIBC_REENT_STUB 4
# endif
#define ASSERT_PICOLIBC_REENT_STUB() ASSERT((_picolibc_reent_stub_end - _picolibc_reent_stub_start) == PICOLIBC_REENT_STUB, "Newlib _reent stub have wrong size")
#else
#define ASSERT_PICOLIBC_REENT_STUB()
#endif

View File

@@ -197,6 +197,21 @@ static void core_intr_matrix_clear(void)
#endif // SOC_INT_CLIC_SUPPORTED
}
#if CONFIG_LIBC_PICOLIBC
FORCE_INLINE_ATTR IRAM_ATTR void init_pre_rtos_tls_area(int cpu_num)
{
/**
* Initialize the TLS area before RTOS starts, in case any code tries to access
* TLS variables.
*
* TODO IDF-14914: Currently, we only initialize errno, which is the first TLS
* variable as guaranteed by the linker script.
*/
static int s_errno_array[SOC_CPU_CORES_NUM];
esp_cpu_set_threadptr(&s_errno_array[cpu_num]);
}
#endif
#if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE
void startup_resume_other_cores(void)
{
@@ -217,6 +232,10 @@ void ESP_SYSTEM_IRAM_ATTR call_start_cpu1(void)
);
#endif //#ifdef __riscv
#if CONFIG_LIBC_PICOLIBC
init_pre_rtos_tls_area(1);
#endif
#if SOC_BRANCH_PREDICTOR_SUPPORTED
esp_cpu_branch_prediction_enable();
#endif //#if SOC_BRANCH_PREDICTOR_SUPPORTED
@@ -943,6 +962,10 @@ void IRAM_ATTR call_start_cpu0(void)
// Clear BSS. Please do not attempt to do any complex stuff (like early logging) before this.
init_bss(rst_reas);
#if CONFIG_LIBC_PICOLIBC
init_pre_rtos_tls_area(0);
#endif
// When the APP is loaded into ram for execution, some hardware initialization steps used to be executed in the
// bootloader are done here.
#if CONFIG_APP_BUILD_TYPE_RAM