+2015-07-23 David Malcolm <dmalcolm@redhat.com>
+
+ * jit-playback.c (invoke_driver): Convert local "argvec"
+ to an auto_argvec, so that it owns copies of the strings,
+ rather than borrows them, updating ADD_ARG to use xstrdup
+ and special-casing the NULL terminator to avoid
+ xstrdup (NULL). Call add_multilib_driver_arguments at the front
+ of the arguments.
+ (MULTILIB_DEFAULTS): Provide a default definition.
+ (multilib_defaults_raw): New constant array.
+ (gcc::jit::playback::context::add_multilib_driver_arguments): New
+ method.
+ * jit-playback.h
+ (gcc::jit::playback::context::add_multilib_driver_arguments): New
+ method.
+ * docs/internals/test-hello-world.exe.log.txt: Update.
+ * docs/_build/texinfo/libgccjit.texi: Regenerate.
+
2015-07-16 David Malcolm <dmalcolm@redhat.com>
* docs/internals/index.rst (Overview of code structure): Add note
@copying
@quotation
-libgccjit 6.0.0 (experimental 20150716), July 16, 2015
+libgccjit 6.0.0 (experimental 20150723), July 23, 2015
David Malcolm
generated via this call:
@example
-JIT: libgccjit (GCC) version 5.0.0 20150123 (experimental) (x86_64-unknown-linux-gnu)
+JIT: libgccjit (GCC) version 6.0.0 20150723 (experimental) (x86_64-unknown-linux-gnu)
JIT: compiled by GNU C version 4.8.3 20140911 (Red Hat 4.8.3-7), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
JIT: entering: gcc_jit_context_set_str_option
JIT: GCC_JIT_STR_OPTION_PROGNAME: "./test-hello-world.c.exe"
JIT: GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING: false
JIT: GCC_JIT_BOOL_OPTION_SELFCHECK_GC: true
JIT: GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES: false
+JIT: gcc_jit_context_set_bool_allow_unreachable_blocks: false
JIT: entering: void gcc::jit::recording::context::validate()
JIT: exiting: void gcc::jit::recording::context::validate()
JIT: entering: gcc::jit::playback::context::context(gcc::jit::recording::context*)
JIT: entering: void gcc::jit::playback::function::postprocess()
JIT: exiting: void gcc::jit::playback::function::postprocess()
JIT: exiting: void gcc::jit::playback::context::replay()
-JIT: entering: void jit_langhook_write_globals()
-JIT: entering: void gcc::jit::playback::context::write_global_decls_1()
-JIT: exiting: void gcc::jit::playback::context::write_global_decls_1()
-JIT: entering: void gcc::jit::playback::context::write_global_decls_2()
-JIT: exiting: void gcc::jit::playback::context::write_global_decls_2()
-JIT: exiting: void jit_langhook_write_globals()
JIT: exiting: toplev::main
JIT: entering: void gcc::jit::playback::context::extract_any_requested_dumps(vec<gcc::jit::recording::requested_dump>*)
JIT: exiting: void gcc::jit::playback::context::extract_any_requested_dumps(vec<gcc::jit::recording::requested_dump>*)
JIT: entering: virtual void gcc::jit::playback::compile_to_memory::postprocess(const char*)
JIT: entering: void gcc::jit::playback::context::convert_to_dso(const char*)
JIT: entering: void gcc::jit::playback::context::invoke_driver(const char*, const char*, const char*, timevar_id_t, bool, bool)
-JIT: argv[0]: x86_64-unknown-linux-gnu-gcc-5.0.0
-JIT: argv[1]: -shared
-JIT: argv[2]: /tmp/libgccjit-CKq1M9/fake.s
-JIT: argv[3]: -o
-JIT: argv[4]: /tmp/libgccjit-CKq1M9/fake.so
-JIT: argv[5]: -fno-use-linker-plugin
-JIT: argv[6]: (null)
+JIT: entering: void gcc::jit::playback::context::add_multilib_driver_arguments(vec<char*>*)
+JIT: exiting: void gcc::jit::playback::context::add_multilib_driver_arguments(vec<char*>*)
+JIT: argv[0]: x86_64-unknown-linux-gnu-gcc-6.0.0
+JIT: argv[1]: -m64
+JIT: argv[2]: -shared
+JIT: argv[3]: /tmp/libgccjit-CKq1M9/fake.s
+JIT: argv[4]: -o
+JIT: argv[5]: /tmp/libgccjit-CKq1M9/fake.so
+JIT: argv[6]: -fno-use-linker-plugin
+JIT: argv[7]: (null)
JIT: exiting: void gcc::jit::playback::context::invoke_driver(const char*, const char*, const char*, timevar_id_t, bool, bool)
JIT: exiting: void gcc::jit::playback::context::convert_to_dso(const char*)
JIT: entering: gcc::jit::result* gcc::jit::playback::context::dlopen_built_dso()
-JIT: libgccjit (GCC) version 5.0.0 20150123 (experimental) (x86_64-unknown-linux-gnu)
+JIT: libgccjit (GCC) version 6.0.0 20150723 (experimental) (x86_64-unknown-linux-gnu)
JIT: compiled by GNU C version 4.8.3 20140911 (Red Hat 4.8.3-7), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1
JIT: entering: gcc_jit_context_set_str_option
JIT: GCC_JIT_STR_OPTION_PROGNAME: "./test-hello-world.c.exe"
JIT: GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING: false
JIT: GCC_JIT_BOOL_OPTION_SELFCHECK_GC: true
JIT: GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES: false
+JIT: gcc_jit_context_set_bool_allow_unreachable_blocks: false
JIT: entering: void gcc::jit::recording::context::validate()
JIT: exiting: void gcc::jit::recording::context::validate()
JIT: entering: gcc::jit::playback::context::context(gcc::jit::recording::context*)
JIT: entering: void gcc::jit::playback::function::postprocess()
JIT: exiting: void gcc::jit::playback::function::postprocess()
JIT: exiting: void gcc::jit::playback::context::replay()
-JIT: entering: void jit_langhook_write_globals()
-JIT: entering: void gcc::jit::playback::context::write_global_decls_1()
-JIT: exiting: void gcc::jit::playback::context::write_global_decls_1()
-JIT: entering: void gcc::jit::playback::context::write_global_decls_2()
-JIT: exiting: void gcc::jit::playback::context::write_global_decls_2()
-JIT: exiting: void jit_langhook_write_globals()
JIT: exiting: toplev::main
JIT: entering: void gcc::jit::playback::context::extract_any_requested_dumps(vec<gcc::jit::recording::requested_dump>*)
JIT: exiting: void gcc::jit::playback::context::extract_any_requested_dumps(vec<gcc::jit::recording::requested_dump>*)
JIT: entering: virtual void gcc::jit::playback::compile_to_memory::postprocess(const char*)
JIT: entering: void gcc::jit::playback::context::convert_to_dso(const char*)
JIT: entering: void gcc::jit::playback::context::invoke_driver(const char*, const char*, const char*, timevar_id_t, bool, bool)
-JIT: argv[0]: x86_64-unknown-linux-gnu-gcc-5.0.0
-JIT: argv[1]: -shared
-JIT: argv[2]: /tmp/libgccjit-CKq1M9/fake.s
-JIT: argv[3]: -o
-JIT: argv[4]: /tmp/libgccjit-CKq1M9/fake.so
-JIT: argv[5]: -fno-use-linker-plugin
-JIT: argv[6]: (null)
+JIT: entering: void gcc::jit::playback::context::add_multilib_driver_arguments(vec<char*>*)
+JIT: exiting: void gcc::jit::playback::context::add_multilib_driver_arguments(vec<char*>*)
+JIT: argv[0]: x86_64-unknown-linux-gnu-gcc-6.0.0
+JIT: argv[1]: -m64
+JIT: argv[2]: -shared
+JIT: argv[3]: /tmp/libgccjit-CKq1M9/fake.s
+JIT: argv[4]: -o
+JIT: argv[5]: /tmp/libgccjit-CKq1M9/fake.so
+JIT: argv[6]: -fno-use-linker-plugin
+JIT: argv[7]: (null)
JIT: exiting: void gcc::jit::playback::context::invoke_driver(const char*, const char*, const char*, timevar_id_t, bool, bool)
JIT: exiting: void gcc::jit::playback::context::convert_to_dso(const char*)
JIT: entering: gcc::jit::result* gcc::jit::playback::context::dlopen_built_dso()
TV_ASSEMBLE. */
auto_timevar assemble_timevar (tv_id);
const char *errmsg;
- auto_vec <const char *> argvec;
-#define ADD_ARG(arg) argvec.safe_push (arg)
+ auto_argvec argvec;
+#define ADD_ARG(arg) argvec.safe_push (xstrdup (arg))
int exit_status = 0;
int err = 0;
const char *gcc_driver_name = GCC_DRIVER_NAME;
ADD_ARG (gcc_driver_name);
+ add_multilib_driver_arguments (&argvec);
+
if (shared)
ADD_ARG ("-shared");
ADD_ARG ("-fno-use-linker-plugin");
/* pex argv arrays are NULL-terminated. */
- ADD_ARG (NULL);
+ argvec.safe_push (NULL);
/* pex_one's error-handling requires pname to be non-NULL. */
gcc_assert (ctxt_progname);
#undef ADD_ARG
}
+/* Extract the target-specific MULTILIB_DEFAULTS to
+ multilib_defaults_raw for use by
+ playback::context::add_multilib_driver_arguments (). */
+
+#ifndef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { "" }
+#endif
+
+static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
+
+/* Helper function for playback::context::invoke_driver ().
+
+ 32-bit and 64-bit multilib peer builds of libgccjit.so may share
+ a driver binary. We need to pass in options to the shared driver
+ to get the appropriate assembler/linker options for this multilib
+ peer. */
+
+void
+playback::context::
+add_multilib_driver_arguments (vec <char *> *argvec)
+{
+ JIT_LOG_SCOPE (get_logger ());
+
+ /* Add copies of the arguments in multilib_defaults_raw to argvec,
+ prepending each with a "-". */
+ for (size_t i = 0; i < ARRAY_SIZE (multilib_defaults_raw); i++)
+ if (multilib_defaults_raw[i][0])
+ argvec->safe_push (concat ("-", multilib_defaults_raw[i], NULL));
+}
+
/* Dynamically-link the built DSO file into this process, using dlopen.
Wrap it up within a jit::result *, and return that.
Return NULL if any errors occur, reporting them on this context. */
bool shared,
bool run_linker);
+ void
+ add_multilib_driver_arguments (vec <char *> *argvec);
+
result *
dlopen_built_dso ();