diff options
Diffstat (limited to 'gcc/go/gospec.c')
-rw-r--r-- | gcc/go/gospec.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/go/gospec.c b/gcc/go/gospec.c index 9ccbe75..2c60ee7 100644 --- a/gcc/go/gospec.c +++ b/gcc/go/gospec.c @@ -106,6 +106,9 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* The total number of arguments with the new stuff. */ int num_args = 1; + /* Supports split stack */ + int supports_split_stack = 0; + /* Whether the -o option was used. */ bool saw_opt_o = false; @@ -117,6 +120,9 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* Whether the -S option was used. */ bool saw_opt_S = false; + /* Whether the -m32 option was used. */ + bool saw_opt_m32 ATTRIBUTE_UNUSED = false; + /* The first input file with an extension of .go. */ const char *first_go_file = NULL; @@ -152,6 +158,10 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, library = (library == 0) ? 1 : library; break; + case OPT_m32: + saw_opt_m32 = true; + break; + case OPT_pg: case OPT_p: saw_profile_flag = true; @@ -236,15 +246,22 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* Copy the 0th argument, i.e., the name of the program itself. */ new_decoded_options[j++] = decoded_options[i++]; - /* If we are linking, pass -fsplit-stack if it is supported. */ #ifdef TARGET_CAN_SPLIT_STACK - if (library >= 0) + supports_split_stack = 1; +#endif + +#ifdef TARGET_CAN_SPLIT_STACK_64BIT + if (!saw_opt_m32) + supports_split_stack = 1; +#endif + + /* If we are linking, pass -fsplit-stack if it is supported. */ + if ((library >= 0) && supports_split_stack) { generate_option (OPT_fsplit_stack, NULL, 1, CL_DRIVER, &new_decoded_options[j]); j++; } -#endif /* NOTE: We start at 1 now, not 0. */ while (i < argc) @@ -381,19 +398,17 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER, &new_decoded_options[j++]); -#ifdef TARGET_CAN_SPLIT_STACK /* libgcc wraps pthread_create to support split stack, however, due to relative ordering of -lpthread and -lgcc, we can't just mark __real_pthread_create in libgcc as non-weak. But we need to link in pthread_create from pthread if we are statically linking, so we work- around by passing -u pthread_create to the linker. */ - if (static_link) + if (static_link && supports_split_stack) { generate_option (OPT_Wl_, "-u,pthread_create", 1, CL_DRIVER, &new_decoded_options[j]); j++; } -#endif #if defined(TARGET_SOLARIS) && !defined(USE_GLD) /* We use a common symbol for go$zerovalue. On Solaris, when not |