Skip to contentSkip to conversation

Fix for linker build ID in Fedora 8

PATCH In review Pavel Roskin 2 participants 2 messages Nov 14, 2007 – Nov 18, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix for linker build ID in Fedora 8

Hello!

[Sorry for not replying earlier. All messages from my gnu.org account were getting lost. Anyway, I'll need to retire that address due to massive spam.]

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. Also, the build ID section breaks the test for objcopy in the configure script.

This patch is less intrusive than the one I posted earlier, so I hope it will be accepted.

2007-10-29 Pavel Roskin <[email protected]>

* configure.ac: Test if '--build-id=none' is supported by the linker. Add it to TARGET_LDFLAGS if possible. Build ID interferes with objcopy.
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Use LDFLAGS when linking, so that build ID doesn't break the test.

aclocal.m4 +1 -1
@@ -57,7 +57,7 @@
 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} ${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
   else
     AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
   fi
configure.ac +10 -0
@@ -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.
 #
Signature · 2 lines
Regards,
Pavel Roskin
#1 lore raw
Quoted 16 lines · Pavel Roskin

Hello!

[Sorry for not replying earlier. All messages from my gnu.org account were getting lost. Anyway, I'll need to retire that address due to massive spam.]

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. Also, the build ID section breaks the test for objcopy in the configure script.

This patch is less intrusive than the one I posted earlier, so I hope it will be accepted.

Quoted 7 lines

2007-10-29 Pavel Roskin <[email protected]>

* configure.ac: Test if '--build-id=none' is supported by the linker. Add it to TARGET_LDFLAGS if possible. Build ID interferes with objcopy.
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Use LDFLAGS when linking, so that build ID doesn't break the test.

Looks fine to me. Seeing that there were no objections after a few days, I suggest you check it in.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)