Skip to content

Commit

Permalink
gcc/rtems_gcc_main.c: Add signal() workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhub committed Feb 24, 2014
1 parent af664fd commit fac5697
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions gcc/rtems_gcc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <bsp.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pthread.h>

/*
* Set up first argument
Expand All @@ -22,8 +23,23 @@ static char *argv[20] = { arg0 };

int main(int argc, char **argv, char **environp);

/*
* Tests like "gcc.c-torture/execute/20101011-1.c" use signal() and raise().
* RTEMS ignores signals installed via signal() by default. Enable SIGFPE for
* the initialization thread as a workaround.
*/
static void signal_workaround(void)
{
sigset_t set;

sigemptyset(&set);
sigaddset(&set, SIGFPE);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
}

rtems_task Init(rtems_task_argument ignored)
{
signal_workaround();
mkdir( "/tmp", 0777 );
main(argc, argv, NULL);
}
Expand Down

0 comments on commit fac5697

Please sign in to comment.