Apply the arm64 -mpc-relative-literal-loads workaround in configure rather than in debian/rules, to cope with toolchains that don't have the relevant patch applied.

This commit is contained in:
Colin Watson 2016-01-22 11:00:21 +00:00
commit a2b59ff2d4
6 changed files with 64 additions and 10 deletions

View File

@ -936,6 +936,21 @@ if test "x$grub_cv_target_cc_qn" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -Qn"
fi
if test "x$target_cpu" = xarm64; then
# Work around unsupported relocations as reported in
# https://lists.gnu.org/archive/html/grub-devel/2015-12/msg00092.html; see
# also: https://bugs.launchpad.net/bugs/1533009
AC_CACHE_CHECK([whether option -mpc-relative-literal-loads], grub_cv_cc_mpc_relative_literal_loads, [
CFLAGS="$TARGET_CFLAGS -mpc-relative-literal-loads -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_mpc_relative_literal_loads=yes],
[grub_cv_cc_mpc_relative_literal_loads=no])
])
if test "x$grub_cv_cc_mpc_relative_literal_loads" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -mpc-relative-literal-loads"
fi
fi
#
# Compiler features.
#

4
debian/.git-dpm vendored
View File

@ -1,6 +1,6 @@
# see git-dpm(1) from git-dpm package
c9ca44d13eddc6e44de5caa166bda1a89fbddfc0
c9ca44d13eddc6e44de5caa166bda1a89fbddfc0
3bae3b8527b938db6413e0d9062c74fe0c0278e7
3bae3b8527b938db6413e0d9062c74fe0c0278e7
e8f07821cce1bd0ab6d5622c2a42440f15f4fd71
e8f07821cce1bd0ab6d5622c2a42440f15f4fd71
grub2_2.02~beta2.orig.tar.xz

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
grub2 (2.02~beta2-35) UNRELEASED; urgency=medium
* Apply the arm64 -mpc-relative-literal-loads workaround in configure
rather than in debian/rules, to cope with toolchains that don't have the
relevant patch applied.
-- Colin Watson <cjwatson@debian.org> Fri, 22 Jan 2016 11:00:44 +0000
grub2 (2.02~beta2-34) unstable; urgency=medium
[ Colin Watson ]

View File

@ -0,0 +1,38 @@
From 3bae3b8527b938db6413e0d9062c74fe0c0278e7 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Fri, 22 Jan 2016 10:58:53 +0000
Subject: Work around unsupported relocations on arm64
The patch for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63304 causes
the toolchain to emit relocations that GRUB does not support.
-mpc-relative-literal-loads works around this.
---
configure.ac | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/configure.ac b/configure.ac
index 24b9cbf..010175d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -936,6 +936,21 @@ if test "x$grub_cv_target_cc_qn" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -Qn"
fi
+if test "x$target_cpu" = xarm64; then
+ # Work around unsupported relocations as reported in
+ # https://lists.gnu.org/archive/html/grub-devel/2015-12/msg00092.html; see
+ # also: https://bugs.launchpad.net/bugs/1533009
+ AC_CACHE_CHECK([whether option -mpc-relative-literal-loads], grub_cv_cc_mpc_relative_literal_loads, [
+ CFLAGS="$TARGET_CFLAGS -mpc-relative-literal-loads -Werror"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ [grub_cv_cc_mpc_relative_literal_loads=yes],
+ [grub_cv_cc_mpc_relative_literal_loads=no])
+ ])
+ if test "x$grub_cv_cc_mpc_relative_literal_loads" = xyes; then
+ TARGET_CFLAGS="$TARGET_CFLAGS -mpc-relative-literal-loads"
+ fi
+fi
+
#
# Compiler features.
#

View File

@ -96,3 +96,4 @@ zfs-hole-birth.patch
zfs-embedded-data.patch
zfs-zap-lookup-truncation.patch
zfs-extensible-dataset-large-blocks.patch
0099-Work-around-unsupported-relocations-on-arm64.patch

8
debian/rules vendored
View File

@ -22,14 +22,6 @@ export HOST_CFLAGS
export HOST_LDFLAGS
export TARGET_CPPFLAGS := -Wno-unused-but-set-variable
ifeq ($(DEB_HOST_ARCH),arm64)
# Work around unsupported relocations as reported in
# https://lists.gnu.org/archive/html/grub-devel/2015-12/msg00092.html; see
# also:
# https://bugs.launchpad.net/bugs/1533009
export TARGET_CFLAGS := -Os -mpc-relative-literal-loads
endif
ifeq (,$(shell which qemu-system-i386 2>/dev/null))
with_check := no
else