* 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.
This commit is contained in:
proski 2007-11-05 01:29:46 +00:00
parent 22cd659922
commit bce46bf7f1
6 changed files with 83 additions and 4 deletions

View file

@ -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.

View 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

60
configure vendored
View file

@ -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=$?

View 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")

View 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

View 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