From cdc17f60dc8c26d15bf1b24479d5afa92e23205a Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Thu, 7 Nov 2013 03:33:20 +0100 Subject: [PATCH] * configure.ac: Add -freg-struct-return on all platforms that support it. --- ChangeLog | 5 +++++ conf/Makefile.common | 8 ++++---- configure.ac | 11 +++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc18000f7..c090177ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-11-07 Vladimir Serbinenko + + * configure.ac: Add -freg-struct-return on all platforms that + support it. + 2013-11-07 Vladimir Serbinenko * acinclude.m4: Use -Werror on parameter tests. diff --git a/conf/Makefile.common b/conf/Makefile.common index 9eaff2e49..33dbb0364 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -7,16 +7,16 @@ unexport LC_ALL # Platform specific options if COND_i386_pc - CFLAGS_PLATFORM += -mrtd -mregparm=3 -freg-struct-return + CFLAGS_PLATFORM += -mrtd -mregparm=3 endif if COND_i386_qemu - CFLAGS_PLATFORM += -mrtd -mregparm=3 -freg-struct-return + CFLAGS_PLATFORM += -mrtd -mregparm=3 endif if COND_i386_coreboot - CFLAGS_PLATFORM += -mrtd -mregparm=3 -freg-struct-return + CFLAGS_PLATFORM += -mrtd -mregparm=3 endif if COND_i386_ieee1275 - CFLAGS_PLATFORM += -mrtd -mregparm=3 -freg-struct-return + CFLAGS_PLATFORM += -mrtd -mregparm=3 endif if COND_mips_loongson CFLAGS_PLATFORM += -mexplicit-relocs diff --git a/configure.ac b/configure.ac index 338e267e3..96f90e48b 100644 --- a/configure.ac +++ b/configure.ac @@ -499,6 +499,17 @@ if test "x$target_cpu" = xi386; then fi fi +AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [ + CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_freg_struct_return=yes], + [grub_cv_cc_freg_struct_return=no]) +]) + +if test "x$grub_cv_cc_freg_struct_return" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return" +fi + if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then # Some toolchains enable these features by default, but they need # registers that aren't set up properly in GRUB.