Ian Lance Taylor <i...@google.com> writes:

> On Thu, Jul 18, 2013 at 6:59 AM, Rainer Orth
> <r...@cebitec.uni-bielefeld.de> wrote:
>> Ian Lance Taylor <i...@google.com> writes:
>>
>>> I have committed a large patch to update libgo to the library that was
>>> part of the Go 1.1.1 release.  As usual, I'm not including the entire
>>> patch in this e-mail message, because it is too large.  I'm only
>>> including the changes to the files that are partially gccgo-specific.
>>> Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
>>> Committed to mainline and 4.8 branch.
>>
>> This broke the Solaris build:
>>
>> /vol/gcc/src/hg/trunk/local/libgo/go/log/syslog/syslog_libc.go:18:25: error: 
>> use of undefined type 'serverConn'
>>  func unixSyslog() (conn serverConn, err error) {
>>                          ^
>> make[6]: *** [log/syslog.lo] Error 1
>>
>> Didn't make much progress on this one.
>
> The interface I put in a while back for Solaris support got taken out
> from the master library, and I missed it.  This patch restores it.
> Committed to mainline and 4.8 branch.  I've also sent a patch to the
> master library to restore the interface.

Thanks, that allowed libgo.so to build on Solaris 10/x86.
Unfortunately, all tests FAIL like this:

Undefined                       first referenced
 symbol                             in file
runtime_unminit                     
/var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/amd64/libgo/.libs/libgo.so
runtime_minit                       
/var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/amd64/libgo/.libs/libgo.so
runtime_mpreinit                    
/var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/amd64/libgo/.libs/libgo.so
ld: fatal: symbol referencing errors. No output written to a.out
collect2: error: ld returned 1 exit status
FAIL: bufio

I've fixed this by also adding the definitions of those three functions
to runtime/thread-sema.c, although there might be a better way to handle
this:

diff --git a/libgo/runtime/thread-sema.c b/libgo/runtime/thread-sema.c
--- a/libgo/runtime/thread-sema.c
+++ b/libgo/runtime/thread-sema.c
@@ -146,3 +146,48 @@ runtime_goenvs (void)
 {
   runtime_goenvs_unix ();
 }
+
+// Called to initialize a new m (including the bootstrap m).
+// Called on the parent thread (main thread in case of bootstrap), can allocate memory.
+void
+runtime_mpreinit(M *mp)
+{
+	mp->gsignal = runtime_malg(32*1024, &mp->gsignalstack, &mp->gsignalstacksize);	// OS X wants >=8K, Linux >=2K
+}
+
+// Called to initialize a new m (including the bootstrap m).
+// Called on the new thread, can not allocate memory.
+void
+runtime_minit(void)
+{
+	M* m;
+	sigset_t sigs;
+
+	// Initialize signal handling.
+	m = runtime_m();
+	runtime_signalstack(m->gsignalstack, m->gsignalstacksize);
+	if (sigemptyset(&sigs) != 0)
+		runtime_throw("sigemptyset");
+	sigprocmask(SIG_SETMASK, &sigs, nil);
+}
+
+// Called from dropm to undo the effect of an minit.
+void
+runtime_unminit(void)
+{
+	runtime_signalstack(nil, 0);
+}
+
+void
+runtime_signalstack(byte *p, int32 n)
+{
+	stack_t st;
+
+	st.ss_sp = p;
+	st.ss_size = n;
+	st.ss_flags = 0;
+	if(p == nil)
+		st.ss_flags = SS_DISABLE;
+	if(sigaltstack(&st, nil) < 0)
+		*(int *)0xf1 = 0xf1;
+}
With that change, we're almost back to normal for Solaris testresults:

@@ -498,47 +516,63 @@
 
 
 Running target unix
+FAIL: net
+FAIL: runtime
 
                === libgo Summary for unix ===
 
-# of expected passes           131
+# of expected passes           120
+# of unexpected failures       2
 
 Running target unix/-m64
+FAIL: net
 FAIL: os
-FAIL: net/http
+FAIL: runtime
 FAIL: net/http/cgi
 
                === libgo Summary for unix/-m64 ===
 
-# of expected passes           128
-# of unexpected failures       3
+# of expected passes           118
+# of unexpected failures       4

The new failures are:

--- FAIL: TestReadUnixgramWithUnnamedSocket (0.00 seconds)
        :0: neighbor address is @
--- FAIL: TestReadUnixgramWithZeroBytesBuffer (0.00 seconds)
        :0: neighbor address is @
--- FAIL: TestUnixConnLocalAndRemoteNames (0.01 seconds)
        :0: got &net.UnixAddr{Name:"@", Net:"unix"}, expected 
&net.UnixAddr{Name:"", Net:"unix"}
        unix_test.go:159: Listener.Accept failed: use of closed network 
connection
--- FAIL: TestUnixgramConnLocalAndRemoteNames (0.00 seconds)
        :0: got &net.UnixAddr{Name:"@", Net:"unixgram"}, expected 
&net.UnixAddr{Name:"", Net:"unixgram"}
FAIL
FAIL: net

32-bit runtime:

runtime: memory allocated by OS (0xbd600000) not in usable range 
[0xdde00000,0x5de00000)
runtime: out of memory: cannot allocate 2097152-byte block (536870912 in use)
fatal error: out of memory

goroutine 61 [running]:

        :0

        :0

        :0

        :0

        :0
runtime_test.testConcurrentReadsAfterGrowth
        
/var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/libgo/gotest29011/test/map_test.go:261
        
/var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/libgo/gotest29011/test/map_test.go:261

        :0

        :0

        :0

goroutine 1 [chan receive]:
main.main
        
/var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/libgo/gotest29011/test/_testmain.go:184
FAIL: runtime

I haven't yet started looking in more detail.

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to