strip crashes on MSVC generated object files

Alan Modra amodra@bigpond.net.au
Mon Feb 21 16:48:00 GMT 2005


On Fri, Feb 18, 2005 at 02:47:52PM +0100, Christian Groessler wrote:
> I've attached a patch to workaround the issue, but it's probably more
> curing the symptoms instead of the disease?

It's a reasonable thing to do.  The disease in this case is that the
absolute input section isn't attached to each bfd that defines absolute
symbols.  However, fixing that properly requires quite a large patch.

I'm committing a more direct approach than your patch.  There are other
sections besides the absolute section that won't have coff_section_data.

	* coffgen.c (bfd_coff_get_comdat_section): Check that
	coff_section_data isn't NULL.

Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.47
diff -u -p -r1.47 coffgen.c
--- bfd/coffgen.c	20 Feb 2005 14:59:06 -0000	1.47
+++ bfd/coffgen.c	21 Feb 2005 11:18:11 -0000
@@ -2427,7 +2427,8 @@ bfd_coff_set_symbol_class (abfd, symbol,
 struct coff_comdat_info *
 bfd_coff_get_comdat_section (bfd *abfd, struct bfd_section *sec)
 {
-  if (bfd_get_flavour (abfd) == bfd_target_coff_flavour)
+  if (bfd_get_flavour (abfd) == bfd_target_coff_flavour
+      && coff_section_data (abfd, sec) != NULL)
     return coff_section_data (abfd, sec)->comdat;
   else
     return NULL;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list