diff --git a/src/cmd/compile/internal/gc/lex.go b/src/cmd/compile/internal/gc/lex.go index b6a43ac49ef..6ea14823133 100644 --- a/src/cmd/compile/internal/gc/lex.go +++ b/src/cmd/compile/internal/gc/lex.go @@ -227,7 +227,8 @@ func Main() { if Thearch.Thechar == '6' { obj.Flagcount("largemodel", "generate code that assumes a large memory model", &flag_largemodel) } - if Thearch.Thechar == '5' || Thearch.Thechar == '6' || Thearch.Thechar == '8' || Thearch.Thechar == '9' { + switch Thearch.Thechar { + case '5', '6', '7', '8', '9': 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 e25a56ac301..b1c95220ccc 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -388,7 +388,7 @@ func buildModeInit() { codegenArg = "-fPIC" } else { switch platform { - case "linux/386", "linux/amd64", "linux/arm": + case "linux/386", "linux/amd64", "linux/arm", "linux/arm64": buildAsmflags = append(buildAsmflags, "-D=shared=1") default: fatalf("-buildmode=shared not supported on %s\n", platform) @@ -407,7 +407,7 @@ func buildModeInit() { codegenArg = "-fPIC" } else { switch platform { - case "linux/386", "linux/amd64", "linux/arm": + case "linux/386", "linux/amd64", "linux/arm", "linux/arm64": buildAsmflags = append(buildAsmflags, "-D=shared=1") default: fatalf("-buildmode=shared not supported on %s\n", platform) diff --git a/src/cmd/link/internal/arm64/obj.go b/src/cmd/link/internal/arm64/obj.go index 5c28551d65e..ae121c28bf3 100644 --- a/src/cmd/link/internal/arm64/obj.go +++ b/src/cmd/link/internal/arm64/obj.go @@ -104,7 +104,7 @@ func archinit() { break } - if ld.Buildmode == ld.BuildmodeCShared { + if ld.Buildmode == ld.BuildmodeCShared || ld.DynlinkingGo() { ld.Linkmode = ld.LinkExternal } diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index a311c780ed8..96ead2f044b 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -321,7 +321,7 @@ func (mode *BuildMode) Set(s string) error { } *mode = BuildmodeCShared case "shared": - if goos != "linux" || (goarch != "386" && goarch != "amd64" && goarch != "arm") { + if goos != "linux" || (goarch != "386" && goarch != "amd64" && goarch != "arm" && goarch != "arm64") { return badmode() } *mode = BuildmodeShared