From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id 2E7C13829BD4; Sun, 29 May 2022 19:08:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E7C13829BD4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10787] Darwin: Reset section names table at the end of compile. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 90ac2b396d5a4f15a9ab50464f67ab5f08e73b28 X-Git-Newrev: 8d16d15d7efcd8f65dd0d289aad26b7ee3b0b2b2 Message-Id: <20220529190846.2E7C13829BD4@sourceware.org> Date: Sun, 29 May 2022 19:08:46 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2022 19:08:46 -0000 https://gcc.gnu.org/g:8d16d15d7efcd8f65dd0d289aad26b7ee3b0b2b2 commit r10-10787-g8d16d15d7efcd8f65dd0d289aad26b7ee3b0b2b2 Author: Iain Sandoe Date: Fri Aug 13 20:20:04 2021 +0100 Darwin: Reset section names table at the end of compile. 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 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) Diff: --- gcc/config/darwin.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 5d66709a3dd..3ce3a04f43a 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -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. */