1
# DP: Pass -fuse-ld=gold to gccgo on targets supporting -fsplit-stack
5
* gospec.c (lang_specific_driver): Pass -fuse-ld=gold on targets
6
supporting -fsplit-stack, unless overwritten.
9
* configure.ac: New define HAVE_GOLD_NON_DEFAULT.
10
* config.in: Regenerate.
13
* configure.ac (libgo_cv_c_linker_supports_split_stack): Fix quoting.
14
Check the linker used by the gccgo driver.
16
Index: b/src/gcc/go/gospec.c
17
===================================================================
18
--- a/src/gcc/go/gospec.c
19
+++ b/src/gcc/go/gospec.c
21
/* Whether the -S option was used. */
22
bool saw_opt_S = false;
24
+ /* "-fuse-ld=" if it appears on the command line. */
25
+ bool saw_use_ld = false;
28
/* The first input file with an extension of .go. */
29
const char *first_go_file = NULL;
36
+ case OPT_fuse_ld_bfd:
37
+ case OPT_fuse_ld_gold:
47
+#if defined(TARGET_CAN_SPLIT_STACK) && defined(HAVE_GOLD_NON_DEFAULT)
52
/* Make sure to have room for the trailing NULL argument. */
53
- num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 10;
54
+ num_args = argc + need_math + shared_libgcc + need_gold +
55
+ (library > 0) * 5 + 10;
56
new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args);
60
&new_decoded_options[j]);
63
+#ifdef HAVE_GOLD_NON_DEFAULT
66
+ generate_option (OPT_fuse_ld_gold, NULL, 1, CL_DRIVER,
67
+ &new_decoded_options[j]);
73
/* NOTE: We start at 1 now, not 0. */
74
Index: b/src/libgo/configure.ac
75
===================================================================
76
--- a/src/libgo/configure.ac
77
+++ b/src/libgo/configure.ac
80
AC_CACHE_CHECK([whether linker supports split stack],
81
[libgo_cv_c_linker_supports_split_stack],
82
-libgo_cv_c_linker_supports_split_stack=no
83
-if $LD --help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then
84
+[libgo_cv_c_linker_supports_split_stack=no
85
+if $GOC -Wl,--help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then
86
libgo_cv_c_linker_supports_split_stack=yes
89
if test "$libgo_cv_c_linker_supports_split_stack" = yes; then
90
AC_DEFINE(LINKER_SUPPORTS_SPLIT_STACK, 1,
91
[Define if the linker support split stack adjustments])
92
Index: b/src/gcc/config.in
93
===================================================================
94
--- a/src/gcc/config.in
95
+++ b/src/gcc/config.in
96
@@ -1133,6 +1133,12 @@
100
+/* Define if the gold linker is available as a non-default */
101
+#ifndef USED_FOR_TARGET
102
+#undef HAVE_GOLD_NON_DEFAULT
106
/* Define if you have the iconv() function. */
107
#ifndef USED_FOR_TARGET
109
Index: b/src/gcc/configure.ac
110
===================================================================
111
--- a/src/gcc/configure.ac
112
+++ b/src/gcc/configure.ac
113
@@ -2059,6 +2059,12 @@
115
AC_MSG_RESULT($ld_is_gold)
117
+# Check to see if ld is used, and gold is available
118
+if test x$ld_is_gold = xno && which ${gcc_cv_ld}.gold >/dev/null 2>&1; then
119
+ AC_DEFINE(HAVE_GOLD_NON_DEFAULT, 1,
120
+ [Define if the gold linker is available as a non-default])
123
ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld
124
AC_SUBST(ORIGINAL_LD_FOR_TARGET)
125
case "$ORIGINAL_LD_FOR_TARGET" in