Commit 6fc2d0f3 by David Malcolm Committed by David Malcolm

PR jit/64721: toplev: don't install signal-handlers when running within libgccjit

gcc/ChangeLog:
	PR jit/64721
	* main.c (main): Construct toplev instances with init_signals=true.
	* toplev.c (general_init): Add param "init_signals", and use it to
	conditionalize the calls to signal and host_hooks.extra_signals.
	(toplev::toplev): Add param "init_signals".
	(toplev::main): When invoking general_init, pass m_init_signals
	to control whether signal-handlers are installed.
	* toplev.h (toplev::toplev): Add param "init_signals".
	(toplev::m_init_signals): New field.

gcc/jit/ChangeLog:
	PR jit/64721
	* jit-playback.c (gcc::jit::playback::context::compile): Construct
	toplev instances with init_signals=false.

From-SVN: r220045
parent ca72dad5
2015-01-23 David Malcolm <dmalcolm@redhat.com> 2015-01-23 David Malcolm <dmalcolm@redhat.com>
PR jit/64721
* main.c (main): Construct toplev instances with init_signals=true.
* toplev.c (general_init): Add param "init_signals", and use it to
conditionalize the calls to signal and host_hooks.extra_signals.
(toplev::toplev): Add param "init_signals".
(toplev::main): When invoking general_init, pass m_init_signals
to control whether signal-handlers are installed.
* toplev.h (toplev::toplev): Add param "init_signals".
(toplev::m_init_signals): New field.
2015-01-23 David Malcolm <dmalcolm@redhat.com>
PR jit/64722 PR jit/64722
* emit-rtl.c (init_emit_regs): Set pic_offset_table_rtx to * emit-rtl.c (init_emit_regs): Set pic_offset_table_rtx to
NULL_RTX before testing PIC_OFFSET_TABLE_REGNUM, since the NULL_RTX before testing PIC_OFFSET_TABLE_REGNUM, since the
......
2015-01-23 David Malcolm <dmalcolm@redhat.com>
PR jit/64721
* jit-playback.c (gcc::jit::playback::context::compile): Construct
toplev instances with init_signals=false.
2015-01-19 David Malcolm <dmalcolm@redhat.com> 2015-01-19 David Malcolm <dmalcolm@redhat.com>
* docs/cp/topics/results.rst: Rename to... * docs/cp/topics/results.rst: Rename to...
......
...@@ -1723,7 +1723,8 @@ compile () ...@@ -1723,7 +1723,8 @@ compile ()
acquire_mutex (); acquire_mutex ();
/* This runs the compiler. */ /* This runs the compiler. */
toplev toplev (false); toplev toplev (false, /* use_TV_TOTAL */
false); /* init_signals */
enter_scope ("toplev::main"); enter_scope ("toplev::main");
if (get_logger ()) if (get_logger ())
for (unsigned i = 0; i < fake_args.length (); i++) for (unsigned i = 0; i < fake_args.length (); i++)
......
...@@ -33,7 +33,8 @@ int main (int argc, char **argv); ...@@ -33,7 +33,8 @@ int main (int argc, char **argv);
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
toplev toplev (true); toplev toplev (true, /* use_TV_TOTAL */
true /* init_signals */);
return toplev.main (argc, argv); return toplev.main (argc, argv);
} }
...@@ -137,7 +137,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -137,7 +137,7 @@ along with GCC; see the file COPYING3. If not see
#include <new> #include <new>
static void general_init (const char *); static void general_init (const char *, bool);
static void do_compile (); static void do_compile ();
static void process_options (void); static void process_options (void);
static void backend_init (void); static void backend_init (void);
...@@ -1151,7 +1151,7 @@ open_auxiliary_file (const char *ext) ...@@ -1151,7 +1151,7 @@ open_auxiliary_file (const char *ext)
options are parsed. Signal handlers, internationalization etc. options are parsed. Signal handlers, internationalization etc.
ARGV0 is main's argv[0]. */ ARGV0 is main's argv[0]. */
static void static void
general_init (const char *argv0) general_init (const char *argv0, bool init_signals)
{ {
const char *p; const char *p;
...@@ -1190,28 +1190,31 @@ general_init (const char *argv0) ...@@ -1190,28 +1190,31 @@ general_init (const char *argv0)
global_dc->option_state = &global_options; global_dc->option_state = &global_options;
global_dc->option_name = option_name; global_dc->option_name = option_name;
/* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */ if (init_signals)
{
/* Trap fatal signals, e.g. SIGSEGV, and convert them to ICE messages. */
#ifdef SIGSEGV #ifdef SIGSEGV
signal (SIGSEGV, crash_signal); signal (SIGSEGV, crash_signal);
#endif #endif
#ifdef SIGILL #ifdef SIGILL
signal (SIGILL, crash_signal); signal (SIGILL, crash_signal);
#endif #endif
#ifdef SIGBUS #ifdef SIGBUS
signal (SIGBUS, crash_signal); signal (SIGBUS, crash_signal);
#endif #endif
#ifdef SIGABRT #ifdef SIGABRT
signal (SIGABRT, crash_signal); signal (SIGABRT, crash_signal);
#endif #endif
#if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT) #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
signal (SIGIOT, crash_signal); signal (SIGIOT, crash_signal);
#endif #endif
#ifdef SIGFPE #ifdef SIGFPE
signal (SIGFPE, crash_signal); signal (SIGFPE, crash_signal);
#endif #endif
/* Other host-specific signal setup. */ /* Other host-specific signal setup. */
(*host_hooks.extra_signals)(); (*host_hooks.extra_signals)();
}
/* Initialize the garbage-collector, string pools and tree type hash /* Initialize the garbage-collector, string pools and tree type hash
table. */ table. */
...@@ -2059,8 +2062,9 @@ do_compile () ...@@ -2059,8 +2062,9 @@ do_compile ()
} }
} }
toplev::toplev (bool use_TV_TOTAL) toplev::toplev (bool use_TV_TOTAL, bool init_signals)
: m_use_TV_TOTAL (use_TV_TOTAL) : m_use_TV_TOTAL (use_TV_TOTAL),
m_init_signals (init_signals)
{ {
if (!m_use_TV_TOTAL) if (!m_use_TV_TOTAL)
start_timevars (); start_timevars ();
...@@ -2097,7 +2101,7 @@ toplev::main (int argc, char **argv) ...@@ -2097,7 +2101,7 @@ toplev::main (int argc, char **argv)
expandargv (&argc, &argv); expandargv (&argc, &argv);
/* Initialization of GCC's environment, and diagnostics. */ /* Initialization of GCC's environment, and diagnostics. */
general_init (argv[0]); general_init (argv[0], m_init_signals);
/* One-off initialization of options that does not need to be /* One-off initialization of options that does not need to be
repeated when options are added for particular functions. */ repeated when options are added for particular functions. */
......
...@@ -28,7 +28,8 @@ extern unsigned int save_decoded_options_count; ...@@ -28,7 +28,8 @@ extern unsigned int save_decoded_options_count;
class toplev class toplev
{ {
public: public:
toplev (bool use_TV_TOTAL); toplev (bool use_TV_TOTAL,
bool init_signals);
~toplev (); ~toplev ();
int main (int argc, char **argv); int main (int argc, char **argv);
...@@ -40,6 +41,7 @@ private: ...@@ -40,6 +41,7 @@ private:
void start_timevars (); void start_timevars ();
bool m_use_TV_TOTAL; bool m_use_TV_TOTAL;
bool m_init_signals;
}; };
extern void rest_of_decl_compilation (tree, int, int); extern void rest_of_decl_compilation (tree, int, int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment