Browse Source

[LibOS] Remove warning cast-function-type with GCC8

Compilation of bookkeep/shim_signal.c:__handle_one_signal() under GCC8
failed with cast-function-type error on k_sa_handler assignment to
handler. This commit fixes this error via cast to void*.
Isaku Yamahata 6 years ago
parent
commit
1a6f863695
1 changed files with 7 additions and 8 deletions
  1. 7 8
      LibOS/shim/src/bookkeep/shim_signal.c

+ 7 - 8
LibOS/shim/src/bookkeep/shim_signal.c

@@ -613,16 +613,15 @@ __handle_one_signal (shim_tcb_t * tcb, int sig, struct shim_signal * signal)
 
     if (sighdl->action) {
         struct __kernel_sigaction * act = sighdl->action;
-        /* This is a workaround. The truth is that many program will
-           use sa_handler as sa_sigaction, because sa_sigaction is
-           not supported in amd64 */
+        /*
+         * on amd64, sa_handler can be treated as sa_sigaction
+         * because 1-3 arguments are passed by register and
+         * sa_handler simply ignores 2nd and 3rd argument.
+         */
 #ifdef __i386__
-        handler = (void (*) (int, siginfo_t *, void *)) act->_u._sa_handler;
-        if (act->sa_flags & SA_SIGINFO)
-            sa_handler = act->_u._sa_sigaction;
-#else
-        handler = (void (*) (int, siginfo_t *, void *)) act->k_sa_handler;
+# error "x86-32 support is heavily broken."
 #endif
+        handler = (void *)act->k_sa_handler;
         if (act->sa_flags & SA_RESETHAND) {
             sighdl->action = NULL;
             free(act);