From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1IwPvd-0004kc-Kw for mharc-grub-devel@gnu.org; Sun, 25 Nov 2007 17:26:17 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IwPvb-0004kX-TK for grub-devel@gnu.org; Sun, 25 Nov 2007 17:26:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IwPvb-0004kG-8v for grub-devel@gnu.org; Sun, 25 Nov 2007 17:26:15 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IwPvb-0004kC-7D for grub-devel@gnu.org; Sun, 25 Nov 2007 17:26:15 -0500 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IwPvb-0000Ns-2g for grub-devel@gnu.org; Sun, 25 Nov 2007 17:26:15 -0500 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.1) with ESMTP id lAPMQ9bs018783 for ; Sun, 25 Nov 2007 17:26:09 -0500 Received: from pobox.stuttgart.redhat.com (pobox.stuttgart.redhat.com [172.16.2.10]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lAPMQ8aH004432 for ; Sun, 25 Nov 2007 17:26:08 -0500 Received: from [10.32.4.50] (vpn-4-50.str.redhat.com [10.32.4.50]) by pobox.stuttgart.redhat.com (8.13.1/8.13.1) with ESMTP id lAPMQ7IP015532 for ; Sun, 25 Nov 2007 17:26:07 -0500 From: Lubomir Kundrak To: The development of GRUB 2 In-Reply-To: <1195873630.7449.8.camel@dv> References: <1195873630.7449.8.camel@dv> Content-Type: multipart/mixed; boundary="=-nfURMt8PAmbLloPnpyao" Organization: Red Hat Inc. Date: Sun, 25 Nov 2007 23:26:04 +0100 Message-Id: <1196029564.26555.9.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 (2.12.1-3.fc8) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [PATCH] Fix for linker build ID in Fedora 8 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: Sun, 25 Nov 2007 22:26:16 -0000 --=-nfURMt8PAmbLloPnpyao Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, Thanks for the patch! On Fri, 2007-11-23 at 22:07 -0500, Pavel Roskin wrote: > Hello! > Here's an alternate patch for the issue that appeared on Fedora 8. The > linker adds a "build ID" (.not.gnu.build-id) by default. That section > makes objcopy create output files about 128M long when asked to use > binary format. Needless to say, they are not suitable as grub images. I'd say this is a binutils bug, it wrecks the usability of binary output format of objcopy. It doesn't make much sense to me, that it needs to be mapped to the process' address space, but maybe gdb needs it that way, I really have no clue -- I'm tempted to ask the binutils developers. > --- configure.ac > +++ configure.ac > @@ -229,6 +229,16 @@ > TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" > fi > > +AC_MSG_CHECKING([whether linker accepts `--build-id=none']) > +save_LDFLAGS="$LDFLAGS" > +LDFLAGS="$LDFLAGS -Wl,--build-id=none" > +AC_TRY_LINK(, , build_id_flag=yes, build_id_flag=no) > +AC_MSG_RESULT([$build_id_flag]) > +LDFLAGS="$save_LDFLAGS" > +if test "x$build_id_flag" = xyes; then > + TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=none" > +fi > + > # > # Compiler features. > # I disagree with a solution like this -- you completely disable generation of build-ids. They are highly usable and I want them to be included in our debuginfo package. They're basically okay in *.exec files, so why not just leave them out of *.img-s, which don't contain any debugging information anyways. I attach the patch I use. The first hunk is basically the same as yours, the second one is self-explanatory. Regards, -- Lubomir Kundrak (Red Hat Security Response Team) --=-nfURMt8PAmbLloPnpyao Content-Disposition: attachment; filename=grub-1.95-buildid.patch Content-Type: text/x-patch; name=grub-1.95-buildid.patch; charset=utf-8 Content-Transfer-Encoding: 7bit Index: aclocal.m4 =================================================================== RCS file: /sources/grub/grub2/aclocal.m4,v retrieving revision 1.6 diff -u -p -r1.6 aclocal.m4 --- aclocal.m4 3 Feb 2007 11:36:13 -0000 1.6 +++ aclocal.m4 18 Nov 2007 16:48:12 -0000 @@ -57,7 +57,7 @@ else fi grub_cv_prog_objcopy_absolute=yes for link_addr in 2000 8000 7C00; do - if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then : + if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr -Wl,--build-id=none conftest.o -o conftest.exec]); then : else AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr]) fi Index: genmk.rb =================================================================== RCS file: /sources/grub/grub2/genmk.rb,v retrieving revision 1.29 diff -u -p -r1.29 genmk.rb --- genmk.rb 20 Oct 2007 18:32:17 -0000 1.29 +++ genmk.rb 25 Nov 2007 21:57:04 -0000 @@ -57,7 +57,7 @@ class Image MOSTLYCLEANFILES += #{deps_str} #{@name}: #{exe} - $(OBJCOPY) -O binary -R .note -R .comment $< $@ + $(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.build-id $< $@ #{exe}: #{objs_str} $(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS) @@ -115,7 +115,7 @@ UNDSYMFILES += #{undsym} #{@name}: #{pre_obj} #{mod_obj} -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^ - $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment -R .note.gnu.build-id $@ #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@ --=-nfURMt8PAmbLloPnpyao--