Commit 9515100a authored by Timo Teräs's avatar Timo Teräs

community/go: default buildmode=pie

parent 6321ef7f
......@@ -4,7 +4,7 @@ pkgname=go
pkgver=1.6.2
# This should be the latest commit on the corresponding release branch
_toolsver="c887be1b2ebd11663d4bf2fbca508c449172339e"
pkgrel=4
pkgrel=5
pkgdesc="Go programming language compiler"
url="http://www.golang.org/"
arch="all"
......@@ -17,7 +17,7 @@ install=""
subpackages="$pkgname-doc $pkgname-tools $pkgname-cross"
source="http://golang.org/dl/go${pkgver}.src.tar.gz
$pkgname-tools-$pkgver.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz
no-pic.patch
default-buildmode-pie.patch
"
# NOTE: building go for x86 with grsec kernel requires:
......@@ -147,10 +147,10 @@ cross() {
}
md5sums="d1b50fa98d9a71eeee829051411e6207 go1.6.2.src.tar.gz
733a96b59562ed84ff552542f16a3ab3 go-tools-1.6.2.tar.gz
efa8ac40fa8429f7cd6f23eca05a0a0f no-pic.patch"
1e3ad4f657ac6c22a92e8fc907893e4f default-buildmode-pie.patch"
sha256sums="787b0b750d037016a30c6ed05a8a70a91b2e9db4bd9b1a2453aa502a63f1bccc go1.6.2.src.tar.gz
955e5a119babad356d9cf00cdaaf3c27648d4451109b467c872fad8cc94d5b56 go-tools-1.6.2.tar.gz
1eb60ded9035e9692e4c17b2bb6e9c073e21261eaafa56ee0528d5d2c43a936d no-pic.patch"
f3e5a8e0c1c05c34f489ccbfb65291ab2265fa0ef04b8b501e5c98b17547c4b9 default-buildmode-pie.patch"
sha512sums="e148022f9e18b5d5b05744f1aa9fa3ef82e255752179545711ade077e271216aa5b450859a764fdfb028ae4faa26adad8d0a0a5268b31396ab9d14de3cb2f20a go1.6.2.src.tar.gz
955def7cc3e5ceb5d8e47477400007d32c25f3bc2764f04a0451bd0235af507e63a0966d201a345f51ac764471da8620b5357d1099ec39e2422bd04d25fd71b8 go-tools-1.6.2.tar.gz
51e4c3ee0cda98090db5d00468072bcbf5f0a1a429dd8dedddccaa1467b285f724b012be96d329566b195470bea0aaf4b464e8ba6d2029b0dd42678a7a14b663 no-pic.patch"
13cd386c38875b951da4057586007f3c67503dc79ddf57befbf763af85ec2cd2a2e6b00614450c179c93f1f8747ee7456ee412adccd08a5f115b33812598a148 default-buildmode-pie.patch"
--- go/src/cmd/go/build.go.orig 2016-07-07 11:52:03.315793199 +0300
+++ go/src/cmd/go/build.go 2016-04-20 02:50:07.000000000 +0300
@@ -363,7 +363,8 @@
ldBuildmode = "c-shared"
case "default":
switch platform {
+ case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le",
+ "android/amd64", "android/arm", "android/arm64", "android/386":
- case "android/arm", "android/arm64", "android/amd64", "android/386":
codegenArg = "-shared"
ldBuildmode = "pie"
default:
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index 8ccbec9dd634..4e96bfadc260 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1194,6 +1194,11 @@ func hostlink() {
argv = append(argv, peimporteddlls()...)
}
+ // The Go linker does not currently support building PIE
+ // executables when using the external linker. See:
+ // https://github.com/golang/go/issues/6940
+ argv = append(argv, "-fno-PIC")
+
if Debug['v'] != 0 {
fmt.Fprintf(&Bso, "host link:")
for _, v := range argv {
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