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