mirror of
https://github.com/golang/go.git
synced 2025-05-06 08:03:03 +00:00
cmd/go: -buildmode=c-shared should work on darwin/386
* Enable c-shared buildmode on darwin/386 * dyld does not support text relocation on i386. Add -read_only_relocs suppress flag to linker Fixes #13904 Change-Id: I9adbd20d3f36ce9bbccf1bffb746b391780d088f Reviewed-on: https://go-review.googlesource.com/18500 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
4206e9d343
commit
9efc46f1cb
@ -27,7 +27,7 @@ fi
|
|||||||
# Directory where cgo headers and outputs will be installed.
|
# Directory where cgo headers and outputs will be installed.
|
||||||
# The installation directory format varies depending on the platform.
|
# The installation directory format varies depending on the platform.
|
||||||
installdir=pkg/${goos}_${goarch}_testcshared_shared
|
installdir=pkg/${goos}_${goarch}_testcshared_shared
|
||||||
if [ "${goos}/${goarch}" == "darwin/amd64" ]; then
|
if [ "${goos}" == "darwin" ]; then
|
||||||
installdir=pkg/${goos}_${goarch}_testcshared
|
installdir=pkg/${goos}_${goarch}_testcshared
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
2
src/cmd/dist/test.go
vendored
2
src/cmd/dist/test.go
vendored
@ -656,7 +656,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
|
|||||||
case "c-shared":
|
case "c-shared":
|
||||||
switch pair {
|
switch pair {
|
||||||
case "linux-386", "linux-amd64", "linux-arm", "linux-arm64",
|
case "linux-386", "linux-amd64", "linux-arm", "linux-arm64",
|
||||||
"darwin-amd64",
|
"darwin-amd64", "darwin-386",
|
||||||
"android-arm", "android-arm64", "android-386":
|
"android-arm", "android-arm64", "android-386":
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ func buildModeInit() {
|
|||||||
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386",
|
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386",
|
||||||
"android/amd64", "android/arm", "android/arm64", "android/386":
|
"android/amd64", "android/arm", "android/arm64", "android/386":
|
||||||
codegenArg = "-shared"
|
codegenArg = "-shared"
|
||||||
case "darwin/amd64":
|
case "darwin/amd64", "darwin/386":
|
||||||
default:
|
default:
|
||||||
fatalf("-buildmode=c-shared not supported on %s\n", platform)
|
fatalf("-buildmode=c-shared not supported on %s\n", platform)
|
||||||
}
|
}
|
||||||
|
@ -1068,7 +1068,7 @@ func hostlink() {
|
|||||||
argv = append(argv, "-pie")
|
argv = append(argv, "-pie")
|
||||||
case BuildmodeCShared:
|
case BuildmodeCShared:
|
||||||
if HEADTYPE == obj.Hdarwin {
|
if HEADTYPE == obj.Hdarwin {
|
||||||
argv = append(argv, "-dynamiclib")
|
argv = append(argv, "-dynamiclib", "-Wl,-read_only_relocs,suppress")
|
||||||
} else {
|
} else {
|
||||||
// ELF.
|
// ELF.
|
||||||
argv = append(argv, "-Wl,-Bsymbolic")
|
argv = append(argv, "-Wl,-Bsymbolic")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user