diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-09-24 21:46:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-09-24 21:46:21 +0000 |
commit | dd931d9b48647e898dc80927c532ae93cc09e192 (patch) | |
tree | 71be2295cd79b8a182f6130611658db8628772d5 /libgo/runtime/runtime_c.c | |
parent | 779d8a5ad09b01428726ea5a0e6c87bd9ac3c0e4 (diff) | |
download | gcc-dd931d9b48647e898dc80927c532ae93cc09e192.zip gcc-dd931d9b48647e898dc80927c532ae93cc09e192.tar.gz gcc-dd931d9b48647e898dc80927c532ae93cc09e192.tar.bz2 |
libgo: update to Go 1.11
Reviewed-on: https://go-review.googlesource.com/136435
gotools/:
* Makefile.am (mostlyclean-local): Run chmod on check-go-dir to
make sure it is writable.
(check-go-tools): Likewise.
(check-vet): Copy internal/objabi to check-vet-dir.
* Makefile.in: Rebuild.
From-SVN: r264546
Diffstat (limited to 'libgo/runtime/runtime_c.c')
-rw-r--r-- | libgo/runtime/runtime_c.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libgo/runtime/runtime_c.c b/libgo/runtime/runtime_c.c index c65a7e0..6d77af4 100644 --- a/libgo/runtime/runtime_c.c +++ b/libgo/runtime/runtime_c.c @@ -33,6 +33,17 @@ runtime_atoi(const byte *p, intgo len) return n; } +// A random number from the GNU/Linux auxv array. +static uint32 randomNumber; + +// Set the random number from Go code. + +void +setRandomNumber(uint32 r) +{ + randomNumber = r; +} + #if defined(__i386__) || defined(__x86_64__) || defined (__s390__) || defined (__s390x__) // When cputicks is just asm instructions, skip the split stack @@ -85,8 +96,8 @@ runtime_cputicks(void) #else // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand(). // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler. - // TODO: need more entropy to better seed fastrand. - return runtime_nanotime(); + // randomNumber provides better seeding of fastrand. + return runtime_nanotime() + randomNumber; #endif } @@ -193,7 +204,6 @@ runtime_cpuinit() } } if (__get_cpuid(1, &eax, &ebx, &ecx, &edx)) { - setCpuidECX(ecx); #if defined(__i386__) if ((edx & bit_SSE2) != 0) { hasSSE2 = true; |