diff mbox

Go patch committed: Pass -t to native linker on Solaris

Message ID mcrioo4cuhz.fsf@iant-glaptop.roam.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor June 13, 2014, 10:30 p.m. UTC
This patch changes the gccgo driver to pass -t to the native linker on
Solaris.  This avoids warnings like

ld: warning: symbol 'go$zerovalue' has differing sizes:
        (file hello.o value=0x8; file i386-pc-solaris2.11/libgo/.libs/libgo.so value=0x800);
        hello.o definition taken and updated with larger size

The symbol go$zerovalue is a common symbol and it's normal for it to
have different sizes in different object files and shared libraries.
The linker should take the larger size, which is what it does.
Unfortunately, by default, it emits a warning, which in this case is
useless.  This patch passes the -t option to disable the warning.

Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Bootstrapped and ran a few tests on x86_64-sun-solaris.  Committed to
mainline.

Ian


2014-06-13  Ian Lance Taylor  <iant@google.com>

	PR go/61496
	* gospec.c (lang_specific_driver): On Solaris, when not using GNU
	ld, add -t option to avoid warning about common symbol changing
	size.
diff mbox

Patch

Index: gospec.c
===================================================================
--- gospec.c	(revision 211248)
+++ gospec.c	(working copy)
@@ -395,6 +395,15 @@  lang_specific_driver (struct cl_decoded_
     }
 #endif
 
+#if defined(TARGET_SOLARIS) && !defined(USE_GLD)
+  /* We use a common symbol for go$zerovalue.  On Solaris, when not
+     using the GNU linker, the Solaris linker needs an option to not
+     warn about this.  Everything works without this option, but you
+     get unsightly warnings at link time.  */
+  generate_option (OPT_Wl_, "-t", 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;