OSDN Git Service

2009-11-08 H.J. Lu <hongjiu.lu@intel.com>
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 8 Nov 2009 22:36:51 +0000 (22:36 +0000)
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 8 Nov 2009 22:36:51 +0000 (22:36 +0000)
* collect2.c (main): Search PLUGIN_LD for plugin linker.

* configure.ac (--with-plugin-ld): New.  Default to ld.
* configure: Regenerated.
* config.in: Likewise.

* exec-tool.in (ORIGINAL_PLUGIN_LD_FOR_TARGET): New.
(collect-ld): Use ORIGINAL_PLUGIN_LD_FOR_TARGET for -plugin.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154020 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/collect2.c
gcc/config.in
gcc/configure
gcc/configure.ac
gcc/exec-tool.in

index 9fad99b..9e6fb69 100644 (file)
@@ -1,3 +1,14 @@
+2009-11-08  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * collect2.c (main): Search PLUGIN_LD for plugin linker.
+
+       * configure.ac (--with-plugin-ld): New.  Default to ld.
+       * configure: Regenerated.
+       * config.in: Likewise.
+
+       * exec-tool.in (ORIGINAL_PLUGIN_LD_FOR_TARGET): New.
+       (collect-ld): Use ORIGINAL_PLUGIN_LD_FOR_TARGET for -plugin.
+
 2009-11-08  Jonathan Gray <jsg@openbsd.org>
 
        * config/openbsd-stdint.h: Change to reflect what
index 03300f3..b259f09 100644 (file)
@@ -1100,6 +1100,7 @@ int
 main (int argc, char **argv)
 {
   static const char *const ld_suffix   = "ld";
+  static const char *const plugin_ld_suffix = PLUGIN_LD;
   static const char *const real_ld_suffix = "real-ld";
   static const char *const collect_ld_suffix = "collect-ld";
   static const char *const nm_suffix   = "nm";
@@ -1118,6 +1119,8 @@ main (int argc, char **argv)
 
   const char *const full_ld_suffix =
     concat(target_machine, "-", ld_suffix, NULL);
+  const char *const full_plugin_ld_suffix =
+    concat(target_machine, "-", plugin_ld_suffix, NULL);
   const char *const full_nm_suffix =
     concat (target_machine, "-", nm_suffix, NULL);
   const char *const full_gnm_suffix =
@@ -1132,6 +1135,7 @@ main (int argc, char **argv)
     concat (target_machine, "-", gstrip_suffix, NULL);
 #else
   const char *const full_ld_suffix     = ld_suffix;
+  const char *const full_plugin_ld_suffix = plugin_ld_suffix;
   const char *const full_nm_suffix     = nm_suffix;
   const char *const full_gnm_suffix    = gnm_suffix;
 #ifdef LDD_SUFFIX
@@ -1152,6 +1156,7 @@ main (int argc, char **argv)
   const char **c_ptr;
   char **ld1_argv;
   const char **ld1;
+  bool use_plugin = false;
   
   /* The kinds of symbols we will have to consider when scanning the
      outcome of a first pass link.  This is ALL to start with, then might
@@ -1217,7 +1222,6 @@ main (int argc, char **argv)
      what LTO mode we are in.  */
   {
     int i;
-    bool use_plugin = false;
 
     for (i = 1; argv[i] != NULL; i ++)
       {
@@ -1329,11 +1333,17 @@ main (int argc, char **argv)
   /* Search the compiler directories for `ld'.  We have protection against
      recursive calls in find_a_file.  */
   if (ld_file_name == 0)
-    ld_file_name = find_a_file (&cpath, ld_suffix);
+    ld_file_name = find_a_file (&cpath,
+                               use_plugin
+                               ? plugin_ld_suffix
+                               : ld_suffix);
   /* Search the ordinary system bin directories
      for `ld' (if native linking) or `TARGET-ld' (if cross).  */
   if (ld_file_name == 0)
-    ld_file_name = find_a_file (&path, full_ld_suffix);
+    ld_file_name = find_a_file (&path,
+                               use_plugin
+                               ? full_plugin_ld_suffix
+                               : full_ld_suffix);
 
 #ifdef REAL_NM_FILE_NAME
   nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME);
index a3e9069..fbc9fbb 100644 (file)
 #endif
 
 
+/* Specify plugin linker */
+#ifndef USED_FOR_TARGET
+#undef PLUGIN_LD
+#endif
+
+
 /* Define to PREFIX/include if cpp should also search that directory. */
 #ifndef USED_FOR_TARGET
 #undef PREFIX_INCLUDE_DIR
index 292b3dc..f49cdb7 100755 (executable)
@@ -822,6 +822,7 @@ gcc_cv_objdump
 ORIGINAL_NM_FOR_TARGET
 gcc_cv_nm
 ORIGINAL_LD_FOR_TARGET
+ORIGINAL_PLUGIN_LD_FOR_TARGET
 gcc_cv_ld
 ORIGINAL_AS_FOR_TARGET
 gcc_cv_as
@@ -1036,6 +1037,7 @@ enable_static
 with_pic
 enable_fast_install
 enable_libtool_lock
+with_plugin_ld
 enable_gnu_unique_object
 enable_linker_build_id
 with_long_double_128
@@ -1780,6 +1782,7 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-plugin-ld=[ARG]  specify the plugin linker
   --with-long-double-128  Use 128-bit long double by default.
   --with-gc={page,zone}   choose the garbage collection mechanism to use
                           with the compiler
@@ -11572,13 +11575,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:11575: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:11578: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:11578: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:11581: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:11581: output\"" >&5)
+  (eval echo "\"\$as_me:11584: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -12783,7 +12786,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 12786 "configure"' > conftest.$ac_ext
+  echo '#line 12789 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -14443,11 +14446,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:14446: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14449: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14450: \$? = $ac_status" >&5
+   echo "$as_me:14453: \$? = $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.
@@ -14782,11 +14785,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:14785: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14788: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14789: \$? = $ac_status" >&5
+   echo "$as_me:14792: \$? = $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.
@@ -14887,11 +14890,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:14890: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14893: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14894: \$? = $ac_status" >&5
+   echo "$as_me:14897: \$? = $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
@@ -14942,11 +14945,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:14945: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14948: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14949: \$? = $ac_status" >&5
+   echo "$as_me:14952: \$? = $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
@@ -17324,7 +17327,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17327 "configure"
+#line 17330 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17420,7 +17423,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17423 "configure"
+#line 17426 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19376,11 +19379,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:19379: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19382: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:19383: \$? = $ac_status" >&5
+   echo "$as_me:19386: \$? = $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.
@@ -19475,11 +19478,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:19478: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19481: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:19482: \$? = $ac_status" >&5
+   echo "$as_me:19485: \$? = $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
@@ -19527,11 +19530,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:19530: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19533: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:19534: \$? = $ac_status" >&5
+   echo "$as_me:19537: \$? = $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
 fi
 fi
 
+ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld
+PLUGIN_LD=`basename $gcc_cv_ld`
+
+# Check whether --with-plugin-ld was given.
+if test "${with_plugin_ld+set}" = set; then :
+  withval=$with_plugin_ld; if test x"$withval" != x; then
+   ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval"
+   PLUGIN_LD="$withval"
+ fi
+fi
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define PLUGIN_LD "$PLUGIN_LD"
+_ACEOF
+
+
 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
 
 case "$ORIGINAL_LD_FOR_TARGET" in
index dd3b7e8..dfc7299 100644 (file)
@@ -1915,6 +1915,17 @@ else
         AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
 fi])
 
+ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld
+PLUGIN_LD=`basename $gcc_cv_ld`
+AC_ARG_WITH(plugin-ld,
+[  --with-plugin-ld=[[ARG]]  specify the plugin linker],
+[if test x"$withval" != x; then
+   ORIGINAL_PLUGIN_LD_FOR_TARGET="$withval"
+   PLUGIN_LD="$withval"
+ fi])
+AC_SUBST(ORIGINAL_PLUGIN_LD_FOR_TARGET)
+AC_DEFINE_UNQUOTED(PLUGIN_LD, "$PLUGIN_LD", [Specify plugin linker])
+
 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
 AC_SUBST(ORIGINAL_LD_FOR_TARGET)
 case "$ORIGINAL_LD_FOR_TARGET" in
index f585163..a146899 100644 (file)
@@ -21,6 +21,7 @@
 
 ORIGINAL_AS_FOR_TARGET="@ORIGINAL_AS_FOR_TARGET@"
 ORIGINAL_LD_FOR_TARGET="@ORIGINAL_LD_FOR_TARGET@"
+ORIGINAL_PLUGIN_LD_FOR_TARGET="@ORIGINAL_PLUGIN_LD_FOR_TARGET@"
 ORIGINAL_NM_FOR_TARGET="@ORIGINAL_NM_FOR_TARGET@"
 exeext=@host_exeext@
 fast_install=@enable_fast_install@
@@ -34,7 +35,13 @@ case "$invoked" in
     dir=gas
     ;;
   collect-ld)
-    original=$ORIGINAL_LD_FOR_TARGET
+    # when using a linker plugin, gcc will always pass '-plugin' as the
+    # first option to the linker.
+    if test x"$1" = "x-plugin"; then
+      original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
+    else
+      original=$ORIGINAL_LD_FOR_TARGET
+    fi
     prog=ld-new$exeext
     dir=ld
     ;;