mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/dist: support for NetBSD/ARM
1. when executing a unsupported VFP instruction, the NetBSD kernel somehow doesn't report SIGILL, and instead just spin and spin, we add a alarm(2) to detect this case (albeit this is a kernel bug). 2. NetBSD/ARM's VFP11 support is not complete, so temporarily disable it. 3. The default gcc shipped with NetBSD-current mis-optimizes our code at -O2, so lower the optimization level to -O1 on NetBSD/ARM. R=dave, rsc CC=golang-dev https://golang.org/cl/7286044
This commit is contained in:
parent
a17b7b9491
commit
3d50aaf483
3 changed files with 25 additions and 0 deletions
7
src/cmd/dist/unix.c
vendored
7
src/cmd/dist/unix.c
vendored
|
|
@ -745,17 +745,24 @@ static void sigillhand(int);
|
|||
// xtryexecfunc tries to execute function f, if any illegal instruction
|
||||
// signal received in the course of executing that function, it will
|
||||
// return 0, otherwise it will return 1.
|
||||
// Some systems (notably NetBSD) will spin and spin when executing VFPv3
|
||||
// instructions on VFPv2 system (e.g. Raspberry Pi) without ever triggering
|
||||
// SIGILL, so we set a 1-second alarm to catch that case.
|
||||
int
|
||||
xtryexecfunc(void (*f)(void))
|
||||
{
|
||||
int r;
|
||||
r = 0;
|
||||
signal(SIGILL, sigillhand);
|
||||
signal(SIGALRM, sigillhand);
|
||||
alarm(1);
|
||||
if(sigsetjmp(sigill_jmpbuf, 1) == 0) {
|
||||
f();
|
||||
r = 1;
|
||||
}
|
||||
signal(SIGILL, SIG_DFL);
|
||||
alarm(0);
|
||||
signal(SIGALRM, SIG_DFL);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue