firmware: Remove ALIGN in .rela.dyn in linker script
authorVivian Wang <dramforever@live.com>
Sun, 17 Sep 2023 17:52:49 +0000 (01:52 +0800)
committerAnup Patel <anup@brainfault.org>
Fri, 6 Oct 2023 03:51:21 +0000 (09:21 +0530)
The .rela.dyn section should be exactly the size of the relocations,
without padding. On RV64, .rela* sections are already aligned and
there's no need for padding. On RV32, this adds padding up to 4 bytes,
which, if present, confuses the relocation loop into processing an extra
entry past the end of .rela*, and it crashes with an invalid memory
access.

Fixes: 0f20e8adcf42 ("firmware: Support position independent execution")
Signed-off-by: Vivian Wang <dramforever@live.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
firmware/fw_base.ldS

index 3d68484ba5e37773af24d01d935b76338c0afafe..88b8dfd9cb56ce555efff900db6018f44b3ae6b5 100644 (file)
@@ -49,7 +49,6 @@
        .rela.dyn : {
                PROVIDE(__rel_dyn_start = .);
                *(.rela*)
-               . = ALIGN(8);
                PROVIDE(__rel_dyn_end = .);
        }