public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Debug info is lost for functions only called from functions marked with cmse_nonsecure_entr
@ 2023-05-05 10:12 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-05-05 10:12 UTC (permalink / raw)
  To: bfd-cvs

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

commit e4fbcd83c2423221ddde99d50b432df7dda06f5f
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri May 5 11:11:32 2023 +0100

    Debug info is lost for functions only called from functions marked with cmse_nonsecure_entr
    
      PR 30354
      * elf32-arm.c (elf32_arm_gc_mark_extra_sections): If any debug sections are marked then rerun the extra marking in order to pick up any dependencies.

Diff:
---
 bfd/ChangeLog   |  7 +++++++
 bfd/elf32-arm.c | 17 ++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 013386d6007..b8150d4d0c8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2023-05-05  Nick Clifton  <nickc@redhat.com>
+
+	PR 30354
+	* elf32-arm.c (elf32_arm_gc_mark_extra_sections): If any debug
+	sections are marked then rerun the extra marking in order to pick
+	up any dependencies.
+
 2023-05-03  Oleg Tolmatcev  <oleg.tolmatcev@gmail.com>
 
 	* archive.c (_bfd_write_archive_contents): Use a larger buffer in
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 70413668e5a..cb22989f6f1 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -15937,7 +15937,7 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
   struct elf_link_hash_entry **sym_hashes;
   struct elf32_arm_link_hash_entry *cmse_hash;
   bool again, is_v8m, first_bfd_browse = true;
-  bool debug_sec_need_to_be_marked = false;
+  bool extra_marks_added = false;
   asection *isec;
 
   _bfd_elf_gc_mark_extra_sections (info, gc_mark_hook);
@@ -15981,6 +15981,8 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
 	     of them so no need for a second browsing.  */
 	  if (is_v8m && first_bfd_browse)
 	    {
+	      bool debug_sec_need_to_be_marked = false;
+
 	      sym_hashes = elf_sym_hashes (sub);
 	      bed = get_elf_backend_data (sub);
 	      symtab_hdr = &elf_tdata (sub)->symtab_hdr;
@@ -15997,7 +15999,7 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
 		  /* Assume it is a special symbol.  If not, cmse_scan will
 		     warn about it and user can do something about it.  */
 		  if (startswith (cmse_hash->root.root.root.string,
-				    CMSE_PREFIX))
+				  CMSE_PREFIX))
 		    {
 		      cmse_sec = cmse_hash->root.root.u.def.section;
 		      if (!cmse_sec->gc_mark
@@ -16018,15 +16020,24 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
 		    {
 		      /* If not a debug sections, skip it.  */
 		      if (!isec->gc_mark && (isec->flags & SEC_DEBUGGING))
-			isec->gc_mark = 1 ;
+			{
+			  isec->gc_mark = 1;
+			  extra_marks_added = true;
+			}
 		    }
 		  debug_sec_need_to_be_marked = false;
 		}
 	    }
 	}
+
       first_bfd_browse = false;
     }
 
+  /* PR 30354: If we have added extra marks then make sure that any
+     dependencies of the newly marked sections are also marked.  */
+  if (extra_marks_added)
+    _bfd_elf_gc_mark_extra_sections (info, gc_mark_hook);
+
   return true;
 }

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

only message in thread, other threads:[~2023-05-05 10:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 10:12 [binutils-gdb] Debug info is lost for functions only called from functions marked with cmse_nonsecure_entr Nick Clifton

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).