Blame SOURCES/0141-Add-powerpc-little-endian-ppc64le-flags.patch

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