Commit cd533689 by Paul Pluzhnikov Committed by Ian Lance Taylor

configure.ac (HAVE_LD_BUILDID): New check for ld --build-id support.

	* configure.ac (HAVE_LD_BUILDID): New check for ld --build-id
	support.
	(ENABLE_LD_BUILDID): New configuration option.
	* gcc.c [HAVE_LD_BUILDID and ENABLE_LD_BUILDID]
	(LINK_BUILDID_SPEC): New macro.
	(init_spec): If defined, prepend it between LINK_EH_SPEC and
	link_spec.
	* doc/install.texi: Document --enable-linker-build-id option.
	* configure: Rebuild.
	* config.in: Rebuild.

Co-Authored-By: Roland McGrath <roland@redhat.com>

From-SVN: r147029
parent 76547252
2009-04-30 Paul Pluzhnikov <ppluzhnikov@google.com>
Roland McGrath <roland@redhat.com>
* configure.ac (HAVE_LD_BUILDID): New check for ld --build-id
support.
(ENABLE_LD_BUILDID): New configuration option.
* gcc.c [HAVE_LD_BUILDID and ENABLE_LD_BUILDID]
(LINK_BUILDID_SPEC): New macro.
(init_spec): If defined, prepend it between LINK_EH_SPEC and
link_spec.
* doc/install.texi: Document --enable-linker-build-id option.
* configure: Rebuild.
* config.in: Rebuild.
2009-04-30 Adam Nemet <anemet@caviumnetworks.com> 2009-04-30 Adam Nemet <anemet@caviumnetworks.com>
* config/mips/mips.h (FRAME_GROWS_DOWNWARD, * config/mips/mips.h (FRAME_GROWS_DOWNWARD,
......
...@@ -101,6 +101,12 @@ ...@@ -101,6 +101,12 @@
#endif #endif
/* Define if gcc should always pass --build-id to linker. */
#ifndef USED_FOR_TARGET
#undef ENABLE_LD_BUILDID
#endif
/* Define to 1 if translation of program messages to the user's native /* Define to 1 if translation of program messages to the user's native
language is requested. */ language is requested. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
...@@ -1025,6 +1031,12 @@ ...@@ -1025,6 +1031,12 @@
#endif #endif
/* Define if your linker supports --build-id. */
#ifndef USED_FOR_TARGET
#undef HAVE_LD_BUILDID
#endif
/* Define if your linker supports --demangle option. */ /* Define if your linker supports --demangle option. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
#undef HAVE_LD_DEMANGLE #undef HAVE_LD_DEMANGLE
......
...@@ -1078,6 +1078,8 @@ Optional Features: ...@@ -1078,6 +1078,8 @@ Optional Features:
--enable-fast-install[=PKGS] --enable-fast-install[=PKGS]
optimize for fast installation [default=yes] optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds) --disable-libtool-lock avoid locking (might break parallel builds)
--enable-linker-build-id
compiler will always pass --build-id to linker
--enable-maintainer-mode --enable-maintainer-mode
enable make rules and dependencies not useful enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer (and sometimes confusing) to the casual installer
...@@ -14383,13 +14385,13 @@ if test "${lt_cv_nm_interface+set}" = set; then ...@@ -14383,13 +14385,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else else
lt_cv_nm_interface="BSD nm" lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:14386: $ac_compile\"" >&5) (eval echo "\"\$as_me:14388: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err) (eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5 cat conftest.err >&5
(eval echo "\"\$as_me:14389: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval echo "\"\$as_me:14391: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5 cat conftest.err >&5
(eval echo "\"\$as_me:14392: output\"" >&5) (eval echo "\"\$as_me:14394: output\"" >&5)
cat conftest.out >&5 cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin" lt_cv_nm_interface="MS dumpbin"
...@@ -15546,7 +15548,7 @@ ia64-*-hpux*) ...@@ -15546,7 +15548,7 @@ ia64-*-hpux*)
;; ;;
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo '#line 15549 "configure"' > conftest.$ac_ext echo '#line 15551 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
...@@ -16845,11 +16847,11 @@ else ...@@ -16845,11 +16847,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16848: $lt_compile\"" >&5) (eval echo "\"\$as_me:16850: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:16852: \$? = $ac_status" >&5 echo "$as_me:16854: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
...@@ -17184,11 +17186,11 @@ else ...@@ -17184,11 +17186,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17187: $lt_compile\"" >&5) (eval echo "\"\$as_me:17189: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:17191: \$? = $ac_status" >&5 echo "$as_me:17193: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
...@@ -17289,11 +17291,11 @@ else ...@@ -17289,11 +17291,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17292: $lt_compile\"" >&5) (eval echo "\"\$as_me:17294: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:17296: \$? = $ac_status" >&5 echo "$as_me:17298: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
...@@ -17344,11 +17346,11 @@ else ...@@ -17344,11 +17346,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17347: $lt_compile\"" >&5) (eval echo "\"\$as_me:17349: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:17351: \$? = $ac_status" >&5 echo "$as_me:17353: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
...@@ -20156,7 +20158,7 @@ else ...@@ -20156,7 +20158,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 20159 "configure" #line 20161 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -20252,7 +20254,7 @@ else ...@@ -20252,7 +20254,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 20255 "configure" #line 20257 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -24117,6 +24119,56 @@ _ACEOF ...@@ -24117,6 +24119,56 @@ _ACEOF
;; ;;
esac esac
echo "$as_me:$LINENO: checking linker --build-id support" >&5
echo $ECHO_N "checking linker --build-id support... $ECHO_C" >&6
if test "${gcc_cv_ld_buildid+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
gcc_cv_ld_buildid=no
if test $in_tree_ld = yes ; then
if test "$gcc_cv_gld_major_version" -eq 2 -a \
"$gcc_cv_gld_minor_version" -ge 18 -o \
"$gcc_cv_gld_major_version" -gt 2 \
&& test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_buildid=yes
fi
elif test x$gcc_cv_ld != x; then
if $gcc_cv_ld --help 2>/dev/null | grep build-id > /dev/null; then
gcc_cv_ld_buildid=yes
fi
fi
fi
echo "$as_me:$LINENO: result: $gcc_cv_ld_buildid" >&5
echo "${ECHO_T}$gcc_cv_ld_buildid" >&6
if test x"$gcc_cv_ld_buildid" = xyes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_LD_BUILDID 1
_ACEOF
fi
# Check whether --enable-linker-build-id or --disable-linker-build-id was given.
if test "${enable_linker_build_id+set}" = set; then
enableval="$enable_linker_build_id"
else
enable_linker_build_id=no
fi;
if test x"$enable_linker_build_id" = xyes; then
if test x"$gcc_cv_ld_buildid" = xyes; then
cat >>confdefs.h <<\_ACEOF
#define ENABLE_LD_BUILDID 1
_ACEOF
else
{ echo "$as_me:$LINENO: WARNING: --build-id is not supported by your linker; --enable-linker-build-id ignored" >&5
echo "$as_me: WARNING: --build-id is not supported by your linker; --enable-linker-build-id ignored" >&2;}
fi
fi
echo "$as_me:$LINENO: checking linker --sysroot support" >&5 echo "$as_me:$LINENO: checking linker --sysroot support" >&5
echo $ECHO_N "checking linker --sysroot support... $ECHO_C" >&6 echo $ECHO_N "checking linker --sysroot support... $ECHO_C" >&6
if test "${gcc_cv_ld_sysroot+set}" = set; then if test "${gcc_cv_ld_sysroot+set}" = set; then
......
...@@ -3510,6 +3510,41 @@ EOF ...@@ -3510,6 +3510,41 @@ EOF
;; ;;
esac esac
AC_CACHE_CHECK(linker --build-id support,
gcc_cv_ld_buildid,
[gcc_cv_ld_buildid=no
if test $in_tree_ld = yes ; then
if test "$gcc_cv_gld_major_version" -eq 2 -a \
"$gcc_cv_gld_minor_version" -ge 18 -o \
"$gcc_cv_gld_major_version" -gt 2 \
&& test $in_tree_ld_is_elf = yes; then
gcc_cv_ld_buildid=yes
fi
elif test x$gcc_cv_ld != x; then
if $gcc_cv_ld --help 2>/dev/null | grep build-id > /dev/null; then
gcc_cv_ld_buildid=yes
fi
fi])
if test x"$gcc_cv_ld_buildid" = xyes; then
AC_DEFINE(HAVE_LD_BUILDID, 1,
[Define if your linker supports --build-id.])
fi
AC_ARG_ENABLE(linker-build-id,
[ --enable-linker-build-id
compiler will always pass --build-id to linker],
[],
enable_linker_build_id=no)
if test x"$enable_linker_build_id" = xyes; then
if test x"$gcc_cv_ld_buildid" = xyes; then
AC_DEFINE(ENABLE_LD_BUILDID, 1,
[Define if gcc should always pass --build-id to linker.])
else
AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored)
fi
fi
AC_CACHE_CHECK(linker --sysroot support, AC_CACHE_CHECK(linker --sysroot support,
gcc_cv_ld_sysroot, gcc_cv_ld_sysroot,
[gcc_cv_ld_sysroot=no [gcc_cv_ld_sysroot=no
......
...@@ -730,6 +730,13 @@ proper position among the other output files. */ ...@@ -730,6 +730,13 @@ proper position among the other output files. */
#endif #endif
#endif #endif
#ifndef LINK_BUILDID_SPEC
# if defined(HAVE_LD_BUILDID) && defined(ENABLE_LD_BUILDID)
# define LINK_BUILDID_SPEC "%{!r:--build-id} "
# endif
#endif
/* -u* was put back because both BSD and SysV seem to support it. */ /* -u* was put back because both BSD and SysV seem to support it. */
/* %{static:} simply prevents an error message if the target machine /* %{static:} simply prevents an error message if the target machine
doesn't handle -static. */ doesn't handle -static. */
...@@ -1844,9 +1851,16 @@ init_spec (void) ...@@ -1844,9 +1851,16 @@ init_spec (void)
asm_spec = XOBFINISH (&obstack, const char *); asm_spec = XOBFINISH (&obstack, const char *);
} }
#endif #endif
#ifdef LINK_EH_SPEC
#if defined LINK_EH_SPEC || defined LINK_BUILDID_SPEC
# ifdef LINK_BUILDID_SPEC
/* Prepend LINK_BUILDID_SPEC to whatever link_spec we had before. */
obstack_grow (&obstack, LINK_BUILDID_SPEC, sizeof(LINK_BUILDID_SPEC) - 1);
# endif
# ifdef LINK_EH_SPEC
/* Prepend LINK_EH_SPEC to whatever link_spec we had before. */ /* Prepend LINK_EH_SPEC to whatever link_spec we had before. */
obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1); obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
# endif
obstack_grow0 (&obstack, link_spec, strlen (link_spec)); obstack_grow0 (&obstack, link_spec, strlen (link_spec));
link_spec = XOBFINISH (&obstack, const char *); link_spec = XOBFINISH (&obstack, const char *);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment