From 39caf07089611bcd1ac01ac33907c77f415b93c5 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 28 Oct 2022 09:09:14 -0700 Subject: chip/mchp/lfw: Discard ARM.* sections Linking with clang/lld fails since it tries to include .ARM.exidx in the VECTOR region: ld.lld: error: section '.ARM.exidx' will not fit in region 'VECTOR': overflowed by 328 bytes We don't need the exception index table or exception table (see https://crrev.com/c/3857943). This matches the behavior in our other linker scripts: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/core/cortex-m/ec.lds.S;l=745;drc=84b2904dead700e10073080c54e69ea162d8a7c5 This change does not affect the gcc/ld build (identical output before and after). BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes Change-Id: I65df11f3ab0c439ea3d4ce2805afaac942b22a0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3989667 Reviewed-by: Diana Z Code-Coverage: Zoss --- chip/mchp/lfw/ec_lfw.ld | 8 ++++++++ chip/mchp/lfw/ec_lfw_416kb.ld | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/chip/mchp/lfw/ec_lfw.ld b/chip/mchp/lfw/ec_lfw.ld index 1c745d5d2a..d178a42280 100644 --- a/chip/mchp/lfw/ec_lfw.ld +++ b/chip/mchp/lfw/ec_lfw.ld @@ -82,4 +82,12 @@ SECTIONS } >SRAM __image_size = LOADADDR(.text) + SIZEOF(.text) - ORIGIN(VECTOR); + + /* + * Discard C++ exception index table and exception table. These are + * described in more detail in "Exception Handling ABI for ARM + * Architecture": + * https://github.com/ARM-software/abi-aa/blob/60a8eb8c55e999d74dac5e368fc9d7e36e38dda4/ehabi32/ehabi32.rst#54the-object-producer-interface + */ + /DISCARD/ : { *(.ARM.*) } } diff --git a/chip/mchp/lfw/ec_lfw_416kb.ld b/chip/mchp/lfw/ec_lfw_416kb.ld index 93d70ffbe8..c7dfacada3 100644 --- a/chip/mchp/lfw/ec_lfw_416kb.ld +++ b/chip/mchp/lfw/ec_lfw_416kb.ld @@ -86,4 +86,12 @@ SECTIONS } >SRAM __image_size = LOADADDR(.text) + SIZEOF(.text) - ORIGIN(VECTOR); + + /* + * Discard C++ exception index table and exception table. These are + * described in more detail in "Exception Handling ABI for ARM + * Architecture": + * https://github.com/ARM-software/abi-aa/blob/60a8eb8c55e999d74dac5e368fc9d7e36e38dda4/ehabi32/ehabi32.rst#54the-object-producer-interface + */ + /DISCARD/ : { *(.ARM.*) } } -- cgit v1.2.1