]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: allow internal PIE linking
authorDavid Crawshaw <crawshaw@golang.org>
Tue, 6 Sep 2016 12:08:47 +0000 (08:08 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Sun, 11 Sep 2016 21:53:21 +0000 (21:53 +0000)
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: Ian Lance Taylor <iant@golang.org>
src/cmd/link/internal/ld/lib.go

index 7750f1dc68f30ab3da39ee3eb6a05c9997bf6db8..093a6f1b3d57ffca59178fe314f0314f5d4af73d 100644 (file)
@@ -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
                }