Skip to content

Commit

Permalink
cmd/compile, cmd/go: generate position independent code with -buildmo…
Browse files Browse the repository at this point in the history
…de=c-shared on arm

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

Fixes golang#10914

Change-Id: Ide8f9bbe50fecb5d11cd579915ee98d4c7efe403
Reviewed-on: https://go-review.googlesource.com/14142
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
mwhudson committed Sep 4, 2015
1 parent 40af15f commit 876b7cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/cmd/compile/internal/gc/lex.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions src/cmd/go/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 876b7cc

Please sign in to comment.