Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KDrcS-0002og-5o for mharc-grub-devel@gnu.org; Tue, 01 Jul 2008 21:58:52 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KDrcQ-0002mr-Gt for grub-devel@gnu.org; Tue, 01 Jul 2008 21:58:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KDrcP-0002lK-8K for grub-devel@gnu.org; Tue, 01 Jul 2008 21:58:50 -0400 Received: from [199.232.76.173] (port=53904 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KDrcP-0002lB-55 for grub-devel@gnu.org; Tue, 01 Jul 2008 21:58:49 -0400 Received: from c60.cesmail.net ([216.154.195.49]:37734) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1KDrcO-0001yt-Mk for grub-devel@gnu.org; Tue, 01 Jul 2008 21:58:48 -0400 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 01 Jul 2008 21:58:48 -0400 Received: from dv.roinet.com (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id 7CBF3618F22 for ; Tue, 1 Jul 2008 21:58:47 -0400 (EDT) From: Pavel Roskin To: grub-devel@gnu.org Date: Tue, 01 Jul 2008 21:58:46 -0400 Message-ID: <20080702015846.20065.88884.stgit@dv.roinet.com> User-Agent: StGIT/0.14.3.163.g06f9 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] Supply --build-id=none to ld if building modules X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jul 2008 01:58:50 -0000 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} #{@name}: #{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}