aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2013-01-16 16:32:35 +0000
committerIan Lance Taylor <iant@google.com>2013-01-16 16:32:35 +0000
commit2ee91b20061f309a8587073b8dd46af98f63a6d4 (patch)
tree2a4c712c49bdecebb3c2ee59b3f489e69a68a3ed /gcc/go
parentf96b3fda29034eed880288ff302baae5613cb245 (diff)
* gospec.c: pass -u pthread_create to linker when static linking.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@195244 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/ChangeLog4
-rw-r--r--gcc/go/gospec.c16
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 6d6b14b1109..61739cea4f2 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,7 @@
+2013-01-16 Shenghou Ma <minux.ma@gmail.com>
+
+ * gospec.c: pass -u pthread_create to linker when static linking.
+
2012-12-21 Ian Lance Taylor <iant@google.com>
PR bootstrap/54659
diff --git a/gcc/go/gospec.c b/gcc/go/gospec.c
index 4f0764e4a31..0be7716be5c 100644
--- a/gcc/go/gospec.c
+++ b/gcc/go/gospec.c
@@ -227,7 +227,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
#endif
/* Make sure to have room for the trailing NULL argument. */
- num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 5;
+ num_args = argc + need_math + shared_libgcc + (library > 0) * 5 + 10;
new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args);
i = 0;
@@ -381,6 +381,20 @@ 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 to the linker. */
+ if (static_link)
+ {
+ generate_option (OPT_Wl_, "-u,pthread_create", 1, CL_DRIVER,
+ &new_decoded_options[j]);
+ j++;
+ }
+#endif
+
*in_decoded_options_count = j;
*in_decoded_options = new_decoded_options;
*in_added_libraries = added_libraries;