From 69b317368ed41ee5ea68ceeb76cee7c9532d4708 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/esp32c2/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/esp32c2/sections.ld.in | 4 ---- 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 -- 13 files changed, 8 insertions(+), 30 deletions(-) diff --git a/components/bootloader/subproject/main/ld/esp32/bootloader.ld b/components/bootloader/subproject/main/ld/esp32/bootloader.ld index 368096870d..bc97e33512 100644 --- a/components/bootloader/subproject/main/ld/esp32/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32/bootloader.ld @@ -119,8 +119,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -133,6 +131,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/esp32c2/bootloader.ld b/components/bootloader/subproject/main/ld/esp32c2/bootloader.ld index 89f176b998..e7f5d277d1 100644 --- a/components/bootloader/subproject/main/ld/esp32c2/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32c2/bootloader.ld @@ -107,8 +107,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -121,6 +119,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/esp32c3/bootloader.ld b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld index 78d13a9a35..32c834bab8 100644 --- a/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld @@ -107,8 +107,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -121,6 +119,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 30904347a0..a93a35ff0f 100644 --- a/components/bootloader/subproject/main/ld/esp32h2/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32h2/bootloader.ld @@ -105,8 +105,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -119,6 +117,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 acad2eed8a..a50bfb4c79 100644 --- a/components/bootloader/subproject/main/ld/esp32s2/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32s2/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/esp32s3/bootloader.ld b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld index 6445491368..e8b77b4111 100644 --- a/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld +++ b/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld @@ -142,8 +142,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) _data_end = ABSOLUTE(.); @@ -156,6 +154,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 db03190c95..aea30382a2 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/esp32c2/sections.ld.in b/components/esp_system/ld/esp32c2/sections.ld.in index 5876af3f8d..b1e1ef0a07 100644 --- a/components/esp_system/ld/esp32c2/sections.ld.in +++ b/components/esp_system/ld/esp32c2/sections.ld.in @@ -44,8 +44,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) @@ -226,8 +224,6 @@ SECTIONS *(.tdata.*) *(.tbss) *(.tbss.*) - *(.srodata) - *(.srodata.*) _thread_local_end = ABSOLUTE(.); _rodata_reserved_end = ABSOLUTE(.); . = ALIGN(4); diff --git a/components/esp_system/ld/esp32c3/sections.ld.in b/components/esp_system/ld/esp32c3/sections.ld.in index a990050275..8803f0254d 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 6424f2f19c..a49f22e70e 100644 --- a/components/esp_system/ld/esp32h2/sections.ld.in +++ b/components/esp_system/ld/esp32h2/sections.ld.in @@ -157,8 +157,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr) @@ -336,8 +334,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 c5580c4936..223bd8d291 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 3c9a482c06..6b668ca4f8 100644 --- a/components/esp_system/ld/esp32s3/sections.ld.in +++ b/components/esp_system/ld/esp32s3/sections.ld.in @@ -191,8 +191,6 @@ SECTIONS *(.sdata) *(.sdata.*) *(.gnu.linkonce.s.*) - *(.sdata2) - *(.sdata2.*) *(.gnu.linkonce.s2.*) *(.jcr)