[gcc-3.3] patch for IA-64 TLS abort

James E Wilson wilson@specifixinc.com
Mon Mar 28 22:41:00 GMT 2005

This is for PR 20286, which is an IA-64 abort with a testcase that
redefines an external __thread variable as static __thread.

This testcase hits the abort in ia64_encode_section_info which aborts if
a thread variable changes state.  This is intended to catch accidental
transitions between thread data and small data.  In this case, it is
accidentally catching an internal TLS transition from INITIAL_EXEC to
LOCAL_EXEC, which is an allowable transition.  This patch fixes the
problem by only calling the abort if either state involves small data.

This patch applies only to gcc-3.3.  This was fixed in gcc-3.4 by using
default_encode_section_info, which is not present in gcc-3.3.  Since
pulling all of this into gcc-3.3 is a rather large patch, including
non-IA-64 changes, I believe it is better to just add a gcc-3.3 specific
fix to the ia64.c file.

This was tested with a bootstrap and make check with and without the
patch on ia64-linux using the top of the gcc-3.3 branch.  There were no
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

-------------- next part --------------
2005-03-23  James E Wilson  <wilson@specifixinc.com>

	PR target/20286.
	* config/ia64/ia64.c (ia64_encode_section_info): Only abort if encoding
	or symbol_str[1] is 's'.

Index: ia64.c
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision
diff -p -p -r1.198.2.24 ia64.c
*** ia64.c	14 Jan 2005 19:15:40 -0000
--- ia64.c	23 Mar 2005 23:56:35 -0000
*************** ia64_encode_section_info (decl, first)
*** 7360,7366 ****
  	  if (encoding == symbol_str[1])
  	  /* ??? Sdata became thread or thread becaome not thread.  Lose.  */
! 	  abort ();
        len = strlen (symbol_str);
--- 7360,7367 ----
  	  if (encoding == symbol_str[1])
  	  /* ??? Sdata became thread or thread becaome not thread.  Lose.  */
! 	  if (encoding == 's' || symbol_str[1] == 's')
! 	    abort ();
        len = strlen (symbol_str);

More information about the Gcc-patches mailing list