From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id BC6173856DC7 for ; Sat, 9 Jul 2022 12:29:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC6173856DC7 Received: by mail-pg1-x52c.google.com with SMTP id q82so1063063pgq.6 for ; Sat, 09 Jul 2022 05:29:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=yPE14XefHz6X7bXbuTxrUAkMUgDXTHDIPNzpLiHaYxw=; b=Hn7Ox5AksvogBxMWn6qlZ61lUaQ9BuwggSdIZ6YyQHPk7N9rkf5LJDmW11PbXWXgoN ABcA10pjonjpntbIAbsHcBN9zPLXIZVmyU9DGlHoXTEEQhb9cdDjAPkw22xA7OTmgcVP 90QQJoKpiHKMqC1tl1GTanT2bF74GlW0oF2770Gp3rc18n5Wacmsq+FWvizsUdVHleMS u97o3TnKx4+mPVTedqt9RnH+UDHbxqB302NOlZlJqGz6ukB9Y87rbaQL3tfelyBMT7s6 YDHhIS26/aiG1Bf1z/Z4TBNlJO9EUWB5nbArAkcxfSnS+y5KayAtN3AYA1trRpQF79Ux EDEg== X-Gm-Message-State: AJIora/lzL5F+shoNddkRZQU/6Ham9eozNLd0HU+CFpcTb7a6T/3Ts/x Pzt3BYyTW4INt5H/Ss6aebssKgVqWoU= X-Google-Smtp-Source: AGRyM1tx8VyPKsAHEm/N38hvHw3j6yN7Yrwo7/gvtt7I26fEPZYw33qRhnrzT4uiO/6nlEzmRFbb7w== X-Received: by 2002:a05:6a00:1346:b0:528:c809:447 with SMTP id k6-20020a056a00134600b00528c8090447mr8663053pfu.69.1657369750492; Sat, 09 Jul 2022 05:29:10 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:4b98:7b4b:d3e3:2ead]) by smtp.gmail.com with ESMTPSA id e14-20020a170902ef4e00b0016c1fdaa38fsm1223742plx.231.2022.07.09.05.29.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Jul 2022 05:29:10 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id C03A01143046; Sat, 9 Jul 2022 21:59:07 +0930 (ACST) Date: Sat, 9 Jul 2022 21:59:07 +0930 From: Alan Modra To: binutils@sourceware.org Subject: gas: free sy_hash, macro_hash and po_hash Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3036.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jul 2022 12:29:13 -0000 * macro.c (macro_end): New function. * macro.h (macro_end): Declare. * read.c (read_end, poend): New functions. * read.h (read_end): Declare. * symbols.c (symbol_end): New function. * symbols.h (symbol_end): Declare. * output-file.c (output_file_close): Call new *_end functions. diff --git a/gas/macro.c b/gas/macro.c index b360b2ec038..e2cfbee5439 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -84,6 +84,12 @@ macro_init (int alternate, int mri, int strip_at, macro_expr = exp; } +void +macro_end (void) +{ + htab_delete (macro_hash); +} + /* Switch in and out of alternate mode on the fly. */ void diff --git a/gas/macro.h b/gas/macro.h index 227c9cb5c93..03d6a81c5e3 100644 --- a/gas/macro.h +++ b/gas/macro.h @@ -85,6 +85,7 @@ extern int buffer_and_nest (const char *, const char *, sb *, size_t (*) (sb *)); extern void macro_init (int, int, int, size_t (*) (const char *, size_t, sb *, offsetT *)); +extern void macro_end (void); extern void macro_set_alternate (int); extern void macro_mri_mode (int); extern const char *define_macro (size_t, sb *, sb *, size_t (*) (sb *), diff --git a/gas/output-file.c b/gas/output-file.c index 584deb27c08..3c4074b263d 100644 --- a/gas/output-file.c +++ b/gas/output-file.c @@ -20,6 +20,8 @@ #include "as.h" #include "subsegs.h" +#include "sb.h" +#include "macro.h" #include "output-file.h" #ifndef TARGET_MACH @@ -103,6 +105,9 @@ output_file_close (void) if (!keep_it && filename) unlink_if_ordinary (filename); + macro_end (); + read_end (); + symbol_end (); subsegs_end (obs); if (!res) diff --git a/gas/read.c b/gas/read.c index 2f9a22a8d76..edf3f2a7881 100644 --- a/gas/read.c +++ b/gas/read.c @@ -248,6 +248,7 @@ static void s_reloc (int); static int hex_float (int, char *); static segT get_known_segmented_expression (expressionS * expP); static void pobegin (void); +static void poend (void); static size_t get_non_macro_line_sb (sb *); static void generate_file_debug (void); static char *_find_end_of_line (char *, int, int, int); @@ -276,6 +277,12 @@ read_begin (void) if (flag_mri) lex_type['?'] = 3; } + +void +read_end (void) +{ + poend (); +} #ifndef TC_ADDRESS_BYTES #define TC_ADDRESS_BYTES address_bytes @@ -561,6 +568,12 @@ pobegin (void) pop_override_ok = 1; cfi_pop_insert (); } + +static void +poend (void) +{ + htab_delete (po_hash); +} #define HANDLE_CONDITIONAL_ASSEMBLY(num_read) \ if (ignore_input ()) \ diff --git a/gas/read.h b/gas/read.h index 0fa9e795189..acab6674899 100644 --- a/gas/read.h +++ b/gas/read.h @@ -141,6 +141,7 @@ extern unsigned output_leb128 (char *, valueT, int); extern void pseudo_set (symbolS * symbolP); extern void read_a_source_file (const char *name); extern void read_begin (void); +extern void read_end (void); extern void read_print_statistics (FILE *); extern char *read_symbol_name (void); extern unsigned sizeof_leb128 (valueT, int); diff --git a/gas/symbols.c b/gas/symbols.c index 00ae49b91ed..744f6e1260f 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -3062,6 +3062,12 @@ symbol_begin (void) fb_label_init (); } +void +symbol_end (void) +{ + htab_delete (sy_hash); +} + void dot_symbol_init (void) { diff --git a/gas/symbols.h b/gas/symbols.h index 240e08f8df6..c33a28ff86b 100644 --- a/gas/symbols.h +++ b/gas/symbols.h @@ -67,6 +67,7 @@ symbolS *symbol_temp_make (void); symbolS *colon (const char *sym_name); void local_colon (int n); void symbol_begin (void); +void symbol_end (void); void dot_symbol_init (void); void symbol_print_statistics (FILE *); void symbol_table_insert (symbolS * symbolP); -- Alan Modra Australia Development Lab, IBM