[PATCH 1/2] windows: Fix relocation sections generation during module conversion from PE to ELF

Daniel Kiper via Grub-devel <[email protected]>
Newsgroups org.gnu.grub-devel
Message-ID <[email protected]>
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
were not affected due to lack of PE to ELF conversion step.

This patch fixes the issue...

Signed-off-by: Daniel Kiper <[email protected]>
---
 util/grub-pe2elf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/util/grub-pe2elf.c b/util/grub-pe2elf.c
index 11331294f..5d8d9c1de 100644
--- a/util/grub-pe2elf.c
+++ b/util/grub-pe2elf.c
@@ -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;
-- 
2.11.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.