Commit 70685fb6 authored by Fangrui Song's avatar Fangrui Song Committed by Greg Kroah-Hartman
Browse files

riscv: vdso: Exclude .rodata from the PT_DYNAMIC segment



[ Upstream commit e0eb1b6b ]

.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 8f8c1ff8
("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: default avatarNathan Chancellor <nathan@kernel.org>
Closes: https://github.com/ClangBuiltLinux/linux/issues/2093


Signed-off-by: default avatarFangrui Song <i@maskray.me>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250602-riscv-vdso-v1-1-0620cf63cff0@maskray.me


Signed-off-by: default avatarPalmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9ef5d474
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment