From 24b7e8b18ae6410e0b2445475cd21503a2c38922 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 13 Feb 2023 20:28:41 +1030 Subject: stabs.c static state Move all the function local static state variables to file scope, in order to tidy memory on exit and to reinit everything for that annoying oss-fuzz. Also fix a couple memory leaks. * read.h (read_begin, read_end): Declare. * read.c (read_begin): Call stabs_begin. (read_end): Call stabs_end. * stabs.c (stabs_begin, stabs_end): New functions. (in_dot_func_p): Delete, use current_function_label instead. (cached_sec): Move from s_stab_generic. (last_asm_file, file_label_count): Move from generate_asm_file. (line_label_count, prev_lineno, prev_line_file): Move from stabs_generate_asm_lineno. (void_emitted_p): Move from stabs_generate_asm_func. (endfunc_label_count): Move from stabs_generate_asm_endfunc. (stabs_generate_asm_lineno): Simplify setting of prev_line_file. (stabs_generate_asm_func): Don't leak current_function_label. (stabs_generate_asm_endfunc): Likewise. --- gas/read.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gas/read.c') diff --git a/gas/read.c b/gas/read.c index c5a477f..9f6a700 100644 --- a/gas/read.c +++ b/gas/read.c @@ -274,11 +274,13 @@ read_begin (void) if (flag_mri) lex_type['?'] = 3; + stabs_begin (); } void read_end (void) { + stabs_end (); poend (); _obstack_free (&cond_obstack, NULL); } -- cgit v1.1