nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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