1
0
mirror of https://github.com/golang/go synced 2024-11-12 04:00:23 -07:00

cmd/link: pass -Wl,-z,relro to host linker in -buildmode=PIE

Fixes #15485

Change-Id: I8e9314be91db89873130b232b589a284822e6643
Reviewed-on: https://go-review.googlesource.com/22687
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Michael Hudson-Doyle 2016-05-02 13:58:48 +12:00
parent 5325fbc7db
commit 45f39fb467

View File

@ -1091,6 +1091,9 @@ func hostlink() {
argv = append(argv, "-Wl,-pagezero_size,4000000")
}
case BuildmodePIE:
if UseRelro() {
argv = append(argv, "-Wl,-z,relro")
}
argv = append(argv, "-pie")
case BuildmodeCShared:
if HEADTYPE == obj.Hdarwin {