]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix build after CL 9164 on Linux
authorShenghou Ma <minux@golang.org>
Wed, 22 Apr 2015 22:03:18 +0000 (18:03 -0400)
committerMinux Ma <minux@golang.org>
Wed, 22 Apr 2015 23:21:25 +0000 (23:21 +0000)
There is an assumption that the function executed in child thread
created by runtime.close should not return. And different systems
enforce that differently: some exit that thread, some exit the
whole process.

The test TestNewOSProc0 introduced in CL 9161 breaks that assumption,
so we need to adjust the code to only exit the thread should the
called function return.

Change-Id: Id631cb2f02ec6fbd765508377a79f3f96c6a2ed6
Reviewed-on: https://go-review.googlesource.com/9246
Reviewed-by: Dave Cheney <dave@cheney.net>
src/runtime/sys_linux_amd64.s
src/runtime/sys_linux_arm.s
src/runtime/sys_linux_arm64.s
src/runtime/sys_linux_ppc64x.s

index 3a0c47fb63c50959852daf9a0ba9b0e9841f04b8..fa7fa164b5ef06ee18aaceb0c39ff660f71041f8 100644 (file)
@@ -350,7 +350,7 @@ nog:
        // Call fn
        CALL    R12
 
-       // It shouldn't return.  If it does, exit
+       // It shouldn't return.  If it does, exit that thread.
        MOVL    $111, DI
        MOVL    $60, AX
        SYSCALL
index 9d21eaebcbdb5228fc1fdb44f18eb82e07284d7c..d0c6d22f31f3f5fe2cbb34d1f920e8d77c51f7ef 100644 (file)
@@ -307,7 +307,7 @@ nog:
        MOVW    $16(R13), R13
        BL      (R0)
 
-       // It shouldn't return
+       // It shouldn't return.  If it does, exit that thread.
        MOVW    $0, R0
        MOVW    R0, 4(R13)
        BL      runtime·exit1(SB)
index ea8520c51d2a06fb7b1d612796bd5f3fcff80009..389fea0ddec1640d0d0d2aa6491d765c75f66915 100644 (file)
@@ -361,10 +361,10 @@ nog:
        MOVD    R12, R0
        BL      (R0)
 
-       // It shouldn't return.  If it does, exit
+       // It shouldn't return.  If it does, exit that thread.
        MOVW    $111, R0
 again:
-       MOVD    $SYS_exit_group, R8
+       MOVD    $SYS_exit, R8
        SVC
        B       again   // keep exiting
 
index ff397f003b3e770396a3376bb669e2fb1989e4d6..44a22c9c7756b8d22dc47f09e9410531671a7fbe 100644 (file)
@@ -346,9 +346,9 @@ nog:
        MOVD    R12, CTR
        BL      (CTR)
 
-       // It shouldn't return.  If it does, exit
+       // It shouldn't return.  If it does, exit that thread.
        MOVW    $111, R3
-       SYSCALL $SYS_exit_group
+       SYSCALL $SYS_exit
        BR      -2(PC)  // keep exiting
 
 TEXT runtime·sigaltstack(SB),NOSPLIT,$-8