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)
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} [EMAIL PROTECTED]: #{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} [EMAIL PROTECTED]: #{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 $@
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel