From d77dc62d196b8f5f58622a05414002cbf40285ba 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. Signed-off-by: Jonathon Penix --- 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 da802647db1254..6d5ba15ee6e825 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 = .;