nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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