[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix for linker build ID in Fedora 8
From: |
Pavel Roskin |
Subject: |
Re: [PATCH] Fix for linker build ID in Fedora 8 |
Date: |
Fri, 14 Dec 2007 00:45:38 -0500 |
User-agent: |
Internet Messaging Program (IMP) H3 (4.1.4) |
Quoting Robert Millan <address@hidden>:
Is this fixed now?
P.S. Actually, I realize now that the fix I applied wasn't the best
approach. The issue is with objcopy, not with ld, and should be
addressed with objcopy flags. It can be gone with objcopy flags (-R
.note.gnu.build-id) without any tests, whereas ld needs to be tested
for --build-id=none support. And even if the build ID is only useful
for the executables in Fedora, there is no need to strip it from the
temporary files that are processed by objcopy.
I considered both patches and chose the "least intrusive" one based on
the patch size, which wasn't a good idea.
I also assumed that "-R .note.gnu.build-id" should be added to strip
invocations, not only to objcopy. While it could be a good idea,
there is no harm other than wasting a few bytes in having build ID on
modules. The issue could be addressed separately. Maybe there are
more sections to strip in the module files.
It's only the *.img files that are mangled beyond recognition if the
build ID is not stripped, and it's entirely an objcopy bug. Strip
does the right thing.
I'm not trying to deal with the native x86_64 patch here. It's a
separate issue with the objcopy test. It may be another objcopy bug.
It may warrant introducing OBJCOPY_FLAGS to hold the increasing number
of objcopy flags. But it's out of scope for now.
Please consider this patch. In case it's mangled, I put a copy to
http://red-bean.com/proski/grub/grub2-objcopy-f8.diff
Index: ChangeLog
===================================================================
RCS file: /cvsroot/grub/grub2/ChangeLog,v
retrieving revision 1.452
diff -u -p -r1.452 ChangeLog
--- ChangeLog 25 Nov 2007 02:01:29 -0000 1.452
+++ ChangeLog 14 Dec 2007 05:31:11 -0000
@@ -1,3 +1,11 @@
+2007-12-14 Pavel Roskin <address@hidden>
+
+ * configure.ac: Revert previous patch.
+ * aclocal.m4: Likewise. Instead, strip build ID when calling
+ objcopy. It's a bug in objcopy, and should be worked around in
+ objcopy.
+ * genmk.rb: Strip build ID when calling objcopy.
+
2007-11-24 Pavel Roskin <address@hidden>
* configure.ac: Test if '--build-id=none' is supported by the
Index: aclocal.m4
===================================================================
RCS file: /cvsroot/grub/grub2/aclocal.m4,v
retrieving revision 1.7
diff -u -p -r1.7 aclocal.m4
--- aclocal.m4 25 Nov 2007 02:01:30 -0000 1.7
+++ aclocal.m4 14 Dec 2007 05:31:11 -0000
@@ -61,7 +61,7 @@ for link_addr in 2000 8000 7C00; do
else
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
fi
- if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec
conftest]); then :
+ if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary -R
.note.gnu.build-id conftest.exec conftest]); then :
else
AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
fi
Index: configure.ac
===================================================================
RCS file: /cvsroot/grub/grub2/configure.ac,v
retrieving revision 1.40
diff -u -p -r1.40 configure.ac
--- configure.ac 25 Nov 2007 02:01:30 -0000 1.40
+++ configure.ac 14 Dec 2007 05:31:12 -0000
@@ -229,16 +229,6 @@ if test "x$target_m32" = x1; then
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
fi
-AC_MSG_CHECKING([whether the 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.
#
Index: genmk.rb
===================================================================
RCS file: /cvsroot/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 14 Dec 2007 05:31:12 -0000
@@ -57,7 +57,7 @@ class Image
MOSTLYCLEANFILES += #{deps_str}
address@hidden: #{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)
--
Regards,
Pavel Roskin