]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: arm: abort if hardware floating point missing
authorDave Cheney <dave@cheney.net>
Fri, 7 Sep 2012 04:26:42 +0000 (14:26 +1000)
committerDave Cheney <dave@cheney.net>
Fri, 7 Sep 2012 04:26:42 +0000 (14:26 +1000)
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

src/pkg/runtime/asm_arm.s
src/pkg/runtime/signal_linux_arm.c

index 2c89139805f38b7d01e31603ebd54d92694fc9a5..57df8c9c634b893a8433e0c9587dd38d84e0d2f0 100644 (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
index c35d139b27f875bb8e07120425aa7e8b5a557c55..7f93db5fb0408ceafce3bebf6437ab5262375d5a 100644 (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
+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