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]

AOUT FAIL: strip --strip-unneeded


Many AOUT targets "FAIL: strip --strip-unneeded on common symbol".
The underlying problem is that EXEC_P was being incorrectly set for
relocatable object files, leading to objcopy.c:filter_symbols
  int relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0;
being false and therefore not matching this test
      else if (relocatable			/* Relocatable file.  */
	       && ((flags & (BSF_GLOBAL | BSF_WEAK)) != 0
		   || bfd_is_com_section (bfd_get_section (sym))))
	keep = TRUE;
so throwing away needed symbols.

This tweaks the heuristic setting EXEC_P.  If an AOUT file has relocs,
it's likely not an executable.  Relocatable object files of course
don't need to have relocs, but I don't think we can do much better
than this.

	* aoutx.h (some_aout_object_p): Don't set EXEC_P for files with
	relocs.

Index: bfd/aoutx.h
===================================================================
RCS file: /cvs/src/src/bfd/aoutx.h,v
retrieving revision 1.81
diff -u -p -r1.81 aoutx.h
--- bfd/aoutx.h	9 Apr 2010 14:40:15 -0000	1.81
+++ bfd/aoutx.h	22 Jul 2010 11:58:24 -0000
@@ -629,7 +629,9 @@ NAME (aout, some_aout_object_p) (bfd *ab
   if (execp->a_entry != 0
       || (execp->a_entry >= obj_textsec (abfd)->vma
 	  && execp->a_entry < (obj_textsec (abfd)->vma
-			       + obj_textsec (abfd)->size)))
+			       + obj_textsec (abfd)->size)
+	  && execp->a_trsize == 0
+	  && execp->a_drsize == 0))
     abfd->flags |= EXEC_P;
 #ifdef STAT_FOR_EXEC
   else

-- 
Alan Modra
Australia Development Lab, IBM


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