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

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