2018-07-27 16:57:04 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-07-27 16:52:55 +00:00
|
|
|
From: Peter Jones <pjones@redhat.com>
|
2018-07-27 16:57:04 +00:00
|
|
|
Date: Tue, 26 Jun 2018 17:16:06 -0400
|
2018-07-27 16:52:55 +00:00
|
|
|
Subject: [PATCH] Make it so we can tell configure which cflags utils are built
|
|
|
|
with
|
|
|
|
|
|
|
|
This lets us have kernel.img be built with TARGET_CFLAGS but grub-mkimage and
|
|
|
|
friends built with HOST_CFLAGS. That in turn lets us build with an ARM compiler
|
|
|
|
that only has hard-float ABI versions of crt*.o and libgcc*, but still use soft
|
|
|
|
float for grub.efi.
|
|
|
|
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
|
---
|
2018-08-02 18:04:20 +00:00
|
|
|
configure.ac | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
|
conf/Makefile.common | 23 ++++++++++++-----------
|
|
|
|
gentpl.py | 8 ++++----
|
|
|
|
3 files changed, 64 insertions(+), 16 deletions(-)
|
2018-07-27 16:52:55 +00:00
|
|
|
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
2022-03-22 22:46:46 +00:00
|
|
|
index b50fb2e9897..b27573b3de5 100644
|
2018-07-27 16:52:55 +00:00
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
2022-03-22 22:46:46 +00:00
|
|
|
@@ -877,11 +877,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p
|
2018-07-27 16:52:55 +00:00
|
|
|
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
|
|
|
|
fi
|
|
|
|
|
|
|
|
+# Should grub utils get the host CFLAGS, or the target CFLAGS?
|
|
|
|
+AC_ARG_WITH([utils],
|
|
|
|
+ AS_HELP_STRING([--with-utils=host|target|build],
|
2018-07-27 16:57:04 +00:00
|
|
|
+ [choose which flags to build utilities with. (default=target)]),
|
2018-07-27 16:52:55 +00:00
|
|
|
+ [have_with_utils=y],
|
|
|
|
+ [have_with_utils=n])
|
|
|
|
+if test x"$have_with_utils" = xy ; then
|
|
|
|
+ with_utils="$withval"
|
2018-07-27 16:57:04 +00:00
|
|
|
+else
|
|
|
|
+ with_utils=target
|
2018-07-27 16:52:55 +00:00
|
|
|
+fi
|
|
|
|
+
|
|
|
|
# GRUB doesn't use float or doubles at all. Yet some toolchains may decide
|
|
|
|
# that floats are a good fit to run instead of what's written in the code.
|
|
|
|
# Given that floating point unit is disabled (if present to begin with)
|
|
|
|
# when GRUB is running which may result in various hard crashes.
|
|
|
|
-if test x"$platform" != xemu ; then
|
|
|
|
+if test x"$platform" != xemu -a x"$with_utils" == xtarget ; then
|
|
|
|
AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
|
|
|
|
grub_cv_target_cc_soft_float=no
|
|
|
|
if test "x$target_cpu" = xarm64; then
|
2022-03-22 22:46:46 +00:00
|
|
|
@@ -2011,6 +2023,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
|
2018-07-27 16:52:55 +00:00
|
|
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
|
|
|
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
|
|
|
|
|
|
|
|
+case "$with_utils" in
|
|
|
|
+ host)
|
|
|
|
+ UTILS_CFLAGS=$HOST_CFLAGS
|
|
|
|
+ UTILS_CPPFLAGS=$HOST_CPPFLAGS
|
|
|
|
+ UTILS_CCASFLAGS=$HOST_CCASFLAGS
|
|
|
|
+ UTILS_LDFLAGS=$HOST_LDFLAGS
|
|
|
|
+ ;;
|
|
|
|
+ target)
|
|
|
|
+ UTILS_CFLAGS=$TARGET_CFLAGS
|
|
|
|
+ UTILS_CPPFLAGS=$TARGET_CPPFLAGS
|
|
|
|
+ UTILS_CCASFLAGS=$TARGET_CCASFLAGS
|
|
|
|
+ UTILS_LDFLAGS=$TARGET_LDFLAGS
|
|
|
|
+ ;;
|
|
|
|
+ build)
|
|
|
|
+ UTILS_CFLAGS=$BUILD_CFLAGS
|
|
|
|
+ UTILS_CPPFLAGS=$BUILD_CPPFLAGS
|
|
|
|
+ UTILS_CCASFLAGS=$BUILD_CCASFLAGS
|
|
|
|
+ UTILS_LDFLAGS=$BUILD_LDFLAGS
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ AC_MSG_ERROR([--with-utils must be either host, target, or build])
|
|
|
|
+ ;;
|
|
|
|
+esac
|
2018-07-27 16:57:04 +00:00
|
|
|
+AC_MSG_NOTICE([Using $with_utils flags for utilities.])
|
2018-07-27 16:52:55 +00:00
|
|
|
+
|
2018-08-02 18:04:20 +00:00
|
|
|
+unset CFLAGS
|
|
|
|
+unset CPPFLAGS
|
|
|
|
+unset CCASFLAGS
|
|
|
|
+unset LDFLAGS
|
|
|
|
+
|
2018-07-27 16:52:55 +00:00
|
|
|
+AC_SUBST(UTILS_CFLAGS)
|
|
|
|
+AC_SUBST(UTILS_CPPFLAGS)
|
|
|
|
+AC_SUBST(UTILS_CCASFLAGS)
|
|
|
|
+AC_SUBST(UTILS_LDFLAGS)
|
|
|
|
+
|
|
|
|
GRUB_TARGET_CPU="${target_cpu}"
|
|
|
|
GRUB_PLATFORM="${platform}"
|
|
|
|
|
|
|
|
diff --git a/conf/Makefile.common b/conf/Makefile.common
|
2021-03-12 21:54:28 +00:00
|
|
|
index 5f0ef969857..2ff9b39357c 100644
|
2018-07-27 16:52:55 +00:00
|
|
|
--- a/conf/Makefile.common
|
|
|
|
+++ b/conf/Makefile.common
|
2018-08-02 18:04:20 +00:00
|
|
|
@@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
|
|
|
|
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
|
|
|
STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes
|
|
|
|
|
|
|
|
-CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
|
|
|
|
-LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
|
|
|
|
-CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
|
|
|
-CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
|
|
|
+CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_PLATFORM) -ffreestanding
|
|
|
|
+LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
|
|
|
|
+CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
|
|
|
+CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
|
|
|
|
|
|
|
CFLAGS_IMAGE = $(CFLAGS_PLATFORM) -fno-builtin
|
|
|
|
LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
|
2018-07-27 16:52:55 +00:00
|
|
|
CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
|
|
|
CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
|
|
|
|
|
|
|
-CFLAGS_PROGRAM =
|
|
|
|
-LDFLAGS_PROGRAM =
|
|
|
|
-CPPFLAGS_PROGRAM =
|
|
|
|
-CCASFLAGS_PROGRAM =
|
|
|
|
+CFLAGS_PROGRAM = $(UTILS_CFLAGS)
|
|
|
|
+LDFLAGS_PROGRAM = $(UTILS_LDFLAGS)
|
|
|
|
+CPPFLAGS_PROGRAM = $(UTILS_CPPFLAGS)
|
|
|
|
+CCASFLAGS_PROGRAM = $(UTILS_CCASFLAGS)
|
|
|
|
|
|
|
|
-CFLAGS_LIBRARY =
|
|
|
|
-CPPFLAGS_LIBRARY =
|
|
|
|
-CCASFLAGS_LIBRARY =
|
|
|
|
+CFLAGS_LIBRARY = $(UTILS_CFLAGS)
|
|
|
|
+LDFLAGS_LIBRARY = $(UTILS_LDFLAGS)
|
|
|
|
+CPPFLAGS_LIBRARY = $(UTILS_CPPFLAGS)
|
|
|
|
+CCASFLAGS_LIBRARY = $(UTILS_CCASFLAGS)
|
|
|
|
|
|
|
|
# Other variables
|
|
|
|
|
2018-08-02 18:04:20 +00:00
|
|
|
diff --git a/gentpl.py b/gentpl.py
|
2021-03-12 21:54:28 +00:00
|
|
|
index 34a4eba2b42..59f62ef9522 100644
|
2018-08-02 18:04:20 +00:00
|
|
|
--- a/gentpl.py
|
|
|
|
+++ b/gentpl.py
|
2019-08-15 06:01:31 +00:00
|
|
|
@@ -697,10 +697,10 @@ def module(defn, platform):
|
2018-08-02 18:04:20 +00:00
|
|
|
var_set(cname(defn) + "_SOURCES", platform_sources(defn, platform) + " ## platform sources")
|
|
|
|
var_set("nodist_" + cname(defn) + "_SOURCES", platform_nodist_sources(defn, platform) + " ## platform nodist sources")
|
|
|
|
var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform))
|
|
|
|
- var_set(cname(defn) + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(defn, platform))
|
|
|
|
- var_set(cname(defn) + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(defn, platform))
|
|
|
|
- var_set(cname(defn) + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(defn, platform))
|
|
|
|
- var_set(cname(defn) + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(defn, platform))
|
|
|
|
+ var_set(cname(defn) + "_CFLAGS", "$(CFLAGS_MODULE) " + platform_cflags(defn, platform))
|
|
|
|
+ var_set(cname(defn) + "_LDFLAGS", "$(LDFLAGS_MODULE) " + platform_ldflags(defn, platform))
|
|
|
|
+ var_set(cname(defn) + "_CPPFLAGS", "$(CPPFLAGS_MODULE) " + platform_cppflags(defn, platform))
|
|
|
|
+ var_set(cname(defn) + "_CCASFLAGS", "$(CCASFLAGS_MODULE) " + platform_ccasflags(defn, platform))
|
|
|
|
var_set(cname(defn) + "_DEPENDENCIES", "$(TARGET_OBJ2ELF) " + platform_dependencies(defn, platform))
|
|
|
|
|
|
|
|
gvar_add("dist_noinst_DATA", extra_dist(defn))
|