Skip to content

Commit 779c039

Browse files
committed
jit: reset state in varasm.cc [PR117275]
PR jit/117275 reports various jit test failures seen on powerpc64le-unknown-linux-gnu due to hitting this assertion in varasm.cc on the 2nd compilation in a process: #2 0x00007ffff63e67d0 in assemble_external_libcall (fun=0x7ffff2a4b1d8) at ../../src/gcc/varasm.cc:2650 2650 gcc_assert (!pending_assemble_externals_processed); (gdb) p pending_assemble_externals_processed $1 = true We're not properly resetting state in varasm.cc after a compile for libgccjit. Fixed thusly. gcc/ChangeLog: PR jit/117275 * toplev.cc (toplev::finalize): Call varasm_cc_finalize. * varasm.cc (varasm_cc_finalize): New. * varasm.h (varasm_cc_finalize): New decl. Signed-off-by: David Malcolm <[email protected]>
1 parent 9ffcf1f commit 779c039

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

gcc/toplev.cc

+1
Original file line numberDiff line numberDiff line change
@@ -2433,6 +2433,7 @@ toplev::finalize (void)
24332433
ira_costs_cc_finalize ();
24342434
tree_cc_finalize ();
24352435
reginfo_cc_finalize ();
2436+
varasm_cc_finalize ();
24362437

24372438
/* save_decoded_options uses opts_obstack, so these must
24382439
be cleaned up together. */

gcc/varasm.cc

+53
Original file line numberDiff line numberDiff line change
@@ -8854,4 +8854,57 @@ handle_vtv_comdat_section (section *sect, const_tree decl ATTRIBUTE_UNUSED)
88548854
switch_to_comdat_section(sect, DECL_NAME (decl));
88558855
}
88568856

8857+
void
8858+
varasm_cc_finalize ()
8859+
{
8860+
first_global_object_name = nullptr;
8861+
weak_global_object_name = nullptr;
8862+
8863+
const_labelno = 0;
8864+
size_directive_output = 0;
8865+
8866+
last_assemble_variable_decl = NULL_TREE;
8867+
first_function_block_is_cold = false;
8868+
saw_no_split_stack = false;
8869+
text_section = nullptr;
8870+
data_section = nullptr;
8871+
readonly_data_section = nullptr;
8872+
sdata_section = nullptr;
8873+
ctors_section = nullptr;
8874+
dtors_section = nullptr;
8875+
bss_section = nullptr;
8876+
sbss_section = nullptr;
8877+
tls_comm_section = nullptr;
8878+
comm_section = nullptr;
8879+
lcomm_section = nullptr;
8880+
bss_noswitch_section = nullptr;
8881+
exception_section = nullptr;
8882+
eh_frame_section = nullptr;
8883+
in_section = nullptr;
8884+
in_cold_section_p = false;
8885+
cold_function_name = NULL_TREE;
8886+
unnamed_sections = nullptr;
8887+
section_htab = nullptr;
8888+
object_block_htab = nullptr;
8889+
anchor_labelno = 0;
8890+
shared_constant_pool = nullptr;
8891+
pending_assemble_externals = NULL_TREE;
8892+
pending_libcall_symbols = nullptr;
8893+
8894+
#ifdef ASM_OUTPUT_EXTERNAL
8895+
pending_assemble_externals_processed = false;
8896+
pending_assemble_externals_set = nullptr;
8897+
#endif
8898+
8899+
weak_decls = NULL_TREE;
8900+
initial_trampoline = nullptr;
8901+
const_desc_htab = nullptr;
8902+
weakref_targets = NULL_TREE;
8903+
alias_pairs = nullptr;
8904+
tm_clone_hash = nullptr;
8905+
trampolines_created = 0;
8906+
elf_init_array_section = nullptr;
8907+
elf_fini_array_section = nullptr;
8908+
}
8909+
88578910
#include "gt-varasm.h"

gcc/varasm.h

+2
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,6 @@ extern rtx assemble_trampoline_template (void);
8181

8282
extern void switch_to_comdat_section (section *, tree);
8383

84+
extern void varasm_cc_finalize ();
85+
8486
#endif // GCC_VARASM_H

0 commit comments

Comments
 (0)