diff --git a/src/cmd/compile/internal/gc/lex.go b/src/cmd/compile/internal/gc/lex.go index 09a44b28e6bba0..8e762d0ed3910d 100644 --- a/src/cmd/compile/internal/gc/lex.go +++ b/src/cmd/compile/internal/gc/lex.go @@ -237,9 +237,11 @@ func Main() { obj.Flagcount("y", "debug declarations in canned imports (with -d)", &Debug['y']) var flag_shared int var flag_dynlink bool + if Thearch.Thechar == '6' || Thearch.Thechar == '5' { + obj.Flagcount("shared", "generate code that can be linked into a shared library", &flag_shared) + } if Thearch.Thechar == '6' { obj.Flagcount("largemodel", "generate code that assumes a large memory model", &flag_largemodel) - obj.Flagcount("shared", "generate code that can be linked into a shared library", &flag_shared) flag.BoolVar(&flag_dynlink, "dynlink", false, "support references to Go symbols defined in other shared libraries") } obj.Flagstr("cpuprofile", "write cpu profile to `file`", &cpuprofile) diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 0b147252ec1a4c..df7433859380c0 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -344,12 +344,9 @@ func buildModeInit() { codegenArg = "-fPIC" } else { switch platform { - case "linux/amd64": + case "linux/amd64", "linux/arm", "android/arm": codegenArg = "-shared" - case "linux/arm": - buildAsmflags = append(buildAsmflags, "-shared") case "darwin/amd64": - case "android/arm": default: fatalf("-buildmode=c-shared not supported on %s\n", platform) }