Skip to content

Commit 876b7cc

Browse files
committed
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/14142 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 40af15f commit 876b7cc

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/cmd/compile/internal/gc/lex.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,11 @@ func Main() {
237237
obj.Flagcount("y", "debug declarations in canned imports (with -d)", &Debug['y'])
238238
var flag_shared int
239239
var flag_dynlink bool
240+
if Thearch.Thechar == '6' || Thearch.Thechar == '5' {
241+
obj.Flagcount("shared", "generate code that can be linked into a shared library", &flag_shared)
242+
}
240243
if Thearch.Thechar == '6' {
241244
obj.Flagcount("largemodel", "generate code that assumes a large memory model", &flag_largemodel)
242-
obj.Flagcount("shared", "generate code that can be linked into a shared library", &flag_shared)
243245
flag.BoolVar(&flag_dynlink, "dynlink", false, "support references to Go symbols defined in other shared libraries")
244246
}
245247
obj.Flagstr("cpuprofile", "write cpu profile to `file`", &cpuprofile)

src/cmd/go/build.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,9 @@ func buildModeInit() {
344344
codegenArg = "-fPIC"
345345
} else {
346346
switch platform {
347-
case "linux/amd64":
347+
case "linux/amd64", "linux/arm", "android/arm":
348348
codegenArg = "-shared"
349-
case "linux/arm":
350-
buildAsmflags = append(buildAsmflags, "-shared")
351349
case "darwin/amd64":
352-
case "android/arm":
353350
default:
354351
fatalf("-buildmode=c-shared not supported on %s\n", platform)
355352
}

0 commit comments

Comments
 (0)