Blame SOURCES/0123-Make-it-possible-to-enabled-build-id-sha1.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Peter Jones <pjones@redhat.com>
8631a2
Date: Thu, 25 Jun 2015 15:41:06 -0400
8631a2
Subject: [PATCH] Make it possible to enabled --build-id=sha1
8631a2
8631a2
Signed-off-by: Peter Jones <pjones@redhat.com>
8631a2
---
8631a2
 configure.ac |  8 ++++++++
8631a2
 acinclude.m4 | 19 +++++++++++++++++++
8631a2
 2 files changed, 27 insertions(+)
8631a2
8631a2
diff --git a/configure.ac b/configure.ac
8631a2
index f69f8986791..359cac3c26b 100644
8631a2
--- a/configure.ac
8631a2
+++ b/configure.ac
8631a2
@@ -1386,7 +1386,15 @@ grub_PROG_TARGET_CC
8631a2
 if test "x$TARGET_APPLE_LINKER" != x1 ; then
8631a2
 grub_PROG_OBJCOPY_ABSOLUTE
8631a2
 fi
8631a2
+
8631a2
+AC_ARG_ENABLE([build-id],
8631a2
+	      [AS_HELP_STRING([--enable-build-id],
8631a2
+                             [ask the linker to supply build-id notes (default=no)])])
8631a2
+if test x$enable_build_id = xyes; then
8631a2
+grub_PROG_LD_BUILD_ID_SHA1
8631a2
+else
8631a2
 grub_PROG_LD_BUILD_ID_NONE
8631a2
+fi
8631a2
 if test "x$target_cpu" = xi386; then
8631a2
   if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
8631a2
     if test ! -z "$TARGET_IMG_LDSCRIPT"; then
8631a2
diff --git a/acinclude.m4 b/acinclude.m4
8631a2
index 78cdf6e1d01..242e829ff23 100644
8631a2
--- a/acinclude.m4
8631a2
+++ b/acinclude.m4
8631a2
@@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
8631a2
 fi
8631a2
 ])
8631a2
 
8631a2
+dnl Supply --build-id=sha1 to ld if building modules.
8631a2
+dnl This suppresses warnings from ld on some systems
8631a2
+AC_DEFUN([grub_PROG_LD_BUILD_ID_SHA1],
8631a2
+[AC_MSG_CHECKING([whether linker accepts --build-id=sha1])
8631a2
+AC_CACHE_VAL(grub_cv_prog_ld_build_id_sha1,
8631a2
+[save_LDFLAGS="$LDFLAGS"
8631a2
+LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
8631a2
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
8631a2
+	       [grub_cv_prog_ld_build_id_sha1=yes],
8631a2
+	       [grub_cv_prog_ld_build_id_sha1=no])
8631a2
+LDFLAGS="$save_LDFLAGS"
8631a2
+])
8631a2
+AC_MSG_RESULT([$grub_cv_prog_ld_build_id_sha1])
8631a2
+
8631a2
+if test "x$grub_cv_prog_ld_build_id_sha1" = xyes; then
8631a2
+  TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=sha1"
8631a2
+fi
8631a2
+])
8631a2
+
8631a2
 dnl Check nm
8631a2
 AC_DEFUN([grub_PROG_NM_WORKS],
8631a2
 [AC_MSG_CHECKING([whether nm works])