]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* configure.ac: Test if '--build-id=none' is supported by the
authorproski <proski@localhost>
Mon, 5 Nov 2007 01:29:46 +0000 (01:29 +0000)
committerproski <proski@localhost>
Mon, 5 Nov 2007 01:29:46 +0000 (01:29 +0000)
linker and add it to LDFLAGS if possible.  Build ID causes
objcopy to generate huge binary files.
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Use LDFLAGS when
linking, so that build ID doesn't break the test.
* stage1/Makefile.am: Preserve LDFLAGS, use stage1_exec_LDFLAGS.

ChangeLog
acinclude.m4
configure
configure.ac
stage1/Makefile.am
stage1/Makefile.in

index 66b176d6a8900022bf3dadd2801bc2ca55a62d14..f1fb4212070c0e4250c77f9e648fc3e1ceef3d9f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-10-29  Pavel Roskin  <proski@gnu.org>
+
+       * configure.ac: Test if '--build-id=none' is supported by the
+       linker and add it to LDFLAGS if possible.  Build ID causes
+       objcopy to generate huge binary files.
+       * aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Use LDFLAGS when
+       linking, so that build ID doesn't break the test.
+       * stage1/Makefile.am: Preserve LDFLAGS, use stage1_exec_LDFLAGS.
+
 2007-02-22  Pavel Roskin  <proski@gnu.org>
 
        * stage2/iso9660.h: Remove unnecessary packed attributes.
index 368839cdf9b4ff2d9a2ef22661bc528a922d3bc2..d508ad883271a8e2b7f5cf6b2e14b41d01d442dc 100644 (file)
@@ -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} ${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
index 537ab89a8acf7d1fdc0bd9871b057aa49b6bd187..e6a39dcfe8e32e7ccd493f13a366defa37939ed3 100644 (file)
--- a/configure
+++ b/configure
@@ -3694,6 +3694,64 @@ if test "x$undef_flag" = xyes; then
   CPPFLAGS="$CPPFLAGS -Wundef"
 fi
 
+# Check if build ID can be disabled in the linker
+echo "$as_me:$LINENO: checking whether linker accepts \`--build-id=none'" >&5
+echo $ECHO_N "checking whether linker accepts \`--build-id=none'... $ECHO_C" >&6
+save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -Wl,--build-id=none"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  build_id_flag=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+build_id_flag=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $build_id_flag" >&5
+echo "${ECHO_T}$build_id_flag" >&6
+LDFLAGS="$save_LDFLAGS"
+if test "x$build_id_flag" = xyes; then
+  LDFLAGS="$LDFLAGS -Wl,--build-id=none"
+fi
+
 if test "x$with_binutils" != x; then
   # Extract the first word of "objcopy", so it can be a program name with args.
 set dummy objcopy; ac_word=$2
@@ -3892,7 +3950,7 @@ echo "$as_me: error: ${CC-cc} cannot compile C source code" >&2;}
 fi
 grub_cv_prog_objcopy_absolute=yes
 for link_addr in 2000 8000 7C00; do
-  if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'
+  if { ac_try='${CC-cc} ${CFLAGS} ${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
index bb9e1d94b64188e78fe05acfeab688a4f3549550..540691f3c12f9345c8481c25930c7bd3dc44fc0a 100644 (file)
@@ -150,6 +150,17 @@ if test "x$undef_flag" = xyes; then
   CPPFLAGS="$CPPFLAGS -Wundef"
 fi
 
+# Check if build ID can be disabled in the linker
+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
+  LDFLAGS="$LDFLAGS -Wl,--build-id=none"
+fi
+
 if test "x$with_binutils" != x; then
 dnl  AC_PATH_TOOL(OBJCOPY, objcopy, , "$with_binutils:$PATH")
   AC_PATH_PROG(OBJCOPY, objcopy, , "$with_binutils:$PATH")
index 0afc285279a48f00a3d5f9269d0e5d512d1104a7..0b7994a86538a4cbc9febadd9ac29865e053cfd8 100644 (file)
@@ -5,7 +5,7 @@ CLEANFILES = $(nodist_pkglib_DATA)
 
 # We can't use builtins or standard includes.
 AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
-LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
+stage1_exec_LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
 
 noinst_PROGRAMS = stage1.exec
 stage1_exec_SOURCES = stage1.S stage1.h
index 7134bdf31a01d34aa202c6fa974112c177dd1d3f..2a0b7e578bd2b7a0bd3b53918c37ab2bb89a2f0c 100644 (file)
@@ -110,7 +110,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
+LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
 LTLIBOBJS = @LTLIBOBJS@
@@ -188,6 +188,7 @@ CLEANFILES = $(nodist_pkglib_DATA)
 
 # We can't use builtins or standard includes.
 AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
+stage1_exec_LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
 stage1_exec_SOURCES = stage1.S stage1.h
 SUFFIXES = .exec
 all: all-am