Default powerpc64 to --plt-thread-safe for Go

Alan Modra
Wed Nov 19 22:25:00 GMT 2014

Go is multi-threaded, so use thread-safe plt stubs.  __go_go doesn't
actually start threads, but is a convenient libgo function with a
reasonably unique name that is called by all Go executables.  (Threads
are started by a static function of libgo, runtime_newosproc, called
by a whole lot of global functions, including runtime_starttheworld
and runtime_main.)

	* elf64-ppc.c (ppc64_elf_size_stubs): Add __go_go to thread_starters.
	* (Target_powerpc::do_relax): Add __go_go to thread_starters.

diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 0b65ab1..901a88d 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -11979,6 +11979,8 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
+	  /* libgo */
+	  "__go_go",
       unsigned i;
diff --git a/gold/ b/gold/
index 828bc16..500be1f 100644
--- a/gold/
+++ b/gold/
@@ -2720,6 +2720,8 @@ Target_powerpc<size, big_endian>::do_relax(int pass,
+	      /* libgo */
+	      "__go_go",
 	  if (parameters->options().shared())

Alan Modra
Australia Development Lab, IBM

More information about the Binutils mailing list