Ian Lance Taylor <i...@google.com> writes: > 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.
Works fine, thanks. Just before your patch arrived, I meant to test the following, slightly more general patch. Perhaps it's an option to handle other quirks like this? Rainer 2014-06-13 Rainer Orth <r...@cebitec.uni-bielefeld.de> gcc/go: PR go/61496 * gospec.c (lang_specific_driver) [TARGET_GO_LINK_OPTIONS]: Pass target specific link options. gcc: PR go/61496 * config/sol2.h [!USE_GLD] (TARGET_GO_LINK_OPTIONS): Define.
# HG changeset patch # Parent 59e0e6f1eecd53ddab49b2cd5015be221b5e505a Suppress Solaris ld warnings about go$zerovalue sizes (PR go/61496) diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -303,6 +303,12 @@ along with GCC; see the file COPYING3. /* collect2.c can only parse GNU nm -n output. Solaris nm needs -png to produce the same format. */ #define NM_FLAGS "-png" + +#ifndef USE_GLD +/* Solaris ld warns about common symbols of differing sizes, which Go uses + for go$zerovalue. Pass -t to suppress that warning. */ +#define TARGET_GO_LINK_OPTIONS "-t" +#endif /* The system headers under Solaris 2 are C++-aware since 2.0. */ #define NO_IMPLICIT_EXTERN_C diff --git a/gcc/go/gospec.c b/gcc/go/gospec.c --- a/gcc/go/gospec.c +++ b/gcc/go/gospec.c @@ -395,6 +395,12 @@ lang_specific_driver (struct cl_decoded_ } #endif +#ifdef TARGET_GO_LINK_OPTIONS + /* Pass target specific linker options if present. */ + generate_option (OPT_Wl_, TARGET_GO_LINK_OPTIONS, 1, CL_DRIVER, + &new_decoded_options[j++]); +#endif + *in_decoded_options_count = j; *in_decoded_options = new_decoded_options; *in_added_libraries = added_libraries;
-- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University