* [PATCH 0/3] Fix mingw compilation
@ 2025-05-01 20:34 Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 1/3] Fix error when cross-compiling for windows from unix-like OS Vladimir Serbinenko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Serbinenko @ 2025-05-01 20:34 UTC (permalink / raw)
To: grub-devel
This fixes mingw build of modules and kernel.
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] Fix error when cross-compiling for windows from unix-like OS
2025-05-01 20:34 [PATCH 0/3] Fix mingw compilation Vladimir Serbinenko
@ 2025-05-01 20:34 ` Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 2/3] compiler-rt: Add pei386_runtime_relocator stub Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 3/3] pe2elf: Set correct flag for relocation sections Vladimir Serbinenko
2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Serbinenko @ 2025-05-01 20:34 UTC (permalink / raw)
To: grub-devel; +Cc: Vladimir Serbinenko
In this case exeext doesn't match the expected value by autoconf
and so tests fail as autoconf looks for compiled binaries under
wrong name.
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
configure.ac | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/configure.ac b/configure.ac
index 83e3ddf90..e9c6ad8cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -575,12 +575,22 @@ tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_LIBS="$LIBS"
+tmp_EXEEXT="$EXEEXT"
+tmp_ac_exeext="$ac_exeext"
CC="$TARGET_CC"
CFLAGS="$TARGET_CFLAGS"
CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
LIBS=""
+case "$target_os" in
+ cygwin*|mingw32*|mingw64*) TARGET_EXEEXT=.exe ;;
+ *) TARGET_EXEEXT= ;;
+esac
+
+EXEEXT="$TARGET_EXEEXT"
+ac_exeext="$TARGET_EXEEXT"
+
if test "x$target_m32" = x1; then
# Force 32-bit mode.
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
@@ -1618,6 +1628,8 @@ CFLAGS="$tmp_CFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
+EXEEXT="$tmp_EXEEXT"
+ac_exeext="$tmp_ac_exeext"
#
# Check for options.
--
2.49.0
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] compiler-rt: Add pei386_runtime_relocator stub
2025-05-01 20:34 [PATCH 0/3] Fix mingw compilation Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 1/3] Fix error when cross-compiling for windows from unix-like OS Vladimir Serbinenko
@ 2025-05-01 20:34 ` Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 3/3] pe2elf: Set correct flag for relocation sections Vladimir Serbinenko
2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Serbinenko @ 2025-05-01 20:34 UTC (permalink / raw)
To: grub-devel; +Cc: Vladimir Serbinenko
It's inserted by mingw and is meaningless in our environment
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
grub-core/kern/compiler-rt.c | 4 ++++
include/grub/compiler-rt.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/grub-core/kern/compiler-rt.c b/grub-core/kern/compiler-rt.c
index eda689a0c..28d3c62fe 100644
--- a/grub-core/kern/compiler-rt.c
+++ b/grub-core/kern/compiler-rt.c
@@ -210,6 +210,10 @@ void ___chkstk_ms (void)
void __chkstk_ms (void)
{
}
+
+void _pei386_runtime_relocator (void)
+{
+}
#endif
union component64
diff --git a/include/grub/compiler-rt.h b/include/grub/compiler-rt.h
index 17828b322..e139ebc87 100644
--- a/include/grub/compiler-rt.h
+++ b/include/grub/compiler-rt.h
@@ -207,6 +207,7 @@ void EXPORT_FUNC (__register_frame_info) (void);
void EXPORT_FUNC (__deregister_frame_info) (void);
void EXPORT_FUNC (___chkstk_ms) (void);
void EXPORT_FUNC (__chkstk_ms) (void);
+void EXPORT_FUNC (_pei386_runtime_relocator) (void);
#endif
#endif
--
2.49.0
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] pe2elf: Set correct flag for relocation sections
2025-05-01 20:34 [PATCH 0/3] Fix mingw compilation Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 1/3] Fix error when cross-compiling for windows from unix-like OS Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 2/3] compiler-rt: Add pei386_runtime_relocator stub Vladimir Serbinenko
@ 2025-05-01 20:34 ` Vladimir Serbinenko
2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Serbinenko @ 2025-05-01 20:34 UTC (permalink / raw)
To: grub-devel; +Cc: Vladimir Serbinenko
Without this flag GRUB ignores the relocation section leading to a crash
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
util/grub-pe2elf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/grub-pe2elf.c b/util/grub-pe2elf.c
index 11331294f..b686f0c82 100644
--- a/util/grub-pe2elf.c
+++ b/util/grub-pe2elf.c
@@ -341,6 +341,7 @@ write_reloc_section (FILE* fp, const char *name, char *image,
shdr[i].sh_offset = offset;
shdr[i].sh_link = symtab_section;
shdr[i].sh_addralign = 4;
+ shdr[i].sh_flags = SHF_INFO_LINK;
shdr[i].sh_entsize = sizeof (elf_reloc_t);
shdr[i].sh_size = num_rels * sizeof (elf_reloc_t);
--
2.49.0
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-01 20:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-01 20:34 [PATCH 0/3] Fix mingw compilation Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 1/3] Fix error when cross-compiling for windows from unix-like OS Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 2/3] compiler-rt: Add pei386_runtime_relocator stub Vladimir Serbinenko
2025-05-01 20:34 ` [PATCH 3/3] pe2elf: Set correct flag for relocation sections Vladimir Serbinenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.