ld: mark PE executables as terminal services aware

This has been the default in MSVC for a very long time, and it's hard to
imagine modern programs actually wanting the old legacy behavior. For
example, no modern programs try to install their junk into C:\windows
and therefore need to have an emulated writable windows directory.
That's not really even allowed by ACLs on modern systems.

Change-Id: Iadaca6815e39ea5c6b05c1cac5a95cfc35e5b48a
Reviewed-on: https://go-review.googlesource.com/c/go/+/191840
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
Jason A. Donenfeld 2019-08-26 07:08:51 -06:00
parent 2afe9d4dec
commit 8fc35238a7
2 changed files with 47 additions and 39 deletions

View file

@ -1172,6 +1172,9 @@ func (ctxt *Link) hostlink() {
} else {
argv = append(argv, "-mconsole")
}
// Mark as having awareness of terminal services, to avoid
// ancient compatibility hacks.
argv = append(argv, "-Wl,--tsaware")
case objabi.Haix:
argv = append(argv, "-pthread")
// prevent ld to reorder .text functions to keep the same