* [PATCH] riscv: Fix alignment of RELA sections in the linker scripts
@ 2023-06-21 15:06 Bin Meng
2023-06-26 16:31 ` Bin Meng
[not found] ` <SEZPR03MB806409552ACE0C6AD27ADBF5C127A@SEZPR03MB8064.apcprd03.prod.outlook.com>
0 siblings, 2 replies; 5+ messages in thread
From: Bin Meng @ 2023-06-21 15:06 UTC (permalink / raw)
To: u-boot; +Cc: Andrew Scull, Leo, Rick Chen, Simon Glass
In current linker script both .efi_runtime_rel and .rela.dyn sections
are of RELA type whose entry size is either 12 (RV32) or 24 (RV64).
These two are arranged as an continuous region on purpose so that the
prelink-riscv executable can fix up the PIE addresses in one loop.
However there is an 'ALIGN(8)' between these 2 sections which might
cause a gap to be inserted between thesse 2 sections to satify the
alignment requirement on RV32. This would break the assumption of
the prelink process and generate an unbootable image.
Fixes: 9a6569a043d3 ("riscv: Update alignment for some sections in linker scripts")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
---
This fix should go into the v2023.07 release.
arch/riscv/cpu/u-boot.lds | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/riscv/cpu/u-boot.lds b/arch/riscv/cpu/u-boot.lds
index 15b5cbc585..2ffe6ba3c8 100644
--- a/arch/riscv/cpu/u-boot.lds
+++ b/arch/riscv/cpu/u-boot.lds
@@ -48,7 +48,7 @@ SECTIONS
KEEP(*(SORT(__u_boot_list*)));
}
- . = ALIGN(4);
+ . = ALIGN(8);
.efi_runtime_rel : {
__efi_runtime_rel_start = .;
@@ -57,8 +57,6 @@ SECTIONS
__efi_runtime_rel_stop = .;
}
- . = ALIGN(8);
-
/DISCARD/ : { *(.rela.plt*) }
.rela.dyn : {
__rel_dyn_start = .;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] riscv: Fix alignment of RELA sections in the linker scripts
2023-06-21 15:06 [PATCH] riscv: Fix alignment of RELA sections in the linker scripts Bin Meng
@ 2023-06-26 16:31 ` Bin Meng
[not found] ` <SEZPR03MB806409552ACE0C6AD27ADBF5C127A@SEZPR03MB8064.apcprd03.prod.outlook.com>
1 sibling, 0 replies; 5+ messages in thread
From: Bin Meng @ 2023-06-26 16:31 UTC (permalink / raw)
To: Bin Meng; +Cc: u-boot, Andrew Scull, Leo, Rick Chen, Simon Glass
On Wed, Jun 21, 2023 at 11:07 PM Bin Meng <bmeng@tinylab.org> wrote:
>
> In current linker script both .efi_runtime_rel and .rela.dyn sections
> are of RELA type whose entry size is either 12 (RV32) or 24 (RV64).
> These two are arranged as an continuous region on purpose so that the
a continuous
> prelink-riscv executable can fix up the PIE addresses in one loop.
>
> However there is an 'ALIGN(8)' between these 2 sections which might
> cause a gap to be inserted between thesse 2 sections to satify the
typo: these, satisfy
> alignment requirement on RV32. This would break the assumption of
> the prelink process and generate an unbootable image.
>
> Fixes: 9a6569a043d3 ("riscv: Update alignment for some sections in linker scripts")
> Signed-off-by: Bin Meng <bmeng@tinylab.org>
>
> ---
> This fix should go into the v2023.07 release.
>
Rick, ping?
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <SEZPR03MB806409552ACE0C6AD27ADBF5C127A@SEZPR03MB8064.apcprd03.prod.outlook.com>]
* Re: [PATCH] riscv: Fix alignment of RELA sections in the linker scripts
[not found] ` <SEZPR03MB806409552ACE0C6AD27ADBF5C127A@SEZPR03MB8064.apcprd03.prod.outlook.com>
@ 2023-06-27 0:50 ` Rick Chen
2023-06-27 1:12 ` Bin Meng
0 siblings, 1 reply; 5+ messages in thread
From: Rick Chen @ 2023-06-27 0:50 UTC (permalink / raw)
To: Bin Meng; +Cc: bmeng, U-Boot Mailing List, ascull, Leo Liang, rick, Simon Glass
> From: Bin Meng <bmeng@tinylab.org>
> Sent: Wednesday, June 21, 2023 11:07 PM
> To: u-boot@lists.denx.de
> Cc: Andrew Scull <ascull@google.com>; Leo Yu-Chi Liang(梁育齊) <ycliang@andestech.com>; Rick Jian-Zhi Chen(陳建志) <rick@andestech.com>; Simon Glass <sjg@chromium.org>
> Subject: [PATCH] riscv: Fix alignment of RELA sections in the linker scripts
>
> In current linker script both .efi_runtime_rel and .rela.dyn sections are of RELA type whose entry size is either 12 (RV32) or 24 (RV64).
> These two are arranged as an continuous region on purpose so that the prelink-riscv executable can fix up the PIE addresses in one loop.
>
> However there is an 'ALIGN(8)' between these 2 sections which might cause a gap to be inserted between thesse 2 sections to satify the alignment requirement on RV32. This would break the assumption of the prelink process and generate an unbootable image.
>
> Fixes: 9a6569a043d3 ("riscv: Update alignment for some sections in linker scripts")
> Signed-off-by: Bin Meng <bmeng@tinylab.org>
>
> ---
> This fix should go into the v2023.07 release.
>
> arch/riscv/cpu/u-boot.lds | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Reviewed-by: Rick Chen <rick@andestech.com>
Hi Leo,
Please help to push this patch ASAP.
Thanks,
Rick
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] riscv: Fix alignment of RELA sections in the linker scripts
2023-06-27 0:50 ` Rick Chen
@ 2023-06-27 1:12 ` Bin Meng
2023-06-28 3:10 ` Leo Liang
0 siblings, 1 reply; 5+ messages in thread
From: Bin Meng @ 2023-06-27 1:12 UTC (permalink / raw)
To: Rick Chen
Cc: bmeng, U-Boot Mailing List, ascull, Leo Liang, rick, Simon Glass
On Tue, Jun 27, 2023 at 8:50 AM Rick Chen <rickchen36@gmail.com> wrote:
>
> > From: Bin Meng <bmeng@tinylab.org>
> > Sent: Wednesday, June 21, 2023 11:07 PM
> > To: u-boot@lists.denx.de
> > Cc: Andrew Scull <ascull@google.com>; Leo Yu-Chi Liang(梁育齊) <ycliang@andestech.com>; Rick Jian-Zhi Chen(陳建志) <rick@andestech.com>; Simon Glass <sjg@chromium.org>
> > Subject: [PATCH] riscv: Fix alignment of RELA sections in the linker scripts
> >
> > In current linker script both .efi_runtime_rel and .rela.dyn sections are of RELA type whose entry size is either 12 (RV32) or 24 (RV64).
> > These two are arranged as an continuous region on purpose so that the prelink-riscv executable can fix up the PIE addresses in one loop.
> >
> > However there is an 'ALIGN(8)' between these 2 sections which might cause a gap to be inserted between thesse 2 sections to satify the alignment requirement on RV32. This would break the assumption of the prelink process and generate an unbootable image.
> >
> > Fixes: 9a6569a043d3 ("riscv: Update alignment for some sections in linker scripts")
> > Signed-off-by: Bin Meng <bmeng@tinylab.org>
> >
> > ---
> > This fix should go into the v2023.07 release.
> >
> > arch/riscv/cpu/u-boot.lds | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
>
> Reviewed-by: Rick Chen <rick@andestech.com>
>
> Hi Leo,
>
> Please help to push this patch ASAP.
>
Thanks Rick. I will respin a v2 to fix the typos in the commit message.
Regards,
Bin
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] riscv: Fix alignment of RELA sections in the linker scripts
2023-06-27 1:12 ` Bin Meng
@ 2023-06-28 3:10 ` Leo Liang
0 siblings, 0 replies; 5+ messages in thread
From: Leo Liang @ 2023-06-28 3:10 UTC (permalink / raw)
To: Bin Meng; +Cc: Rick Chen, bmeng, U-Boot Mailing List, rick, ycliang
Hi Rick, Bin,
On Tue, Jun 27, 2023 at 09:12:35AM +0800, Bin Meng wrote:
> On Tue, Jun 27, 2023 at 8:50 AM Rick Chen <rickchen36@gmail.com> wrote:
> >
> > > From: Bin Meng <bmeng@tinylab.org>
> > > Sent: Wednesday, June 21, 2023 11:07 PM
> > > To: u-boot@lists.denx.de
> > > Cc: Andrew Scull <ascull@google.com>; Leo Yu-Chi Liang(梁育齊) <ycliang@andestech.com>; Rick Jian-Zhi Chen(陳建志) <rick@andestech.com>; Simon Glass <sjg@chromium.org>
> > > Subject: [PATCH] riscv: Fix alignment of RELA sections in the linker scripts
> > >
> > > In current linker script both .efi_runtime_rel and .rela.dyn sections are of RELA type whose entry size is either 12 (RV32) or 24 (RV64).
> > > These two are arranged as an continuous region on purpose so that the prelink-riscv executable can fix up the PIE addresses in one loop.
> > >
> > > However there is an 'ALIGN(8)' between these 2 sections which might cause a gap to be inserted between thesse 2 sections to satify the alignment requirement on RV32. This would break the assumption of the prelink process and generate an unbootable image.
> > >
> > > Fixes: 9a6569a043d3 ("riscv: Update alignment for some sections in linker scripts")
> > > Signed-off-by: Bin Meng <bmeng@tinylab.org>
> > >
> > > ---
> > > This fix should go into the v2023.07 release.
> > >
> > > arch/riscv/cpu/u-boot.lds | 4 +---
> > > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > Reviewed-by: Rick Chen <rick@andestech.com>
> >
> > Hi Leo,
> >
> > Please help to push this patch ASAP.
> >
>
> Thanks Rick. I will respin a v2 to fix the typos in the commit message.
>
> Regards,
> Bin
Thanks for the catch and the reminder.
The patch has been merged.
Best regards,
Leo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-28 3:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21 15:06 [PATCH] riscv: Fix alignment of RELA sections in the linker scripts Bin Meng
2023-06-26 16:31 ` Bin Meng
[not found] ` <SEZPR03MB806409552ACE0C6AD27ADBF5C127A@SEZPR03MB8064.apcprd03.prod.outlook.com>
2023-06-27 0:50 ` Rick Chen
2023-06-27 1:12 ` Bin Meng
2023-06-28 3:10 ` Leo Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox