[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Supply --build-id=none to ld if building modules
From: |
Pavel Roskin |
Subject: |
[PATCH] Supply --build-id=none to ld if building modules |
Date: |
Tue, 01 Jul 2008 21:58:46 -0400 |
User-agent: |
StGIT/0.14.3.163.g06f9 |
This doesn't make any difference to the compiled files, but suppresses
linker warnings on systems where build ID is enabled by default, such as
Fedora 9.
ChangeLog:
* Makefile.in (MODULE_LDFLAGS): New variable.
* aclocal.m4 (grub_PROG_LD_BUILD_ID_NONE): New macro. Check if
the linker accepts --build-id=none.
* configure.ac: Call grub_PROG_LD_BUILD_ID_NONE. Substitute
MODULE_LDFLAGS.
* genmk.rb: Use MODULE_LDFLAGS when linking modules.
---
Makefile.in | 1 +
aclocal.m4 | 20 ++++++++++++++++++++
configure.ac | 2 ++
genmk.rb | 2 +-
4 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index c29c5fd..c255203 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -68,6 +68,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I. -Iinclude -I$(srcdir)/include \
-Wall -W
TARGET_LDFLAGS = @TARGET_LDFLAGS@
+MODULE_LDFLAGS = @MODULE_LDFLAGS@
OBJCOPY = @OBJCOPY@
STRIP = @STRIP@
NM = @NM@
diff --git a/aclocal.m4 b/aclocal.m4
index fc67066..a673263 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -81,6 +81,26 @@ fi
])
+dnl Supply --build-id=none to ld if building modules.
+dnl This suppresses warnings from ld on some systems
+AC_DEFUN(grub_PROG_LD_BUILD_ID_NONE,
+[AC_MSG_CHECKING([whether linker accepts --build-id=none])
+AC_CACHE_VAL(grub_cv_prog_ld_build_id_none,
+[save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -Wl,--build-id=none"
+AC_TRY_LINK([], [],
+ grub_cv_prog_ld_build_id_none=yes,
+ grub_cv_prog_ld_build_id_none=no)
+LDFLAGS="$save_LDFLAGS"
+])
+AC_MSG_RESULT([$grub_cv_prog_ld_build_id_none])
+
+if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
+ MODULE_LDFLAGS="$MODULE_LDFLAGS -Wl,--build-id=none"
+fi
+])
+
+
dnl Mass confusion!
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit
dnl instructions, but implicitly insert addr32 and data32 bytes so
diff --git a/configure.ac b/configure.ac
index 5ec7a47..18049db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,6 +253,7 @@ fi
AC_SUBST(TARGET_CFLAGS)
AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_LDFLAGS)
+AC_SUBST(MODULE_LDFLAGS)
# Set them to their new values for the tests below.
CC="$TARGET_CC"
@@ -262,6 +263,7 @@ LDFLAGS="$TARGET_LDFLAGS"
# Defined in aclocal.m4.
grub_PROG_OBJCOPY_ABSOLUTE
+grub_PROG_LD_BUILD_ID_NONE
grub_ASM_USCORE
if test "x$target_cpu" = xi386; then
grub_CHECK_START_SYMBOL
diff --git a/genmk.rb b/genmk.rb
index a2179fa..56dee5c 100644
--- a/genmk.rb
+++ b/genmk.rb
@@ -114,7 +114,7 @@ UNDSYMFILES += #{undsym}
address@hidden: #{pre_obj} #{mod_obj}
-rm -f $@
- $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^
+ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) $(MODULE_LDFLAGS)
-Wl,-r,-d -o $@ $^
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R
.comment $@
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Supply --build-id=none to ld if building modules,
Pavel Roskin <=