This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] partial fix to PR binutils/14663


Cary Coutant writes:
 > I don't think this part is right. Before, this test for STRIP_NONDWO
 > would be hit whether SEC_DEBUGGING is true or not, and there are
 > non-DWO sections that have SEC_DEBUGGING as well as non-DWO sections
 > that don't have that flag.

Blech.

2012-10-08  Doug Evans  <dje@google.com>

	PR binutils/14663
	* objcopy.c (is_strip_section_1): If STRIP_NONDEBUG, remove
	non-debug sections.

Index: objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.157
diff -u -p -r1.157 objcopy.c
--- objcopy.c	8 May 2012 17:49:36 -0000	1.157
+++ objcopy.c	8 Oct 2012 17:11:51 -0000
@@ -985,7 +985,23 @@ is_strip_section_1 (bfd *abfd ATTRIBUTE_
       if (strip_symbols == STRIP_NONDEBUG)
 	return FALSE;
     }
+  else
+    {
+      if (strip_symbols == STRIP_NONDEBUG)
+	{
+	  /* If ELF, keep note sections.
+	     SEC could be an *ABS* section with no associated bfd,
+	     so we use sec->owner and not abfd here.  */
+	  if (sec->owner != NULL
+	      && sec->owner->xvec->flavour == bfd_target_elf_flavour
+	      && elf_section_type (sec) == SHT_NOTE)
+	    return FALSE;
+	  return TRUE;
+	}
+    }
 
+  /* Non-DWO sections includes non-debugging sections as well as
+     debugging sections that aren't .dwo sections.  */
   if (strip_symbols == STRIP_NONDWO)
     return !is_dwo_section (abfd, sec);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]