From 0f98788d594b835c3df5125d1da8592cc7c31b9a Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Fri, 17 Jun 2022 13:54:09 +0400 Subject: [PATCH] esp_system: Fix esp32c2/esp32c3/esp32h2 TLS size The change fixes thread-local-storage size by removing .srodata section from it. It initially was included in TLS section by mistake. The issue was found when stack size increased after building applications with GCC-11.1 compiler. Stack size became bigger because some new data appeared in .srodata. See more details here: https://github.com/gcc-mirror/gcc/commit/adce62f53d8ad00e8110a6a2de7962d7a850de16 --- components/bootloader/subproject/main/ld/esp32/bootloader.ld | 3 +-- .../bootloader/subproject/main/ld/esp32c3/bootloader.ld | 3 +-- .../bootloader/subproject/main/ld/esp32s2/bootloader.ld | 3 +-- .../bootloader/subproject/main/ld/esp32s3/bootloader.ld | 3 +-- components/esp32/ld/esp32.project.ld.in | 2 -- components/esp32/ld/esp32_fragments.lf | 1 + components/esp32c3/ld/esp32c3.project.ld.in | 4 ---- components/esp32c3/ld/esp32c3_fragments.lf | 2 ++ components/esp32s2/ld/esp32s2.project.ld.in | 2 -- components/esp32s2/ld/esp32s2_fragments.lf | 1 + components/esp32s3/ld/esp32s3.project.ld.in | 2 -- components/esp32s3/ld/esp32s3_fragments.lf | 1 + 12 files changed, 9 insertions(+), 18 deletions(-) diff --git a/components/bootloader/subproject/main/ld/esp32/bootloader.ld b/components/bootloader/subproject/main/ld/esp32/bootloader.ld index 63001e0942..4ecffa4c49 100644 --- a/components/bootloader/subproject/main/ld/esp32/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32/bootloader.ld @@ -108,8 +108,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -122,6 +120,7 @@ SECTIONS *(.rodata.*) *(.gnu.linkonce.r.*) *(.rodata1) + *(.sdata2 .sdata2.*) __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); *(.xt_except_table) *(.gcc_except_table) diff --git a/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld index 9955b4ef0f..5b2d4652dc 100644 --- a/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld @@ -97,8 +97,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -111,6 +109,7 @@ SECTIONS *(.rodata.*) *(.gnu.linkonce.r.*) *(.rodata1) + *(.sdata2 .sdata2.* .srodata .srodata.*) __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); *(.xt_except_table) *(.gcc_except_table) diff --git a/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld b/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld index d23c002dbf..df785fb685 100644 --- a/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld @@ -96,8 +96,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -110,6 +108,7 @@ SECTIONS *(.rodata.*) *(.gnu.linkonce.r.*) *(.rodata1) + *(.sdata2 .sdata2.*) __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); *(.xt_except_table) *(.gcc_except_table) diff --git a/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld index 8e8bbfd578..26963d3fda 100644 --- a/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld @@ -97,8 +97,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -111,6 +109,7 @@ SECTIONS *(.rodata.*) *(.gnu.linkonce.r.*) *(.rodata1) + *(.sdata2 .sdata2.*) __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); *(.xt_except_table) *(.gcc_except_table) diff --git a/components/esp32/ld/esp32.project.ld.in b/components/esp32/ld/esp32.project.ld.in index 266e3a9bc0..50a458ba78 100644 --- a/components/esp32/ld/esp32.project.ld.in +++ b/components/esp32/ld/esp32.project.ld.in @@ -197,8 +197,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) diff --git a/components/esp32/ld/esp32_fragments.lf b/components/esp32/ld/esp32_fragments.lf index 0a35e27ef0..e0d4d05e23 100644 --- a/components/esp32/ld/esp32_fragments.lf +++ b/components/esp32/ld/esp32_fragments.lf @@ -30,6 +30,7 @@ entries: [sections:rodata] entries: .rodata+ + .sdata2+ [sections:rtc_text] entries: diff --git a/components/esp32c3/ld/esp32c3.project.ld.in b/components/esp32c3/ld/esp32c3.project.ld.in index b36c4cbcb2..be44ca4eff 100644 --- a/components/esp32c3/ld/esp32c3.project.ld.in +++ b/components/esp32c3/ld/esp32c3.project.ld.in @@ -170,8 +170,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) @@ -370,8 +368,6 @@ SECTIONS *(.tdata.*) *(.tbss) *(.tbss.*) - *(.srodata) - *(.srodata.*) _thread_local_end = ABSOLUTE(.); _rodata_reserved_end = ABSOLUTE(.); . = ALIGN(4); diff --git a/components/esp32c3/ld/esp32c3_fragments.lf b/components/esp32c3/ld/esp32c3_fragments.lf index 3df531b55b..0c21d577eb 100644 --- a/components/esp32c3/ld/esp32c3_fragments.lf +++ b/components/esp32c3/ld/esp32c3_fragments.lf @@ -18,6 +18,8 @@ entries: [sections:rodata] entries: .rodata+ + .sdata2+ + .srodata+ [sections:rtc_text] entries: diff --git a/components/esp32s2/ld/esp32s2.project.ld.in b/components/esp32s2/ld/esp32s2.project.ld.in index 48b57b913a..318dc55ce3 100644 --- a/components/esp32s2/ld/esp32s2.project.ld.in +++ b/components/esp32s2/ld/esp32s2.project.ld.in @@ -205,8 +205,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) diff --git a/components/esp32s2/ld/esp32s2_fragments.lf b/components/esp32s2/ld/esp32s2_fragments.lf index 96cd3c5082..9b4fd403e6 100644 --- a/components/esp32s2/ld/esp32s2_fragments.lf +++ b/components/esp32s2/ld/esp32s2_fragments.lf @@ -18,6 +18,7 @@ entries: [sections:rodata] entries: .rodata+ + .sdata2+ [sections:rtc_text] entries: diff --git a/components/esp32s3/ld/esp32s3.project.ld.in b/components/esp32s3/ld/esp32s3.project.ld.in index 127dc79d9a..41466fd7cc 100644 --- a/components/esp32s3/ld/esp32s3.project.ld.in +++ b/components/esp32s3/ld/esp32s3.project.ld.in @@ -208,8 +208,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) diff --git a/components/esp32s3/ld/esp32s3_fragments.lf b/components/esp32s3/ld/esp32s3_fragments.lf index 3df531b55b..836204a719 100644 --- a/components/esp32s3/ld/esp32s3_fragments.lf +++ b/components/esp32s3/ld/esp32s3_fragments.lf @@ -18,6 +18,7 @@ entries: [sections:rodata] entries: .rodata+ + .sdata2+ [sections:rtc_text] entries: