From: Lubomir Kundrak <lkundrak@redhat.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Fix for linker build ID in Fedora 8
Date: Sun, 25 Nov 2007 23:26:04 +0100 [thread overview]
Message-ID: <1196029564.26555.9.camel@localhost.localdomain> (raw)
In-Reply-To: <1195873630.7449.8.camel@dv>
[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]
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)
[-- Attachment #2: grub-1.95-buildid.patch --]
[-- Type: text/x-patch, Size: 1684 bytes --]
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 $@
next prev parent reply other threads:[~2007-11-25 22:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-24 3:07 [PATCH] Fix for linker build ID in Fedora 8 Pavel Roskin
2007-11-25 22:26 ` Lubomir Kundrak [this message]
2007-11-26 10:28 ` Lubomir Kundrak
2007-11-26 12:35 ` Pavel Roskin
2007-11-26 12:54 ` Lubomir Kundrak
2007-11-26 13:06 ` Pavel Roskin
2007-12-12 15:45 ` Robert Millan
2007-12-14 4:33 ` Pavel Roskin
2007-12-14 5:45 ` Pavel Roskin
2007-12-14 6:10 ` Bean
2007-12-14 6:47 ` Pavel Roskin
-- strict thread matches above, loose matches on Subject: below --
2007-11-14 7:39 Pavel Roskin
2007-11-18 6:50 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1196029564.26555.9.camel@localhost.localdomain \
--to=lkundrak@redhat.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.