1
0
mirror of https://github.com/golang/go synced 2024-11-24 23:27:57 -07:00

runtime: arm: abort if hardware floating point missing

Fixes #3911.

Requires CL 6449127.

dfc@qnap:~$ ./runtime.test
runtime: this CPU has no floating point hardware, so it cannot run
this GOARM=7 binary. Recompile using GOARM=5.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6442109
This commit is contained in:
Dave Cheney 2012-09-07 14:26:42 +10:00
parent 4cfcb4a04b
commit 212ce41d00
2 changed files with 15 additions and 2 deletions

View File

@ -37,6 +37,7 @@ TEXT _rt0_arm(SB),7,$-4
MOVW.NE g, R0 // first argument of initcgo is g
BL.NE (R2) // will clobber R0-R3
BL runtime·checkgoarm(SB)
BL runtime·check(SB)
// saved argc, argv

View File

@ -147,9 +147,21 @@ runtime·setsig(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
#define AT_PLATFORM 15 // introduced in at least 2.6.11
#define AT_HWCAP 16 // introduced in at least 2.6.11
#define AT_RANDOM 25 // introduced in 2.6.29
#define HWCAP_VFP (1 << 6)
static uint32 runtime·randomNumber;
uint32 runtime·hwcap;
uint8 runtime·armArch = 6; // we default to ARMv6
uint32 runtime·hwcap; // set by setup_auxv
uint8 runtime·goarm; // set by 5l
void
runtime·checkgoarm(void)
{
if(runtime·goarm > 5 && !(runtime·hwcap & HWCAP_VFP)) {
runtime·printf("runtime: this CPU has no floating point hardware, so it cannot run\n");
runtime·printf("this GOARM=%d binary. Recompile using GOARM=5.\n", runtime·goarm);
runtime·exit(1);
}
}
#pragma textflag 7
void