]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
windows: Fix relocation sections generation during module conversion from PE to ELF
authorDaniel Kiper <daniel.kiper@oracle.com>
Mon, 27 Oct 2025 15:56:39 +0000 (16:56 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 28 Oct 2025 11:19:35 +0000 (12:19 +0100)
The commit 98ad84328 (kern/dl: Check for the SHF_INFO_LINK flag in
grub_dl_relocate_symbols()) revealed a bug in the code converting PE
module images to ELF files. The missing SHF_INFO_LINK flag for SHT_REL
and SHT_RELA sections lead to hangs during GRUB load. This only happens
for the GRUB images generated on Windows platforms. The *NIX platforms
are not affected due to lack of PE to ELF conversion step.

This patch fixes the issue...

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
util/grub-pe2elf.c

index 11331294f1b2deb6f94414a65a1c6dd93818f1e0..5d8d9c1de6496be59c109e012e0d1687b6c0576d 100644 (file)
@@ -189,6 +189,7 @@ write_section_data (FILE* fp, const char *name, char *image,
 
           shdr[idx_reloc].sh_name = insert_string (relname);
           shdr[idx_reloc].sh_link = i;
+          shdr[idx_reloc].sh_flags = SHF_INFO_LINK;
           shdr[idx_reloc].sh_info = idx;
 
           shdr[idx].sh_name = shdr[idx_reloc].sh_name + 4;