]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* configure.ac (HAVE_LD_BUILDID): New check for ld --build-id
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 May 2009 00:19:24 +0000 (00:19 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 May 2009 00:19:24 +0000 (00:19 +0000)
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

gcc/ChangeLog
gcc/config.in
gcc/configure
gcc/configure.ac
gcc/gcc.c

index cff75d260b5177a750fdb948975697c3a1ddb8b0..4df38d7ce64a14afee6c3d1e3f1e0a8410df78a5 100644 (file)
@@ -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,
index 9cbae32cd4d0e5b25522baf73c3f2a028fb64f20..76a7810f3d42b06d7bae49008f5b294d5f2e2bf3 100644 (file)
 #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
 #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
index e96fcf528a34cae98c0e219659cfe1eb7dc6ed6d..fd03ec5f6638afe6ea29042f2f63b344c3b5e092 100755 (executable)
@@ -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
index 306adc18d2dc84b94600e539007674d6b9a9082b..fbdc166c6ef182f97e405ac0d453073c072a6581 100644 (file)
@@ -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
index af4081c4a173a3092e2dba2afc6aba7e1fa46d56..e89f3994adce0b5b11cc9829fdd77c8299610d13 100644 (file)
--- 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