[committed] ia64 as core dump when section switching

James E Wilson wilson@specifix.com
Wed Nov 23 04:40:00 GMT 2005


This is a fix for PR 994.  Using the gcc option
-freorder-blocks-and-partition results in code that performs section
switches in the middle of a function.  IA-64 has a smart assembler that
must synthesize a lot of info, and we can't do this when there are
section switches in the middle of a function.  I originally modified the
assembler to emit a warning in this case, but a more complicated example
has defied a fix, so I am changing it to a fatal error.  I'm also fixing
the compiler so that this option is disabled for the IA-64 target.  This
is FSF gcc PR 24934.

This was tested with a cross compiler build and make check.  There were
no regressions.  (I upgraded my debian unstable IA-64 linux system, and
now make check doesn't work.  So I am temporarily unable to do native
testing.)
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com
-------------- next part --------------
2005-11-22  James E Wilson  <wilson@specifix.com>

	* config/tc-ia64.c (slot_index): Emit an error instead of a warning
	when the frag chain is broken by section switching.

Index: tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.182
diff -p -p -r1.182 tc-ia64.c
*** tc-ia64.c	23 Nov 2005 01:40:55 -0000	1.182
--- tc-ia64.c	23 Nov 2005 03:12:31 -0000
*************** slot_index (slot_addr, slot_frag, first_
*** 2895,2918 ****
        first_addr = (unsigned long) &first_frag->fr_literal;
  
        /* This can happen if there is section switching in the middle of a
! 	 function, causing the frag chain for the function to be broken.  */
        if (first_frag == NULL)
! 	{
! 	  /* We get six warnings for one problem, because of the loop in
! 	     fixup_unw_records, and because fixup_unw_records is called 3
! 	     times: once before creating the variant frag, once to estimate
! 	     its size, and once to relax it.  This is unreasonable, so we use
! 	     a static var to make sure we only emit the warning once.  */
! 	  static int warned = 0;
! 
! 	  if (!warned)
! 	    {
! 	      as_warn ("Corrupted unwind info due to unsupported section switching");
! 	      warned = 1;
! 	    }
! 
! 	  return index;
! 	}
      }
  
    /* Add in the used part of the last frag.  */
--- 2895,2905 ----
        first_addr = (unsigned long) &first_frag->fr_literal;
  
        /* This can happen if there is section switching in the middle of a
! 	 function, causing the frag chain for the function to be broken.
! 	 It is too difficult to recover safely from this problem, so we just
! 	 exit with an error.  */
        if (first_frag == NULL)
! 	as_fatal ("Section switching in code is not supported.");
      }
  
    /* Add in the used part of the last frag.  */


More information about the Binutils mailing list