From ae114fb523efe908f9e807359e2f494ee64d2801 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 23 Jul 2025 21:52:31 +0930 Subject: [PATCH] PR 33197 [AVR] Incorrect syntax in generated ldscript Rearrange scripttempl/avr.sc to avoid oddities of shells expanding ${RELOCATING+stuff} in here documents where "stuff" contains quoted strings. Also I think it is better to avoid multi-line "stuff" as it can be tricky to spot the ending brace. --- ld/scripttempl/avr.sc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc index 4d9af7fcf2c..a902385a013 100644 --- a/ld/scripttempl/avr.sc +++ b/ld/scripttempl/avr.sc @@ -186,7 +186,9 @@ SECTIONS /* Internal text space or external memory. */ .text ${RELOCATING-0} : { - ${RELOCATING+*(.vectors) +EOF +test -z "${RELOCATING}" || cat <> 15); __RODATA_FLASH_START__ = __flmap << 15; __rodata_load_start = MAX (__data_load_end, __RODATA_FLASH_START__); -__rodata_start = __RODATA_ORIGIN__ + __rodata_load_start - __RODATA_FLASH_START__;} - +__rodata_start = __RODATA_ORIGIN__ + __rodata_load_start - __RODATA_FLASH_START__; +EOF +cat << EOF .rodata ${RELOCATING+ __rodata_start} ${RELOCATING-0} : ${RELOCATING+ AT (__rodata_load_start)} { *(.rodata) -- 2.47.2