[PATCH 1/3] firmware: Remove ALIGN in .rela.dyn in linker script

Anup Patel anup at brainfault.org
Thu Oct 5 21:14:27 PDT 2023


On Sun, Sep 17, 2023 at 11:23 PM Vivian Wang <dramforever at live.com> wrote:
>
> 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 at live.com>

Looks good to me.

Reviewed-by: Anup Patel <anup at brainfault.org>

Thanks,
Anup

> ---
>  firmware/fw_base.ldS | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/firmware/fw_base.ldS b/firmware/fw_base.ldS
> index 3d68484..88b8dfd 100644
> --- a/firmware/fw_base.ldS
> +++ b/firmware/fw_base.ldS
> @@ -49,7 +49,6 @@
>         .rela.dyn : {
>                 PROVIDE(__rel_dyn_start = .);
>                 *(.rela*)
> -               . = ALIGN(8);
>                 PROVIDE(__rel_dyn_end = .);
>         }
>
> --
> 2.41.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list