Commit 876b7cc2 authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle

cmd/compile, cmd/go: generate position independent code with -buildmode=c-shared on arm

All the code was there to do this, it just wasn't hooked up.

Fixes #10914

Change-Id: Ide8f9bbe50fecb5d11cd579915ee98d4c7efe403
Reviewed-on: https://go-review.googlesource.com/14142Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 40af15f2
...@@ -237,9 +237,11 @@ func Main() { ...@@ -237,9 +237,11 @@ func Main() {
obj.Flagcount("y", "debug declarations in canned imports (with -d)", &Debug['y']) obj.Flagcount("y", "debug declarations in canned imports (with -d)", &Debug['y'])
var flag_shared int var flag_shared int
var flag_dynlink bool 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' { if Thearch.Thechar == '6' {
obj.Flagcount("largemodel", "generate code that assumes a large memory model", &flag_largemodel) 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") 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) obj.Flagstr("cpuprofile", "write cpu profile to `file`", &cpuprofile)
......
...@@ -344,12 +344,9 @@ func buildModeInit() { ...@@ -344,12 +344,9 @@ func buildModeInit() {
codegenArg = "-fPIC" codegenArg = "-fPIC"
} else { } else {
switch platform { switch platform {
case "linux/amd64": case "linux/amd64", "linux/arm", "android/arm":
codegenArg = "-shared" codegenArg = "-shared"
case "linux/arm":
buildAsmflags = append(buildAsmflags, "-shared")
case "darwin/amd64": case "darwin/amd64":
case "android/arm":
default: default:
fatalf("-buildmode=c-shared not supported on %s\n", platform) fatalf("-buildmode=c-shared not supported on %s\n", platform)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment