libgccjit can make repeated in-process calls to the compiler code. On arm I see failures where e.g. the top of the generated .s file has: on the 1st iteration: .arch armv7-a on the 2nd iteration: .cpu armv7-a without changing any options.
What's happening is the 1st time through arm_option_override, arm_selected_cpu is NULL, but is set to non-NULL at: arm_selected_cpu = arm_selected_arch; The 2nd time through, arm_selected_cpu hasn't been reset, and so the condition: if (arm_selected_arch) { if (arm_selected_cpu) { /* Check for conflict between mcpu and march. */ fires, and this clause fires: /* -mcpu wins. */ arm_selected_arch = NULL; so we have a NULL arm_selected_arch and a non-NULL arm_selected_cpu. The fix is to reset arm-specific state, setting arm_selected_{arch|cpu|tune} to NULL at the top of arm_option_override, to prevent state from previous in-process runs from affecting things. With this, and the previous patches, most of the jit testsuite passes on arm, with the only remaining failures being of the form: WARNING: Timed out executing test case on the very large test cases (test-combination.c and test-threads.c). OK for stage 4? gcc/ChangeLog: PR jit/64810 * config/arm/arm.c (arm_option_override): Set arm_selected_arch/cpu/tune to NULL on entry. --- gcc/config/arm/arm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 246298a..c7c0ecf 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -2627,6 +2627,10 @@ arm_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, static void arm_option_override (void) { + arm_selected_arch = NULL; + arm_selected_cpu = NULL; + arm_selected_tune = NULL; + if (global_options_set.x_arm_arch_option) arm_selected_arch = &all_architectures[arm_arch_option]; -- 1.8.5.3