aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2015-01-27 20:19:36 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2015-01-27 20:19:36 +0000
commit53c04ec92a37b35a7f37e00bd5a4b611cf470e3c (patch)
treec8823405a2ab3de543e96e14ffc83037629e01f9 /gcc/toplev.c
parent710700abb804afc0846423ab246034dec745a599 (diff)
downloadgcc-53c04ec92a37b35a7f37e00bd5a4b611cf470e3c.zip
gcc-53c04ec92a37b35a7f37e00bd5a4b611cf470e3c.tar.gz
gcc-53c04ec92a37b35a7f37e00bd5a4b611cf470e3c.tar.bz2
toplev: gcc version information for jit
gcc/ChangeLog: * toplev.c (print_version): Add param "show_global_state", and only print GGC and plugin information if it is true. (init_asm_output): Pass in "true" for the new param when calling print_version. (process_options): Likewise. (toplev::main): Likewise. * toplev.h (print_version): Add new param to decl. gcc/jit/ChangeLog: * docs/internals/test-hello-world.exe.log.txt: Add example version lines. * jit-common.h (gcc::jit::dump::get_file): New accessor. * jit-logging.c: Include toplev.h. (gcc::jit::logger::logger): Log the GCC version. * jit-recording.c: Include toplev.h. (gcc:jit::recording::context::dump_reproducer_to_file): Log the GCC version. From-SVN: r220190
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 5084628..bc2ca3b 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -728,10 +728,19 @@ compile_file (void)
/* Print version information to FILE.
Each line begins with INDENT (for the case where FILE is the
- assembler output file). */
+ assembler output file).
+
+ If SHOW_GLOBAL_STATE is true (for cc1 etc), we are within the compiler
+ proper and can print pertinent state (e.g. params and plugins).
+
+ If SHOW_GLOBAL_STATE is false (for use by libgccjit), we are outside the
+ compiler, and we don't hold the mutex on the compiler's global state:
+ we can't print params and plugins, since they might not be initialized,
+ or might be being manipulated by a compile running in another
+ thread. */
void
-print_version (FILE *file, const char *indent)
+print_version (FILE *file, const char *indent, bool show_global_state)
{
static const char fmt1[] =
#ifdef __GNUC__
@@ -791,12 +800,16 @@ print_version (FILE *file, const char *indent)
file == stderr ? _(fmt3) : fmt3,
indent, *indent != 0 ? " " : "",
"MPC", MPC_VERSION_STRING, mpc_get_version ());
- fprintf (file,
- file == stderr ? _(fmt4) : fmt4,
- indent, *indent != 0 ? " " : "",
- PARAM_VALUE (GGC_MIN_EXPAND), PARAM_VALUE (GGC_MIN_HEAPSIZE));
- print_plugins_versions (file, indent);
+ if (show_global_state)
+ {
+ fprintf (file,
+ file == stderr ? _(fmt4) : fmt4,
+ indent, *indent != 0 ? " " : "",
+ PARAM_VALUE (GGC_MIN_EXPAND), PARAM_VALUE (GGC_MIN_HEAPSIZE));
+
+ print_plugins_versions (file, indent);
+ }
}
static int
@@ -1008,7 +1021,7 @@ init_asm_output (const char *name)
{
/* Print the list of switches in effect
into the assembler file as comments. */
- print_version (asm_out_file, ASM_COMMENT_START);
+ print_version (asm_out_file, ASM_COMMENT_START, true);
print_switch_values (print_to_asm_out_file);
putc ('\n', asm_out_file);
}
@@ -1426,7 +1439,7 @@ process_options (void)
option flags in use. */
if (version_flag)
{
- print_version (stderr, "");
+ print_version (stderr, "", true);
if (! quiet_flag)
print_switch_values (print_to_stderr);
}
@@ -2135,7 +2148,7 @@ toplev::main (int argc, char **argv)
initialize_plugins ();
if (version_flag)
- print_version (stderr, "");
+ print_version (stderr, "", true);
if (help_flag)
print_plugins_help (stderr, "");