]> Cypherpunks repositories - gostls13.git/commit
cmd/go, cmd/link: implement -buildmode=pie on windows
authorAlex Brainman <alex.brainman@gmail.com>
Tue, 25 Feb 2020 07:42:24 +0000 (18:42 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Sun, 1 Mar 2020 05:00:10 +0000 (05:00 +0000)
commit95f382139043059a2a0780ba577b53893408f7e4
tree6529ca6e764bf447a67f439bdb73887882c224d2
parent91bc75b4870308b668d497ff22eada75219c3c2e
cmd/go, cmd/link: implement -buildmode=pie on windows

This CL implements windows version of -buildmode=pie code in both
cmd/go and cmd/link.

Windows executables built with -buildmode=pie set (unlike the one
built with -buildmode=exe) will have extra .reloc PE section, and
will have no IMAGE_FILE_RELOCS_STRIPPED flag set. They will also
have IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE flag set, and
IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA flag set for windows/amd64.

Both cgo and non-cgo versions are implemented. And TestBuildmodePIE
is extended to test both cgo and non-cgo versions on windows and
linux.

This CL used some code from CLs 152759 and 203602.

RELNOTE=yes

Fixes #27144
Updates #35192

Change-Id: I1249e4ffbd79bd4277efefb56db321c390c0f76f
Reviewed-on: https://go-review.googlesource.com/c/go/+/214397
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/dist/test.go
src/cmd/go/go_test.go
src/cmd/go/internal/work/init.go
src/cmd/go/testdata/script/version.txt
src/cmd/internal/sys/supported.go
src/cmd/link/internal/ld/config.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/pe.go