]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
RISC-V: Segment fault for kernel purgatory when linking.
authorNelson Chu <nelson@rivosinc.com>
Mon, 29 Apr 2024 09:44:51 +0000 (17:44 +0800)
committerNelson Chu <nelson@rivosinc.com>
Mon, 27 May 2024 17:38:17 +0000 (01:38 +0800)
commit1d7a877a0f74a7b90d70ca8cc3c0db9461619b1a
tree1e179925fd667b8424bd753f08b888f7c825c10a
parent6f779908fd6d7c85197ab13949a9dc5e6d4f1458
RISC-V: Segment fault for kernel purgatory when linking.

This was originally reported by Ard Biesheuvel <ardb@kernel.org>.

The followings are reproduce steps,
https://lore.kernel.org/all/202404260640.9GQVTmrw-lkp@intel.com/T/#u

The segment fault happens in the riscv_elf_finish_dynamic_sections when the
output got section is an ABS.  Refer to MIPS code, they added an extra
bfd_is_abs_section check to avoid ABS got, so this seems the right and easier
way to go in the short-term.

bfd/
* elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Set sh_entsize
and fill the got entries only when the got isn't an ABS section, and
the size of got is larger than zero.  The similar goes for gotplt,
except we already reported error when the gotplt is an ABS.
bfd/elfnn-riscv.c