Repository: go
Issue: cmd/go: buildmode=pie causes silent failures when using PIE-incompatible C libraries, windows exit status 3221225477 / 0xC0000005
Labels: OS-Windows,NeedsInvestigation

### What version of Go are you using (`go version`)?

<pre>
go version go1.15.3 windows/amd64
</pre>

### Does this issue reproduce with the latest release?
Yes,
Tested and failed with 1.15.2 and 1.15.3.
No problems with prior versions including 1.13.15 and 1.14.9.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Fox\AppData\Local\go-build
set GOENV=C:\Users\Fox\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=c:\GoPath\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=c:\GoPath
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\Fox\AppData\Local\Temp\go-build476616686=/tmp/go-build -gno-record-gcc-switches
GOROOT/bin/go version: go version go1.15.3 windows/amd64
GOROOT/bin/go tool compile -V: compile version go1.15.3
gdb --version: GNU gdb (GDB) 7.9.1
</pre></details>

### What did you do?

Attempted to migrate working program to 1.15.  Silent failure with no indication as to why.
Traced down problematic package to a go wrapper around the C libde265 video decoder.
Program "appears" to build and run, but never progresses to user code when executed and fails with an exit status.
"go run" returns the error exit status.

I do not know now to dig into the build / link process to troubleshoot further.....


### What did you expect to see?
C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>go version
go version go1.14.9 windows/amd64

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>go run .
Starting test program, initializing decoder
Decoder created, exiting program

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>echo %errorlevel%
0

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>go install .

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>test.exe
Starting test program, initializing decoder
Decoder created, exiting program

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>echo %errorlevel%
0

### What did you see instead?
C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>go version
go version go1.15.3 windows/amd64

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>go install .  ***note silent failure with no error or messages***

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>test.exe      ***silent failure to do anything, never gets to any init functions much less main()***

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>echo %errorlevel%
-1073741819

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>go run .
exit status 3221225477         ***3221225477== 0xC0000005 indicates windows access violation***

C:\GoPath\src\github.com\axionat\eagle\piglet\libde265\test>echo %errorlevel%
1

[libde.zip](https://github.com/golang/go/files/5446160/libde.zip)