Skip to content

Commit e0eb1b6

Browse files
MaskRaypalmer-dabbelt
authored andcommitted
riscv: vdso: Exclude .rodata from the PT_DYNAMIC segment
.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 8f8c1ff ("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 <[email protected]> Closes: ClangBuiltLinux/linux#2093 Signed-off-by: Fangrui Song <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 19272b3 commit e0eb1b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/kernel/vdso/vdso.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ SECTIONS
3030
*(.data .data.* .gnu.linkonce.d.*)
3131
*(.dynbss)
3232
*(.bss .bss.* .gnu.linkonce.b.*)
33-
}
33+
} :text
3434

3535
.note : { *(.note.*) } :text :note
3636

0 commit comments

Comments
 (0)