nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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