Alex Brainman has posted comments on this change.
runtime: Use RtlGenRandom instead of CryptGenRandom
Patch Set 1:
Life is never simple. Is it?
Looking at the error message:
```
--- FAIL: TestCgoCrashHandler (5.40s)
crash_test.go:66: building testprogcgo: exit status 2
# _/C_/workdir/go/src/runtime/testdata/testprogcgo
.\threadpanic_windows.c: In function 'start':
.\threadpanic_windows.c:21:26: warning: passing argument 3
of '_beginthreadex' from incompatible pointer type
if(_beginthreadex(0, 0, die, 0, 0, 0) != 0)
^
In file included from .\threadpanic_windows.c:5:0:
C:/TDM-GCC-32/include/process.h:100:2: note: expected 'unsigned int
(__attribute__((__stdcall__)) *)(void *)' but argument is of type 'unsigned
int (*)(void *)'
_beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *),
^
```
this is just a warning that we normally don't get to see. Filed #15623 for
that.
But
```
# _/C_/workdir/go/src/runtime/testdata/testprogcgo
C:\workdir\go\pkg\tool\windows_386\link.exe: running gcc failed: exit
status 1
C:\Users\WINGOP~1\AppData\Local\Temp\go-link-196108955\go.o:(.data+0xb7b4):
undefined reference to `SystemFunction036@8'
collect2.exe: error: ld returned 1 exit status
```
is real. When we do CGO, we use gcc to link final executable. It appears
the gcc cannot find SystemFunction036 in advapi32.dll. I think it is
because SystemFunction036 is not listed in libadvapi32.a
```
C:\dev\tdm_gcc_32_5.1.0\lib>objdump -t libadvapi32.a | grep SystemFunction03
File STDIN:
[ 7](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
_SystemFunction034@12
[ 8](sec 5)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
__imp__SystemFunction034@12
[ 7](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
_SystemFunction033@8
[ 8](sec 5)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
__imp__SystemFunction033@8
[ 7](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
_SystemFunction032@8
[ 8](sec 5)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
__imp__SystemFunction032@8
[ 7](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
_SystemFunction031@8
[ 8](sec 5)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
__imp__SystemFunction031@8
[ 7](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
_SystemFunction030@8
[ 8](sec 5)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000
__imp__SystemFunction030@8
C:\dev\tdm_gcc_32_5.1.0\lib>
```
For whatever reason. And I use fairly recent version of mingw.
I don't see how we can make SystemFunction036 work with CGO. Perhaps we
should keep our current code for CGO, and use SystemFunction036 for pure Go
programs.
Maybe something else.
What do you all think?
Alex
--
https://go-review.googlesource.com/22933
Gerrit-Reviewer: Alex Brainman <
alex.b...@gmail.com>