mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go, cmd/link: -buildmode=pie for linux/amd64
Depends on external linking right now. I have no immediate use for this, but wanted to check how hard it is to support as android/amd64 is coming and it will require PIE. Change-Id: I65c6b19159f40db4c79cf312cd0368c2b2527bfd Reviewed-on: https://go-review.googlesource.com/16072 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
22d4c8bf13
commit
b7e4de4b1e
6 changed files with 50 additions and 4 deletions
|
|
@ -303,7 +303,7 @@ func (mode *BuildMode) Set(s string) error {
|
|||
*mode = BuildmodeExe
|
||||
case "pie":
|
||||
switch goos {
|
||||
case "android":
|
||||
case "android", "linux":
|
||||
default:
|
||||
return badmode()
|
||||
}
|
||||
|
|
@ -516,6 +516,12 @@ func loadlib() {
|
|||
Linkmode = LinkExternal
|
||||
}
|
||||
|
||||
// Force external linking for PIE executables, as
|
||||
// internal linking does not support TLS_IE.
|
||||
if Buildmode == BuildmodePIE {
|
||||
Linkmode = LinkExternal
|
||||
}
|
||||
|
||||
// cgo on Darwin must use external linking
|
||||
// we can always use external linking, but then there will be circular
|
||||
// dependency problems when compiling natively (external linking requires
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue