Commit 5938f74d by H.J. Lu Committed by H.J. Lu

collect2.c (main): Search PLUGIN_LD for plugin linker.

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.

From-SVN: r154020
parent aeaebc93
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> 2009-11-08 Jonathan Gray <jsg@openbsd.org>
* config/openbsd-stdint.h: Change to reflect what * config/openbsd-stdint.h: Change to reflect what
...@@ -1100,6 +1100,7 @@ int ...@@ -1100,6 +1100,7 @@ int
main (int argc, char **argv) main (int argc, char **argv)
{ {
static const char *const ld_suffix = "ld"; 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 real_ld_suffix = "real-ld";
static const char *const collect_ld_suffix = "collect-ld"; static const char *const collect_ld_suffix = "collect-ld";
static const char *const nm_suffix = "nm"; static const char *const nm_suffix = "nm";
...@@ -1118,6 +1119,8 @@ main (int argc, char **argv) ...@@ -1118,6 +1119,8 @@ main (int argc, char **argv)
const char *const full_ld_suffix = const char *const full_ld_suffix =
concat(target_machine, "-", ld_suffix, NULL); 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 = const char *const full_nm_suffix =
concat (target_machine, "-", nm_suffix, NULL); concat (target_machine, "-", nm_suffix, NULL);
const char *const full_gnm_suffix = const char *const full_gnm_suffix =
...@@ -1132,6 +1135,7 @@ main (int argc, char **argv) ...@@ -1132,6 +1135,7 @@ main (int argc, char **argv)
concat (target_machine, "-", gstrip_suffix, NULL); concat (target_machine, "-", gstrip_suffix, NULL);
#else #else
const char *const full_ld_suffix = ld_suffix; 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_nm_suffix = nm_suffix;
const char *const full_gnm_suffix = gnm_suffix; const char *const full_gnm_suffix = gnm_suffix;
#ifdef LDD_SUFFIX #ifdef LDD_SUFFIX
...@@ -1152,6 +1156,7 @@ main (int argc, char **argv) ...@@ -1152,6 +1156,7 @@ main (int argc, char **argv)
const char **c_ptr; const char **c_ptr;
char **ld1_argv; char **ld1_argv;
const char **ld1; const char **ld1;
bool use_plugin = false;
/* The kinds of symbols we will have to consider when scanning the /* 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 outcome of a first pass link. This is ALL to start with, then might
...@@ -1217,7 +1222,6 @@ main (int argc, char **argv) ...@@ -1217,7 +1222,6 @@ main (int argc, char **argv)
what LTO mode we are in. */ what LTO mode we are in. */
{ {
int i; int i;
bool use_plugin = false;
for (i = 1; argv[i] != NULL; i ++) for (i = 1; argv[i] != NULL; i ++)
{ {
...@@ -1329,11 +1333,17 @@ main (int argc, char **argv) ...@@ -1329,11 +1333,17 @@ main (int argc, char **argv)
/* Search the compiler directories for `ld'. We have protection against /* Search the compiler directories for `ld'. We have protection against
recursive calls in find_a_file. */ recursive calls in find_a_file. */
if (ld_file_name == 0) 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 /* Search the ordinary system bin directories
for `ld' (if native linking) or `TARGET-ld' (if cross). */ for `ld' (if native linking) or `TARGET-ld' (if cross). */
if (ld_file_name == 0) 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 #ifdef REAL_NM_FILE_NAME
nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME); nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME);
......
...@@ -1550,6 +1550,12 @@ ...@@ -1550,6 +1550,12 @@
#endif #endif
/* Specify plugin linker */
#ifndef USED_FOR_TARGET
#undef PLUGIN_LD
#endif
/* Define to PREFIX/include if cpp should also search that directory. */ /* Define to PREFIX/include if cpp should also search that directory. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
#undef PREFIX_INCLUDE_DIR #undef PREFIX_INCLUDE_DIR
......
...@@ -822,6 +822,7 @@ gcc_cv_objdump ...@@ -822,6 +822,7 @@ gcc_cv_objdump
ORIGINAL_NM_FOR_TARGET ORIGINAL_NM_FOR_TARGET
gcc_cv_nm gcc_cv_nm
ORIGINAL_LD_FOR_TARGET ORIGINAL_LD_FOR_TARGET
ORIGINAL_PLUGIN_LD_FOR_TARGET
gcc_cv_ld gcc_cv_ld
ORIGINAL_AS_FOR_TARGET ORIGINAL_AS_FOR_TARGET
gcc_cv_as gcc_cv_as
...@@ -1036,6 +1037,7 @@ enable_static ...@@ -1036,6 +1037,7 @@ enable_static
with_pic with_pic
enable_fast_install enable_fast_install
enable_libtool_lock enable_libtool_lock
with_plugin_ld
enable_gnu_unique_object enable_gnu_unique_object
enable_linker_build_id enable_linker_build_id
with_long_double_128 with_long_double_128
...@@ -1780,6 +1782,7 @@ Optional Packages: ...@@ -1780,6 +1782,7 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use --with-pic try to use only PIC/non-PIC objects [default=use
both] both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no] --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-long-double-128 Use 128-bit long double by default.
--with-gc={page,zone} choose the garbage collection mechanism to use --with-gc={page,zone} choose the garbage collection mechanism to use
with the compiler with the compiler
...@@ -11572,13 +11575,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : ...@@ -11572,13 +11575,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:11575: $ac_compile\"" >&5) (eval echo "\"\$as_me:11578: $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: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) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5 cat conftest.err >&5
(eval echo "\"\$as_me:11581: output\"" >&5) (eval echo "\"\$as_me:11584: 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"
...@@ -12783,7 +12786,7 @@ ia64-*-hpux*) ...@@ -12783,7 +12786,7 @@ ia64-*-hpux*)
;; ;;
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # 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 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
...@@ -14443,11 +14446,11 @@ else ...@@ -14443,11 +14446,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:14446: $lt_compile\"" >&5) (eval echo "\"\$as_me:14449: $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:14450: \$? = $ac_status" >&5 echo "$as_me:14453: \$? = $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.
...@@ -14782,11 +14785,11 @@ else ...@@ -14782,11 +14785,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:14785: $lt_compile\"" >&5) (eval echo "\"\$as_me:14788: $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:14789: \$? = $ac_status" >&5 echo "$as_me:14792: \$? = $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.
...@@ -14887,11 +14890,11 @@ else ...@@ -14887,11 +14890,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:14890: $lt_compile\"" >&5) (eval echo "\"\$as_me:14893: $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:14894: \$? = $ac_status" >&5 echo "$as_me:14897: \$? = $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
...@@ -14942,11 +14945,11 @@ else ...@@ -14942,11 +14945,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:14945: $lt_compile\"" >&5) (eval echo "\"\$as_me:14948: $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:14949: \$? = $ac_status" >&5 echo "$as_me:14952: \$? = $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
...@@ -17324,7 +17327,7 @@ else ...@@ -17324,7 +17327,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 17327 "configure" #line 17330 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -17420,7 +17423,7 @@ else ...@@ -17420,7 +17423,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 17423 "configure" #line 17426 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -19376,11 +19379,11 @@ else ...@@ -19376,11 +19379,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:19379: $lt_compile\"" >&5) (eval echo "\"\$as_me:19382: $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:19383: \$? = $ac_status" >&5 echo "$as_me:19386: \$? = $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.
...@@ -19475,11 +19478,11 @@ else ...@@ -19475,11 +19478,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:19478: $lt_compile\"" >&5) (eval echo "\"\$as_me:19481: $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:19482: \$? = $ac_status" >&5 echo "$as_me:19485: \$? = $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
...@@ -19527,11 +19530,11 @@ else ...@@ -19527,11 +19530,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:19530: $lt_compile\"" >&5) (eval echo "\"\$as_me:19533: $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:19534: \$? = $ac_status" >&5 echo "$as_me:19537: \$? = $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
...@@ -20686,6 +20689,24 @@ fi ...@@ -20686,6 +20689,24 @@ fi
fi fi
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 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
case "$ORIGINAL_LD_FOR_TARGET" in case "$ORIGINAL_LD_FOR_TARGET" in
......
...@@ -1915,6 +1915,17 @@ else ...@@ -1915,6 +1915,17 @@ else
AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET) AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
fi]) 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 ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
AC_SUBST(ORIGINAL_LD_FOR_TARGET) AC_SUBST(ORIGINAL_LD_FOR_TARGET)
case "$ORIGINAL_LD_FOR_TARGET" in case "$ORIGINAL_LD_FOR_TARGET" in
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
ORIGINAL_AS_FOR_TARGET="@ORIGINAL_AS_FOR_TARGET@" ORIGINAL_AS_FOR_TARGET="@ORIGINAL_AS_FOR_TARGET@"
ORIGINAL_LD_FOR_TARGET="@ORIGINAL_LD_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@" ORIGINAL_NM_FOR_TARGET="@ORIGINAL_NM_FOR_TARGET@"
exeext=@host_exeext@ exeext=@host_exeext@
fast_install=@enable_fast_install@ fast_install=@enable_fast_install@
...@@ -34,7 +35,13 @@ case "$invoked" in ...@@ -34,7 +35,13 @@ case "$invoked" in
dir=gas dir=gas
;; ;;
collect-ld) 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 prog=ld-new$exeext
dir=ld dir=ld
;; ;;
......
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