From 3bae3b8527b938db6413e0d9062c74fe0c0278e7 Mon Sep 17 00:00:00 2001 From: Colin Watson 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. #