Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Fangrui Song <i@maskray.me>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH] riscv: vdso: Exclude .rodata from the PT_DYNAMIC segment
Date: Tue, 3 Jun 2025 14:52:18 -0700	[thread overview]
Message-ID: <20250603215218.GA3631276@ax162> (raw)
In-Reply-To: <20250602-riscv-vdso-v1-1-0620cf63cff0@maskray.me>

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@kernel.org>
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2093
> Signed-off-by: Fangrui Song <i@maskray.me>

Tested-by: Nathan Chancellor <nathan@kernel.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@maskray.me>
> 

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2025-06-03 21:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03  3:48 [PATCH] riscv: vdso: Exclude .rodata from the PT_DYNAMIC segment Fangrui Song
2025-06-03 21:52 ` Nathan Chancellor [this message]
2025-06-10 20:07   ` Palmer Dabbelt
2025-06-10 21:40 ` patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250603215218.GA3631276@ax162 \
    --to=nathan@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=i@maskray.me \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox