From 09289fe4514170c5e33a1e75e6654e7f7aad60de 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/esp32h2/bootloader.ld | 3 +-- .../bootloader/subproject/main/ld/esp32s2/bootloader.ld | 3 +-- .../bootloader/subproject/main/ld/esp32s3/bootloader.ld | 3 +-- components/esp_common/common.lf | 2 ++ components/esp_system/ld/esp32/sections.ld.in | 2 -- components/esp_system/ld/esp32c3/sections.ld.in | 4 ---- components/esp_system/ld/esp32h2/sections.ld.in | 4 ---- components/esp_system/ld/esp32s2/sections.ld.in | 2 -- components/esp_system/ld/esp32s3/sections.ld.in | 2 -- 11 files changed, 7 insertions(+), 24 deletions(-) diff --git a/components/bootloader/subproject/main/ld/esp32/bootloader.ld b/components/bootloader/subproject/main/ld/esp32/bootloader.ld index 30e5a79c45..0f548ee33e 100644 --- a/components/bootloader/subproject/main/ld/esp32/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32/bootloader.ld @@ -111,8 +111,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -125,6 +123,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 c9b2da7612..377afa3ecb 100644 --- a/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld @@ -99,8 +99,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -113,6 +111,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/esp32h2/bootloader.ld b/components/bootloader/subproject/main/ld/esp32h2/bootloader.ld index c5648b815e..65ce41aa14 100644 --- a/components/bootloader/subproject/main/ld/esp32h2/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32h2/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 92e0126cf0..987ed54992 100644 --- a/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld @@ -99,8 +99,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -113,6 +111,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 0646fa5273..66924478ae 100644 --- a/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld @@ -134,8 +134,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -148,6 +146,7 @@ SECTIONS *(.rodata.*) *(.gnu.linkonce.r.*) *(.rodata1) + *(.sdata2 .sdata2.*) __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); *(.xt_except_table) *(.gcc_except_table) diff --git a/components/esp_common/common.lf b/components/esp_common/common.lf index afbb997e68..552b20afa1 100644 --- a/components/esp_common/common.lf +++ b/components/esp_common/common.lf @@ -32,3 +32,5 @@ entries: [sections:rodata] entries: .rodata+ + .sdata2+ + .srodata+ diff --git a/components/esp_system/ld/esp32/sections.ld.in b/components/esp_system/ld/esp32/sections.ld.in index c2a6c66c5b..03953146bb 100644 --- a/components/esp_system/ld/esp32/sections.ld.in +++ b/components/esp_system/ld/esp32/sections.ld.in @@ -182,8 +182,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) diff --git a/components/esp_system/ld/esp32c3/sections.ld.in b/components/esp_system/ld/esp32c3/sections.ld.in index e6fe6307a4..9458dc39c3 100644 --- a/components/esp_system/ld/esp32c3/sections.ld.in +++ b/components/esp_system/ld/esp32c3/sections.ld.in @@ -154,8 +154,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) @@ -333,8 +331,6 @@ SECTIONS *(.tdata.*) *(.tbss) *(.tbss.*) - *(.srodata) - *(.srodata.*) _thread_local_end = ABSOLUTE(.); _rodata_reserved_end = ABSOLUTE(.); . = ALIGN(ALIGNOF(.eh_frame)); diff --git a/components/esp_system/ld/esp32h2/sections.ld.in b/components/esp_system/ld/esp32h2/sections.ld.in index eaf8a5a41b..2c46a076e1 100644 --- a/components/esp_system/ld/esp32h2/sections.ld.in +++ b/components/esp_system/ld/esp32h2/sections.ld.in @@ -162,8 +162,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) @@ -341,8 +339,6 @@ SECTIONS *(.tdata.*) *(.tbss) *(.tbss.*) - *(.srodata) - *(.srodata.*) _thread_local_end = ABSOLUTE(.); _rodata_reserved_end = ABSOLUTE(.); . = ALIGN(ALIGNOF(.eh_frame)); diff --git a/components/esp_system/ld/esp32s2/sections.ld.in b/components/esp_system/ld/esp32s2/sections.ld.in index ff716c49cf..1b93b88d48 100644 --- a/components/esp_system/ld/esp32s2/sections.ld.in +++ b/components/esp_system/ld/esp32s2/sections.ld.in @@ -204,8 +204,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) diff --git a/components/esp_system/ld/esp32s3/sections.ld.in b/components/esp_system/ld/esp32s3/sections.ld.in index aff65b0f29..e8b7489335 100644 --- a/components/esp_system/ld/esp32s3/sections.ld.in +++ b/components/esp_system/ld/esp32s3/sections.ld.in @@ -196,8 +196,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr)