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

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