Hi, This fixes a fail seen when using JIT on Darwin where we fail to label the start of debug sections properly. This operation is controlled by a vector of tokens that is lazily allocated.
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. tested on x86_64, i686-darwin (and x86_64-linux). pushed to master, thanks Iain Signed-off-by: Iain Sandoe <i...@sandoe.co.uk> gcc/ChangeLog: * config/darwin.c (darwin_file_end): Reset and reclaim the section names table at the end of compile. --- gcc/config/darwin.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index b160c23ea56..5d1d13c80aa 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -3129,6 +3129,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. */ -- 2.24.3 (Apple Git-128)