grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH] configure check for ld's --no-relax flag


From: Stanislav Kholmanskikh
Subject: [RFC PATCH] configure check for ld's --no-relax flag
Date: Fri, 1 Aug 2014 16:15:56 +0400

Early versions of binutils doesn't support --no-relax flag, so
commit 063f2a04d158ec1b275a925dfbae74b124708cde prevents building
with such versions.

Signed-off-by: Stanislav Kholmanskikh <address@hidden>
---
 conf/Makefile.common |    8 ++++++++
 configure.ac         |   10 ++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/conf/Makefile.common b/conf/Makefile.common
index e4c301f..5bda66f 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -8,11 +8,19 @@ unexport LC_ALL
 # Platform specific options
 if COND_sparc64_ieee1275
   CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
   LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
+endif
 endif
 if COND_sparc64_emu
   CFLAGS_PLATFORM += -mno-app-regs
+if COND_LD_SUPPORTS_NO_RELAX
   LDFLAGS_PLATFORM = -Wl,--no-relax
+else
+  LDFLAGS_PLATFORM = -mno-relax
+endif
 endif
 if COND_arm
 if !COND_emu
diff --git a/configure.ac b/configure.ac
index 8888c2f..282fded 100644
--- a/configure.ac
+++ b/configure.ac
@@ -516,6 +516,14 @@ fi
 
 TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
 
+AC_CACHE_CHECK([if the target C compiler supports -Wl,--no-relax], 
[grub_cv_target_cc_wl_no_relax_flag], [
+  LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
+
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+int main(void) { return 0; }
+]])], [grub_cv_target_cc_wl_no_relax_flag=yes], 
[grub_cv_target_cc_wl_no_relax_flag=no])
+])
+
 AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], 
[
   LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
 
@@ -1708,6 +1716,8 @@ AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test 
x$BOOT_TIME_STATS = x1])
 
 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
 
+AM_CONDITIONAL([COND_LD_SUPPORTS_NO_RELAX], [test 
x$grub_cv_target_cc_wl_no_relax_flag = xyes])
+
 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
 AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]