summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-01 00:19:24 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-01 00:19:24 +0000
commit8271b9664424a5d08807b7b6429f7b47b566f3a2 (patch)
treebc6a0299750d5af207ceb8cfc2dd5ed3e2f0d9dc /gcc
parent7e320b166029a9379bd23e62dc5d1dabba264ce5 (diff)
downloadgcc-8271b9664424a5d08807b7b6429f7b47b566f3a2.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147029 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config.in12
-rwxr-xr-xgcc/configure80
-rw-r--r--gcc/configure.ac35
-rw-r--r--gcc/gcc.c16
5 files changed, 142 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cff75d260b5..4df38d7ce64 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+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>
* config/mips/mips.h (FRAME_GROWS_DOWNWARD,
diff --git a/gcc/config.in b/gcc/config.in
index 9cbae32cd4d..76a7810f3d4 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -101,6 +101,12 @@
#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
language is requested. */
#ifndef USED_FOR_TARGET
@@ -1025,6 +1031,12 @@
#endif
+/* Define if your linker supports --build-id. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_BUILDID
+#endif
+
+
/* Define if your linker supports --demangle option. */
#ifndef USED_FOR_TARGET
#undef HAVE_LD_DEMANGLE
diff --git a/gcc/configure b/gcc/configure
index e96fcf528a3..fd03ec5f663 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1078,6 +1078,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--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 make rules and dependencies not useful
(and sometimes confusing) to the casual installer
@@ -14383,13 +14385,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
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)
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)
cat conftest.err >&5
- (eval echo "\"\$as_me:14392: output\"" >&5)
+ (eval echo "\"\$as_me:14394: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -15546,7 +15548,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# 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
(eval $ac_compile) 2>&5
ac_status=$?
@@ -16845,11 +16847,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-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)
ac_status=$?
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
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -17184,11 +17186,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-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)
ac_status=$?
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
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -17289,11 +17291,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-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)
ac_status=$?
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
then
# The compiler can only warn and ignore the option if not recognized
@@ -17344,11 +17346,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-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)
ac_status=$?
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
then
# The compiler can only warn and ignore the option if not recognized
@@ -20156,7 +20158,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20159 "configure"
+#line 20161 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20252,7 +20254,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20255 "configure"
+#line 20257 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -24117,6 +24119,56 @@ _ACEOF
;;
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 $ECHO_N "checking linker --sysroot support... $ECHO_C" >&6
if test "${gcc_cv_ld_sysroot+set}" = set; then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 306adc18d2d..fbdc166c6ef 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3510,6 +3510,41 @@ EOF
;;
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,
gcc_cv_ld_sysroot,
[gcc_cv_ld_sysroot=no
diff --git a/gcc/gcc.c b/gcc/gcc.c
index af4081c4a17..e89f3994adc 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -730,6 +730,13 @@ proper position among the other output files. */
#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. */
/* %{static:} simply prevents an error message if the target machine
doesn't handle -static. */
@@ -1844,9 +1851,16 @@ init_spec (void)
asm_spec = XOBFINISH (&obstack, const char *);
}
#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. */
obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
+# endif
obstack_grow0 (&obstack, link_spec, strlen (link_spec));
link_spec = XOBFINISH (&obstack, const char *);
#endif