[binutils-gdb] now_seg after closing output file

Alan Modra amodra@sourceware.org
Wed Jan 11 06:06:40 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=da1f81c128b9be3cface7b0860085da8c6452510

commit da1f81c128b9be3cface7b0860085da8c6452510
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Jan 11 15:31:06 2023 +1030

    now_seg after closing output file
    
    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:
---
 gas/output-file.c | 2 ++
 1 file changed, 2 insertions(+)

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;


More information about the Binutils-cvs mailing list