]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/8g: don't call gc.Fatal during initalisation
authorDave Cheney <dave@cheney.net>
Fri, 1 May 2015 00:15:33 +0000 (10:15 +1000)
committerDave Cheney <dave@cheney.net>
Fri, 1 May 2015 01:33:55 +0000 (01:33 +0000)
Fixes #10592

Calling gc.Fatal before gc.Main has been called ends up flushing gc.bstdout before
it is properly set up. Ideally obj.Bflush would handle this case, but that type
and its callers are rather convoluted, so take the simpler route and avoid calling
gc.Fatal altogether.

Change-Id: I338b469e86edba558b6bedff35bb904bfc3d6990
Reviewed-on: https://go-review.googlesource.com/9525
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/8g/galign.go

index 9eb1cf5d0852c3648bcc793f98d574ca3f2863e4..9125356691dc23d138772e00866c17150d622825 100644 (file)
@@ -8,6 +8,8 @@ import (
        "cmd/internal/gc"
        "cmd/internal/obj"
        "cmd/internal/obj/x86"
+       "fmt"
+       "os"
 )
 
 var thechar int = '8'
@@ -58,7 +60,8 @@ func main() {
                gc.Thearch.FREGMIN = x86.REG_X0
                gc.Thearch.FREGMAX = x86.REG_X7
        default:
-               gc.Fatal("unsupported setting GO386=%s", v)
+               fmt.Fprintf(os.Stderr, "unsupported setting GO386=%s\n", v)
+               os.Exit(1)
        }
        gc.Thearch.MAXWIDTH = MAXWIDTH
        gc.Thearch.ReservedRegs = resvd