]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: do not run main when buildmode=c-shared
authorDavid Crawshaw <crawshaw@golang.org>
Thu, 16 Apr 2015 20:05:52 +0000 (16:05 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Fri, 17 Apr 2015 11:31:01 +0000 (11:31 +0000)
Change-Id: Ie7f85873978adf3fd5c739176f501ca219592824
Reviewed-on: https://go-review.googlesource.com/9011
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/proc.go

index 50f9dd7f5219bc093794b928a6d84a6e1f753a2a..88b2004c83d7c65c1da65330d9deaca16c74788e 100644 (file)
@@ -72,10 +72,6 @@ func main() {
 
        gcenable()
 
-       if islibrary {
-               // Allocate new M as main_main() is expected to block forever.
-               systemstack(newextram)
-       }
        main_init_done = make(chan bool)
        if iscgo {
                if _cgo_thread_start == nil {
@@ -107,9 +103,9 @@ func main() {
        needUnlock = false
        unlockOSThread()
 
-       if isarchive {
-               // A program compiled with -buildmode=c-archive has a main,
-               // but it is not executed.
+       if isarchive || islibrary {
+               // A program compiled with -buildmode=c-archive or c-shared
+               // has a main, but it is not executed.
                return
        }
        main_main()