firmware: Remove ALIGN in .rela.dyn in linker script

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: 0f20e8adcf ("firmware: Support position independent execution")
Signed-off-by: Vivian Wang <dramforever@live.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Vivian Wang
2023-09-18 01:52:49 +08:00
committed by Anup Patel
parent 3669153e06
commit de525ac18d

View File

@@ -49,7 +49,6 @@
.rela.dyn : { .rela.dyn : {
PROVIDE(__rel_dyn_start = .); PROVIDE(__rel_dyn_start = .);
*(.rela*) *(.rela*)
. = ALIGN(8);
PROVIDE(__rel_dyn_end = .); PROVIDE(__rel_dyn_end = .);
} }