]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Darwin: Reset section names table at the end of compile.
authorIain Sandoe <iain@sandoe.co.uk>
Fri, 13 Aug 2021 19:20:04 +0000 (20:20 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 29 May 2022 19:08:34 +0000 (20:08 +0100)
For a single use (typical compile) this vector will be reclaimed
as GGC.  For JIT this is not sufficient since it does not reset
the pointer to NULL (and thus we think the the vector is already
allocated when a context is reused).

The clears the vector and sets the pointer to NULL at the end
of object output.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config/darwin.c (darwin_file_end): Reset and reclaim the
section names table at the end of compile.

(cherry picked from commit 2d9da1c89778be1d6604cc1465b0dd50f241a352)

gcc/config/darwin.c

index 5d66709a3ddd4ca949691902bf4d5cf9547e6b4a..3ce3a04f43adc9538c993f6de88ffd2773681b24 100644 (file)
@@ -3124,6 +3124,14 @@ darwin_file_end (void)
      re-arranging data.  */
   if (!DARWIN_SECTION_ANCHORS || !flag_section_anchors)
     fprintf (asm_out_file, "\t.subsections_via_symbols\n");
+
+  /* We rely on this being NULL at the start of compilation; reset it here
+     so that JIT can reuse a context.  */
+  if (dwarf_sect_names_table != NULL)
+    {
+      dwarf_sect_names_table->truncate (0);
+      dwarf_sect_names_table = NULL;
+    }
 }
 
 /* TODO: Add a language hook for identifying if a decl is a vtable.  */