This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Pass -t to native linker on Solaris
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Cc: ro at gcc dot gnu dot org
- Date: Fri, 13 Jun 2014 15:30:48 -0700
- Subject: Go patch committed: Pass -t to native linker on Solaris
- Authentication-results: sourceware.org; auth=none
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.
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;