Commit 1a42d8fb authored by David Crawshaw's avatar David Crawshaw

cmd/link: allow internal PIE linking

Part of adding PIE internal linking on linux/amd64.

Change-Id: I5ce01d1974e5d4b1a8cbcc8b08157477631d8d24
Reviewed-on: https://go-review.googlesource.com/28543
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 04b4dbe1
......@@ -453,9 +453,9 @@ func (ctxt *Link) loadlib() {
Linkmode = LinkExternal
}
// Force external linking for PIE executables, as
// internal linking does not support TLS_IE.
if Buildmode == BuildmodePIE {
// Force external linking for PIE binaries on systems
// that do not support internal PIE linking.
if Buildmode == BuildmodePIE && (obj.GOOS != "linux" || SysArch.Family != sys.AMD64) {
Linkmode = LinkExternal
}
......@@ -636,8 +636,7 @@ func (ctxt *Link) loadlib() {
// binaries, so leave it enabled on OS X (Mach-O) binaries.
// Also leave it enabled on Solaris which doesn't support
// statically linked binaries.
switch Buildmode {
case BuildmodeExe, BuildmodePIE:
if Buildmode == BuildmodeExe {
if havedynamic == 0 && Headtype != obj.Hdarwin && Headtype != obj.Hsolaris {
*FlagD = true
}
......
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