aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-10-23 14:26:38 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2024-10-23 14:26:38 -0400
commit779c0390e3b57d1eebd41bbfe43d1f329c91de6c (patch)
tree22cbc727abc54078e01845f07ce7a46aa46e74b8 /gcc
parent9ffcf1f193b477f417a4c1960cd32696a23b99b4 (diff)
downloadgcc-779c0390e3b57d1eebd41bbfe43d1f329c91de6c.zip
gcc-779c0390e3b57d1eebd41bbfe43d1f329c91de6c.tar.gz
gcc-779c0390e3b57d1eebd41bbfe43d1f329c91de6c.tar.bz2
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 <dmalcolm@redhat.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/toplev.cc1
-rw-r--r--gcc/varasm.cc53
-rw-r--r--gcc/varasm.h2
3 files changed, 56 insertions, 0 deletions
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 5df59b79..62034c3 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -2433,6 +2433,7 @@ toplev::finalize (void)
ira_costs_cc_finalize ();
tree_cc_finalize ();
reginfo_cc_finalize ();
+ varasm_cc_finalize ();
/* save_decoded_options uses opts_obstack, so these must
be cleaned up together. */
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 8e492e3..c254005 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -8854,4 +8854,57 @@ handle_vtv_comdat_section (section *sect, const_tree decl ATTRIBUTE_UNUSED)
switch_to_comdat_section(sect, DECL_NAME (decl));
}
+void
+varasm_cc_finalize ()
+{
+ first_global_object_name = nullptr;
+ weak_global_object_name = nullptr;
+
+ const_labelno = 0;
+ size_directive_output = 0;
+
+ last_assemble_variable_decl = NULL_TREE;
+ first_function_block_is_cold = false;
+ saw_no_split_stack = false;
+ text_section = nullptr;
+ data_section = nullptr;
+ readonly_data_section = nullptr;
+ sdata_section = nullptr;
+ ctors_section = nullptr;
+ dtors_section = nullptr;
+ bss_section = nullptr;
+ sbss_section = nullptr;
+ tls_comm_section = nullptr;
+ comm_section = nullptr;
+ lcomm_section = nullptr;
+ bss_noswitch_section = nullptr;
+ exception_section = nullptr;
+ eh_frame_section = nullptr;
+ in_section = nullptr;
+ in_cold_section_p = false;
+ cold_function_name = NULL_TREE;
+ unnamed_sections = nullptr;
+ section_htab = nullptr;
+ object_block_htab = nullptr;
+ anchor_labelno = 0;
+ shared_constant_pool = nullptr;
+ pending_assemble_externals = NULL_TREE;
+ pending_libcall_symbols = nullptr;
+
+#ifdef ASM_OUTPUT_EXTERNAL
+ pending_assemble_externals_processed = false;
+ pending_assemble_externals_set = nullptr;
+#endif
+
+ weak_decls = NULL_TREE;
+ initial_trampoline = nullptr;
+ const_desc_htab = nullptr;
+ weakref_targets = NULL_TREE;
+ alias_pairs = nullptr;
+ tm_clone_hash = nullptr;
+ trampolines_created = 0;
+ elf_init_array_section = nullptr;
+ elf_fini_array_section = nullptr;
+}
+
#include "gt-varasm.h"
diff --git a/gcc/varasm.h b/gcc/varasm.h
index d9311dc..f00ac7f 100644
--- a/gcc/varasm.h
+++ b/gcc/varasm.h
@@ -81,4 +81,6 @@ extern rtx assemble_trampoline_template (void);
extern void switch_to_comdat_section (section *, tree);
+extern void varasm_cc_finalize ();
+
#endif // GCC_VARASM_H