public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* now_seg after closing output file
@ 2023-01-11  6:06 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-01-11  6:06 UTC (permalink / raw)
  To: binutils

now_seg, a pointer into the output file sections, isn't valid after
the output file is closed.  gas doesn't and shouldn't use now_seg
after this point of course, but let's be safe.

	* output-file.c (output_file_close): Clear now_seg and now_subseg.

diff --git a/gas/output-file.c b/gas/output-file.c
index 127dc735703..0c3a8115bb1 100644
--- a/gas/output-file.c
+++ b/gas/output-file.c
@@ -99,6 +99,8 @@ output_file_close (void)
     res = bfd_cache_close_all ();
   else
     res = bfd_close (obfd);
+  now_seg = NULL;
+  now_subseg = 0;
 
   filename = out_file_name;
   out_file_name = NULL;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-11  6:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11  6:06 now_seg after closing output file Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).