diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20e4249986d..f71af429e9a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-01-21 Jakub Jelinek + + * config/rs6000/linux64.h (MD_FALLBACK_FRAME_STATE_FOR) + [!__powerpc64__]: Corrected to handle kernels with changed ucontext. + 2004-01-23 Eric Botcazou Olivier Hainque diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index d36aef4485e..560795e1d75 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -550,13 +550,27 @@ while (0) #ifdef IN_LIBGCC2 #include +#ifdef __powerpc64__ #include -#ifdef __powerpc64__ enum { SIGNAL_FRAMESIZE = 128 }; + #else + +/* During the 2.5 kernel series the kernel ucontext was changed, but + the new layout is compatible with the old one, so we just define + and use the old one here for simplicity and compatibility. */ + +struct kernel_old_ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext_struct uc_mcontext; + sigset_t uc_sigmask; +}; enum { SIGNAL_FRAMESIZE = 64 }; #endif + #endif #ifdef __powerpc64__ @@ -674,7 +688,7 @@ enum { SIGNAL_FRAMESIZE = 64 }; struct siginfo *pinfo; \ void *puc; \ struct siginfo info; \ - struct ucontext uc; \ + struct kernel_old_ucontext uc; \ } *rt_ = (CONTEXT)->cfa; \ sc_ = &rt_->uc.uc_mcontext; \ } \ @@ -698,15 +712,9 @@ enum { SIGNAL_FRAMESIZE = 64 }; (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \ = (long)&(sc_->regs->link) - new_cfa_; \ \ - /* The unwinder expects the IP to point to the following insn, \ - whereas the kernel returns the address of the actual \ - faulting insn. We store NIP+4 in an unused register slot to \ - get the same result for multiple evaluation of the same signal \ - frame. */ \ - sc_->regs->gpr[47] = sc_->regs->nip + 4; \ (FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET; \ (FS)->regs.reg[CR0_REGNO].loc.offset \ - = (long)&(sc_->regs->gpr[47]) - new_cfa_; \ + = (long)&(sc_->regs->nip) - new_cfa_; \ (FS)->retaddr_column = CR0_REGNO; \ goto SUCCESS; \ } while (0) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index d9b9a352526..7386f1da052 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,18 @@ +2004-01-21 Jakub Jelinek + + * include/powerpc-signal.h: Add #ifndef __powerpc64__ around the + header. For __powerpc64__ provide the default-signal.h definitions + for now. + * include/x86_64-signal.h [!__x86_64__]: Include java-signal-aux.h + instead of the dummy definitions. + * configure.host (x86_64-*): Remove CHECKREFSPEC, add DIVIDESPEC. + (powerpc64*-*): Remove with_libffi_default. + Only add -mminimal-toc for 64-bit compilations. + * configure.in: Use powerpc-signal.h on powerpc64 as well. + (x86_64-*-linux*): Set SIGNAL_HANDLER_AUX. + Link SIGNAL_HANDLER_AUX to include/java-signal-aux.h. + * configure: Rebuilt. + 2004-01-23 Michael Koch * gnu/java/nio/FileLockImpl.java: Compile fixes. diff --git a/libjava/configure b/libjava/configure index 399aa6078fd..6e837132128 100755 --- a/libjava/configure +++ b/libjava/configure @@ -9015,6 +9015,7 @@ test -n "$PERL" || PERL="false" SYSDEP_SOURCES= +SIGNAL_HANDLER_AUX= case "${host}" in i?86-*-linux*) @@ -9030,7 +9031,7 @@ case "${host}" in ia64-*-linux*) SIGNAL_HANDLER=include/dwarf2-signal.h ;; - powerpc-*-linux*) + powerpc*-*-linux*) SIGNAL_HANDLER=include/powerpc-signal.h ;; alpha*-*-linux*) @@ -9041,6 +9042,7 @@ case "${host}" in ;; x86_64*-*-linux*) SIGNAL_HANDLER=include/x86_64-signal.h + SIGNAL_HANDLER_AUX=include/i386-signal.h ;; sparc*-*-linux*) SIGNAL_HANDLER=include/dwarf2-signal.h @@ -9062,6 +9064,7 @@ esac # If we're using sjlj exceptions, forget what we just learned. if test "$enable_sjlj_exceptions" = yes; then SIGNAL_HANDLER=include/default-signal.h + SIGNAL_HANDLER_AUX= fi # Define here any compiler flags that you need in order to make backtrace() work. @@ -9075,6 +9078,10 @@ esac +if test -z "$SIGNAL_HANDLER_AUX"; then + SIGNAL_HANDLER_AUX=$SIGNAL_HANDLER +fi + if test "${multilib}" = "yes"; then @@ -9573,8 +9580,8 @@ fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF diff --git a/libjava/configure.host b/libjava/configure.host index 2d04bbca934..6e19f0cbd17 100644 --- a/libjava/configure.host +++ b/libjava/configure.host @@ -99,11 +99,11 @@ case "${host}" in slow_pthread_self=yes ;; x86_64-*) - CHECKREFSPEC="%{m32:-fcheck-references}" sysdeps_dir=x86-64 libgcj_flags="${libgcj_flags} -ffloat-store -fno-omit-frame-pointer" libgcj_cxxflags= libgcj_cflags= + DIVIDESPEC=-f%{m32:no-}use-divide-subroutine enable_hash_synchronization_default=yes slow_pthread_self=yes libgcj_interpreter=yes @@ -116,11 +116,11 @@ case "${host}" in IEEESPEC=-mieee ;; powerpc64*-*) - with_libffi_default=yes - libgcj_interpreter=yes - libgcj_flags="${libgcj_flags} -mminimal-toc" - # this may not be correct sysdeps_dir=powerpc + libgcj_interpreter=yes + if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then + libgcj_flags="${libgcj_flags} -mminimal-toc" + fi enable_hash_synchronization_default=yes slow_pthread_self=yes ;; diff --git a/libjava/configure.in b/libjava/configure.in index 015831c95b2..26f39cc3359 100644 --- a/libjava/configure.in +++ b/libjava/configure.in @@ -1128,6 +1128,7 @@ AC_FUNC_MMAP AC_CHECK_PROGS(PERL, perl, false) SYSDEP_SOURCES= +SIGNAL_HANDLER_AUX= case "${host}" in i?86-*-linux*) @@ -1143,7 +1144,7 @@ case "${host}" in ia64-*-linux*) SIGNAL_HANDLER=include/dwarf2-signal.h ;; - powerpc-*-linux*) + powerpc*-*-linux*) SIGNAL_HANDLER=include/powerpc-signal.h ;; alpha*-*-linux*) @@ -1154,6 +1155,7 @@ case "${host}" in ;; x86_64*-*-linux*) SIGNAL_HANDLER=include/x86_64-signal.h + SIGNAL_HANDLER_AUX=include/i386-signal.h ;; sparc*-*-linux*) SIGNAL_HANDLER=include/dwarf2-signal.h @@ -1175,6 +1177,7 @@ esac # If we're using sjlj exceptions, forget what we just learned. if test "$enable_sjlj_exceptions" = yes; then SIGNAL_HANDLER=include/default-signal.h + SIGNAL_HANDLER_AUX= fi # Define here any compiler flags that you need in order to make backtrace() work. @@ -1188,7 +1191,12 @@ AC_SUBST(BACKTRACESPEC) AC_SUBST(SYSDEP_SOURCES) -AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h) +if test -z "$SIGNAL_HANDLER_AUX"; then + SIGNAL_HANDLER_AUX=$SIGNAL_HANDLER +fi + +AC_LINK_FILES($SIGNAL_HANDLER $SIGNAL_HANDLER_AUX, + include/java-signal.h include/java-signal-aux.h) if test "${multilib}" = "yes"; then multilib_arg="--enable-multilib" diff --git a/libjava/include/powerpc-signal.h b/libjava/include/powerpc-signal.h index 39cdf893710..386fb18291a 100644 --- a/libjava/include/powerpc-signal.h +++ b/libjava/include/powerpc-signal.h @@ -13,13 +13,15 @@ details. */ #ifndef JAVA_SIGNAL_H # define JAVA_SIGNAL_H 1 -# include -# include +# ifndef __powerpc64__ -# define HANDLE_SEGV 1 -# undef HANDLE_FPE +# include +# include -# define SIGNAL_HANDLER(_name) \ +# define HANDLE_SEGV 1 +# undef HANDLE_FPE + +# define SIGNAL_HANDLER(_name) \ static void _name (int /* _signal */, struct sigcontext *_sc) /* PPC either leaves PC pointing at a faulting instruction or the @@ -27,7 +29,7 @@ details. */ the former, so we adjust the saved PC to point to the following instruction. This is what the handler in libgcc expects. */ -# define MAKE_THROW_FRAME(_exception) \ +# define MAKE_THROW_FRAME(_exception) \ do \ { \ _sc->regs->nip += 4; \ @@ -58,7 +60,7 @@ struct kernel_old_sigaction { void (*k_sa_restorer) (void); }; -# define INIT_SEGV \ +# define INIT_SEGV \ do \ { \ struct kernel_old_sigaction kact; \ @@ -69,7 +71,7 @@ do \ } \ while (0) -# define INIT_FPE \ +# define INIT_FPE \ do \ { \ struct kernel_old_sigaction kact; \ @@ -78,7 +80,15 @@ do \ kact.k_sa_flags = 0; \ syscall (SYS_sigaction, SIGFPE, &kact, NULL); \ } \ -while (0) +while (0) + +# else + +# undef HANDLE_SEGV +# undef HANDLE_FPE + +# define INIT_SEGV do {} while (0) +# define INIT_FPE do {} while (0) +# endif #endif /* JAVA_SIGNAL_H */ - diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h index eb034473f9e..ab59e5e69bc 100644 --- a/libjava/include/x86_64-signal.h +++ b/libjava/include/x86_64-signal.h @@ -10,14 +10,14 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ +#ifdef __x86_64__ + #ifndef JAVA_SIGNAL_H #define JAVA_SIGNAL_H 1 #include #include -#ifdef __x86_64__ - #define HANDLE_SEGV 1 #define SIGNAL_HANDLER(_name) \ @@ -80,16 +80,13 @@ while (0) * go away if all systems ever have pthreads libraries that are * compiled with unwind info. */ +#endif /* JAVA_SIGNAL_H */ + #else /* __x86_64__ */ -/* This is for the 32-bit subsystem on on x86-64. Catching signals - doesn't yet work on that target. */ +/* This is for the 32-bit subsystem on on x86-64. */ -#undef HANDLE_SEGV -#undef HANDLE_FPE - -#define INIT_SEGV do {} while (0) -#define INIT_FPE do {} while (0) +#define sigcontext_struct sigcontext +#include #endif /* __x86_64__ */ -#endif /* JAVA_SIGNAL_H */