cmd/link: do not pass -no-pie to host linker when -linkshared is passed
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 4 Apr 2018 22:07:41 +0000 (10:07 +1200)
committerMartín Ferrari <tincho@debian.org>
Sun, 22 Apr 2018 21:21:05 +0000 (22:21 +0100)
commit59be8f664597cb153d6ff28b4464bde5f8ce933a
tree8cccdb665a4507a87279464d56c8040f3505f60f
parent3fa6f77d3097c4c0c9184ae31c5b3ca40ca15f23
cmd/link: do not pass -no-pie to host linker when -linkshared is passed

As the comment above the code I'm changing says, when building with
-buildmode=exe, the default compiler flags produce code incompatible with PIE.
But when -linkshared is passed, the default compiler flags are not used so this
does not apply. And now I've found a system (linux/arm64 with glibc 2.27) where
this combination of flags causes a problem, albeit for reasons I don't really
understand, so stop passing -no-pie when -linkshared is passed.

Change-Id: I412ec7941dc0cb89e6d1b171fc29288aadcb9f20
Reviewed-on: https://go-review.googlesource.com/104815
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Gbp-Pq: Name 0003-Backport_nopie_fix.patch
src/cmd/link/internal/ld/lib.go