From f20da1746d3d5664b98c9efec3318c1a12074c46 Mon Sep 17 00:00:00 2001 From: Jonathon Penix Date: Mon, 6 May 2024 14:55:11 -0700 Subject: [PATCH] linker: lld: cortex_m: Place .ARM.exidx sections when using lld Currently, .ARM.exidx input sections are only handled when building with ld. When building with lld (and depending on the orphan section handling policy configured), a few issues can arise: 1. lld may produce warnings about the orphan section 2. lld may place the input .ARM.exidx sections in unexpected ways--it seems lld does place the .ARM.exidx input sections in the expected .ARM.exidx output section, but it places them at the end of the section (after '__exidx_end'). To resolve the possible warning and unexpected placement, explicitly handle .ARM.exidx sections when lld is used. (cherry picked from commit d77dc62d196b8f5f58622a05414002cbf40285ba) Original-Signed-off-by: Jonathon Penix GitOrigin-RevId: d77dc62d196b8f5f58622a05414002cbf40285ba Change-Id: I8d68a022962fc577047e80eac503b42fd90d284c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5520892 Reviewed-by: Ting Shen Tested-by: Ting Shen Commit-Queue: Ting Shen Tested-by: ChromeOS Prod (Robot) --- include/zephyr/arch/arm/cortex_m/scripts/linker.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld index da802647db1..6d5ba15ee6e 100644 --- a/include/zephyr/arch/arm/cortex_m/scripts/linker.ld +++ b/include/zephyr/arch/arm/cortex_m/scripts/linker.ld @@ -178,7 +178,7 @@ SECTIONS * section overlap. */ __exidx_start = .; -#if defined (__GCC_LINKER_CMD__) +#if defined (__GCC_LINKER_CMD__) || defined (__LLD_LINKER_CMD__) *(.ARM.exidx* gnu.linkonce.armexidx.*) #endif __exidx_end = .;