Skip to content

Commit 70f911b

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]> (cherry picked from commit 779c039) Signed-off-by: David Malcolm <[email protected]>
1 parent 771873f commit 70f911b

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

gcc/toplev.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,6 +2374,7 @@ toplev::finalize (void)
23742374
ira_costs_cc_finalize ();
23752375
tree_cc_finalize ();
23762376
reginfo_cc_finalize ();
2377+
varasm_cc_finalize ();
23772378

23782379
/* save_decoded_options uses opts_obstack, so these must
23792380
be cleaned up together. */

gcc/varasm.cc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8709,4 +8709,57 @@ handle_vtv_comdat_section (section *sect, const_tree decl ATTRIBUTE_UNUSED)
87098709
switch_to_comdat_section(sect, DECL_NAME (decl));
87108710
}
87118711

8712+
void
8713+
varasm_cc_finalize ()
8714+
{
8715+
first_global_object_name = nullptr;
8716+
weak_global_object_name = nullptr;
8717+
8718+
const_labelno = 0;
8719+
size_directive_output = 0;
8720+
8721+
last_assemble_variable_decl = NULL_TREE;
8722+
first_function_block_is_cold = false;
8723+
saw_no_split_stack = false;
8724+
text_section = nullptr;
8725+
data_section = nullptr;
8726+
readonly_data_section = nullptr;
8727+
sdata_section = nullptr;
8728+
ctors_section = nullptr;
8729+
dtors_section = nullptr;
8730+
bss_section = nullptr;
8731+
sbss_section = nullptr;
8732+
tls_comm_section = nullptr;
8733+
comm_section = nullptr;
8734+
lcomm_section = nullptr;
8735+
bss_noswitch_section = nullptr;
8736+
exception_section = nullptr;
8737+
eh_frame_section = nullptr;
8738+
in_section = nullptr;
8739+
in_cold_section_p = false;
8740+
cold_function_name = NULL_TREE;
8741+
unnamed_sections = nullptr;
8742+
section_htab = nullptr;
8743+
object_block_htab = nullptr;
8744+
anchor_labelno = 0;
8745+
shared_constant_pool = nullptr;
8746+
pending_assemble_externals = NULL_TREE;
8747+
pending_libcall_symbols = nullptr;
8748+
8749+
#ifdef ASM_OUTPUT_EXTERNAL
8750+
pending_assemble_externals_processed = false;
8751+
pending_assemble_externals_set = nullptr;
8752+
#endif
8753+
8754+
weak_decls = NULL_TREE;
8755+
initial_trampoline = nullptr;
8756+
const_desc_htab = nullptr;
8757+
weakref_targets = NULL_TREE;
8758+
alias_pairs = nullptr;
8759+
tm_clone_hash = nullptr;
8760+
trampolines_created = 0;
8761+
elf_init_array_section = nullptr;
8762+
elf_fini_array_section = nullptr;
8763+
}
8764+
87128765
#include "gt-varasm.h"

gcc/varasm.h

Lines changed: 2 additions & 0 deletions
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)