Support grub-emu on x32 (ILP32 but with x86-64 instruction set)
* configure.ac: Remove -m64 from checks for -mcmodel=large and -mno-red-zone. These are always either unnecessary (x86_64-emu) or already in TARGET_CFLAGS at this point, and they produce incorrect results when building for x32. * grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Cast pointers to Elf64_Xword via grub_addr_t, in order to work on x32. * include/grub/x86_64/types.h (GRUB_TARGET_SIZEOF_VOID_P, GRUB_TARGET_SIZEOF_LONG): Define to 4 on x32.
This commit is contained in:
parent
4d94b2db58
commit
2a5a532c00
4 changed files with 22 additions and 5 deletions
|
@ -862,7 +862,7 @@ LDFLAGS="$TARGET_LDFLAGS"
|
|||
if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then
|
||||
# Use large model to support 4G memory
|
||||
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
|
||||
CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
|
||||
CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_mcmodel=yes],
|
||||
[grub_cv_cc_mcmodel=no])
|
||||
|
@ -877,7 +877,7 @@ fi
|
|||
if test "$target_cpu"-"$platform" = x86_64-efi; then
|
||||
# EFI writes to stack below %rsp, we must not use the red zone
|
||||
AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
|
||||
CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone"
|
||||
CFLAGS="$TARGET_CFLAGS -mno-red-zone"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_no_red_zone=yes],
|
||||
[grub_cv_cc_no_red_zone=no])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue