diff options
author | Alex Brainman <alex.brainman@gmail.com> | 2020-02-25 18:42:24 +1100 |
---|---|---|
committer | Alex Brainman <alex.brainman@gmail.com> | 2020-03-01 05:00:10 +0000 |
commit | 95f382139043059a2a0780ba577b53893408f7e4 (patch) | |
tree | 6529ca6e764bf447a67f439bdb73887882c224d2 /src/cmd/go/testdata/script/version.txt | |
parent | 91bc75b4870308b668d497ff22eada75219c3c2e (diff) | |
download | go-95f382139043059a2a0780ba577b53893408f7e4.tar.gz go-95f382139043059a2a0780ba577b53893408f7e4.zip |
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>
Diffstat (limited to 'src/cmd/go/testdata/script/version.txt')
-rw-r--r-- | src/cmd/go/testdata/script/version.txt | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cmd/go/testdata/script/version.txt b/src/cmd/go/testdata/script/version.txt index 0ed1194840..0123ac6d53 100644 --- a/src/cmd/go/testdata/script/version.txt +++ b/src/cmd/go/testdata/script/version.txt @@ -22,8 +22,6 @@ stdout '^\tpath\trsc.io/fortune' stdout '^\tmod\trsc.io/fortune\tv1.0.0' # Repeat the test with -buildmode=pie. -# TODO(golang.org/issue/27144): don't skip after -buildmode=pie is implemented -# on Windows. [!buildmode:pie] stop go build -buildmode=pie -o external.exe rsc.io/fortune go version external.exe @@ -33,8 +31,8 @@ stdout '^\tpath\trsc.io/fortune' stdout '^\tmod\trsc.io/fortune\tv1.0.0' # Also test PIE with internal linking. -# currently only supported on linux/amd64 and linux/arm64. -[!linux] stop +# currently only supported on linux/amd64, linux/arm64 and windows/amd64. +[!linux] [!windows] stop [!amd64] [!arm64] stop go build -buildmode=pie -ldflags=-linkmode=internal -o internal.exe rsc.io/fortune go version internal.exe |