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

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