diff options
author | Kevin Brodsky <kevin.brodsky@arm.com> | 2023-01-02 13:24:46 +0000 |
---|---|---|
committer | Mark Rutland <mark.rutland@arm.com> | 2023-01-30 14:40:51 +0000 |
commit | 9f26a1c1f27bd6b5b66c265114848007fc22e4aa (patch) | |
tree | ae796ae053560dc9b053cefbf7f5d4d041956b13 | |
parent | 229002a9e6a3245315e3a2fedb8b0df0c904a0c6 (diff) | |
download | boot-wrapper-aarch64-9f26a1c1f27bd6b5b66c265114848007fc22e4aa.tar.gz |
model.lds.S: Quote file paths
Inserting arbitrary paths in a linker script verbatim can be
problematic, even if they don't contain whitespaces, as ld has a
special interpretation for certain special characters (such as @).
Fix this by quoting all user-provided paths in model.lds.S using the
preprocessor.
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
-rw-r--r-- | model.lds.S | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/model.lds.S b/model.lds.S index dacaa25..e07cbc0 100644 --- a/model.lds.S +++ b/model.lds.S @@ -7,6 +7,9 @@ * found in the LICENSE.txt file. */ +#define _STR(s) #s +#define STR(s) _STR(s) + #ifdef BOOTWRAPPER_32 OUTPUT_FORMAT("elf32-littlearm") OUTPUT_ARCH(arm) @@ -17,13 +20,13 @@ OUTPUT_ARCH(aarch64) TARGET(binary) #ifdef XEN -INPUT(XEN) +INPUT(STR(XEN)) #endif -INPUT(KERNEL) +INPUT(STR(KERNEL)) INPUT(./fdt.dtb) #ifdef USE_INITRD -INPUT(FILESYSTEM) +INPUT(STR(FILESYSTEM)) #endif ENTRY(_start) @@ -36,14 +39,14 @@ SECTIONS */ .kernel (PHYS_OFFSET + KERNEL_OFFSET): { kernel__start = .; - KERNEL + STR(KERNEL) kernel__end = .; } #ifdef XEN .xen (PHYS_OFFSET + XEN_OFFSET): { xen__start = .; - XEN + STR(XEN) xen__end = .; } @@ -62,7 +65,7 @@ SECTIONS #ifdef USE_INITRD .filesystem (PHYS_OFFSET + FS_OFFSET): { filesystem__start = .; - FILESYSTEM + STR(FILESYSTEM) filesystem__end = .; } #endif |