[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250603215218.GA3631276@ax162>
Date: Tue, 3 Jun 2025 14:52:18 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Fangrui Song <i@...kray.me>
Cc: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH] riscv: vdso: Exclude .rodata from the PT_DYNAMIC segment
On Mon, Jun 02, 2025 at 08:48:44PM -0700, Fangrui Song wrote:
> .rodata is implicitly included in the PT_DYNAMIC segment due to
> inheriting the segment of the preceding .dynamic section (in both GNU ld
> and LLD). When the .rodata section's size is not a multiple of 16
> bytes on riscv64, llvm-readelf will report a "PT_DYNAMIC dynamic table
> is invalid" warning. Note: in the presence of the .dynamic section, GNU
> readelf and llvm-readelf's -d option decodes the dynamic section using
> the section.
>
> This issue arose after commit 8f8c1ff879fab60f80f3a7aec3000f47e5b03ba9
> ("riscv: vdso.lds.S: remove hardcoded 0x800 .text start addr"), which
> placed .rodata directly after .dynamic by removing .eh_frame.
>
> This patch resolves the implicit inclusion into PT_DYNAMIC by explicitly
> specifying the :text output section phdr.
>
> Reported-by: Nathan Chancellor <nathan@...nel.org>
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2093
> Signed-off-by: Fangrui Song <i@...kray.me>
Tested-by: Nathan Chancellor <nathan@...nel.org>
> ---
> arch/riscv/kernel/vdso/vdso.lds.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/vdso/vdso.lds.S b/arch/riscv/kernel/vdso/vdso.lds.S
> index abc69cda0445b1f500a89b47deefa31349103f08..62e0410f69f09e2bbf27101c000d604193f525cb 100644
> --- a/arch/riscv/kernel/vdso/vdso.lds.S
> +++ b/arch/riscv/kernel/vdso/vdso.lds.S
> @@ -30,7 +30,7 @@ SECTIONS
> *(.data .data.* .gnu.linkonce.d.*)
> *(.dynbss)
> *(.bss .bss.* .gnu.linkonce.b.*)
> - }
> + } :text
>
> .note : { *(.note.*) } :text :note
>
>
> ---
> base-commit: 1a3f6980889df3fc90ad3e4a525061d2c138adba
> change-id: 20250602-riscv-vdso-13efdee34a24
>
> Best regards,
> --
> Fangrui Song <i@...kray.me>
>
Powered by blists - more mailing lists