nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone
f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
f725e3
Date: Wed, 13 Aug 2014 18:59:58 +0000
f725e3
Subject: [PATCH] Add powerpc little-endian (ppc64le) flags
f725e3
f725e3
libgcc dependency was removed *just* for this target because
f725e3
the distros that use ppc64el doesn't have 32-bit support on it.
f725e3
f725e3
* configure.ac: Add targets for powerpc64el and skip libgcc.
f725e3
* Makefile.am: Likewise.
f725e3
---
f725e3
 configure.ac          | 17 +++++++++++++++--
f725e3
 grub-core/Makefile.am |  2 ++
f725e3
 2 files changed, 17 insertions(+), 2 deletions(-)
f725e3
f725e3
diff --git a/configure.ac b/configure.ac
f725e3
index 2632e2dad9b..53fd7c73ee6 100644
f725e3
--- a/configure.ac
f725e3
+++ b/configure.ac
f725e3
@@ -142,6 +142,7 @@ if test "x$with_platform" = x; then
f725e3
     x86_64-*) platform=pc ;;
f725e3
     powerpc-*) platform=ieee1275 ;;
f725e3
     powerpc64-*) platform=ieee1275 ;;
f725e3
+    powerpc64le-*) platform=ieee1275 ;;
f725e3
     sparc64-*) platform=ieee1275 ;;
f725e3
     mipsel-*) platform=loongson ;;
f725e3
     mips-*) platform=arc ;;
f725e3
@@ -160,6 +161,7 @@ case "$target_cpu"-"$platform" in
f725e3
   x86_64-xen) ;;
f725e3
   x86_64-*) target_cpu=i386 ;;
f725e3
   powerpc64-ieee1275) target_cpu=powerpc ;;
f725e3
+  powerpc64le-ieee1275) target_cpu=powerpc ;;
f725e3
 esac
f725e3
 
f725e3
 # Check if the platform is supported, make final adjustments.
f725e3
@@ -604,6 +606,13 @@ if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
f725e3
   TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
f725e3
 fi
f725e3
 
f725e3
+if test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno; then
f725e3
+	LD_FORCE_LE=1
f725e3
+	TARGET_CFLAGS="$TARGET_CFLAGS -mbig-endian -DNO_LIBGCC=1"
f725e3
+	TARGET_CCASFLAGS="$TARGET_CCASFLAGS -mbig-endian"
f725e3
+	TARGET_LDFLAGS="$TARGET_LDFLAGS -static -mbig-endian"
f725e3
+fi
f725e3
+
f725e3
 if test "x$target_m32" = x1; then
f725e3
   # Force 32-bit mode.
f725e3
   TARGET_CFLAGS="$TARGET_CFLAGS -m32"
f725e3
@@ -1047,7 +1056,8 @@ else
f725e3
 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
f725e3
 fi
f725e3
 CPPFLAGS="$TARGET_CPPFLAGS"
f725e3
-if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
f725e3
+if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes \
f725e3
+	|| ( test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno ); then
f725e3
 TARGET_LIBGCC=
f725e3
 else
f725e3
 TARGET_LIBGCC=-lgcc
f725e3
@@ -1631,7 +1641,9 @@ if test x"$enable_werror" != xno ; then
f725e3
   HOST_CFLAGS="$HOST_CFLAGS -Werror"
f725e3
 fi
f725e3
 
f725e3
-if test "x$grub_cv_cc_target_clang" = xno; then
f725e3
+# if not clang or power LE, use static libgcc
f725e3
+if test "x$grub_cv_cc_target_clang" = xno \
f725e3
+   || ! ( test x$target_cpu = xpowerpc && test x$ac_cv_c_bigendian = xno ); then
f725e3
    TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
f725e3
 else
f725e3
    TARGET_LDFLAGS_STATIC_LIBGCC=
f725e3
@@ -1694,6 +1706,7 @@ AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu =
f725e3
 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
f725e3
 AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu])
f725e3
 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
f725e3
+AM_CONDITIONAL([COND_powerpc_le], [test x$target_cpu = xpowerpc -a x$ac_cv_c_bigendian = xno])
f725e3
 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
f725e3
 AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
f725e3
 AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
f725e3
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
f725e3
index 5c087c83b8f..cb7fd9f98e8 100644
f725e3
--- a/grub-core/Makefile.am
f725e3
+++ b/grub-core/Makefile.am
f725e3
@@ -84,8 +84,10 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
f725e3
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
f725e3
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
f725e3
 if !COND_clang
f725e3
+if !COND_powerpc_le
f725e3
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
f725e3
 endif
f725e3
+endif
f725e3
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
f725e3
 
f725e3
 if COND_i386_pc