This is the mail archive of the binutils@sources.redhat.com 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]

[patch] Support 4 byte @fptr expressions in xstormy16 debugstatements


Hi Guys,

  I am applying the patch below to fix a small problem recently
  encountered with the xstomry16 port.  Under some circumstances GCC
  can generate debug statements with @fptr() expressions in them.
  These are interpreted as being 4 bytes wide and used to cause the
  assembly to fail.  Since the symbols are only going into the debug
  area the @fptr semantics can be ignored and a normal symbol
  reference generated.

Cheers
  Nick

gas/ChangeLog  
2004-10-18  Nick Clifton  <nickc@redhat.com>

	* config/tc-xstormy16.c (xstormy16_cons_fix_new): Accept and
	ignore @fptr() directives for 4-byte fixups.
  
Index: gas/config/tc-xstormy16.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xstormy16.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 tc-xstormy16.c
*** gas/config/tc-xstormy16.c	22 May 2003 08:57:32 -0000	1.14
--- gas/config/tc-xstormy16.c	18 Oct 2004 07:54:28 -0000
*************** xstormy16_cons_fix_new (f, where, nbytes
*** 206,218 ****
  
    if (exp->X_op == O_fptr_symbol)
      {
!       if (nbytes != 2)
  	{
  	  as_bad ("unsupported fptr fixup size %d", nbytes);
  	  return;
  	}
-       exp->X_op = O_symbol;
-       code = BFD_RELOC_XSTORMY16_FPTR16;
      }
    else if (nbytes == 1)
      code = BFD_RELOC_8;
--- 206,234 ----
  
    if (exp->X_op == O_fptr_symbol)
      {
!       switch (nbytes)
  	{
+  	case 4:
+  	  /* This can happen when gcc is generating debug output.
+  	     For example it can create a stab with the address of
+  	     a function:
+  	     
+  	     	.stabs	"foo:F(0,21)",36,0,0,@fptr(foo)
+  
+  	     Since this does not involve switching code pages, we
+  	     just allow the reloc to be generated without any
+  	     @fptr behaviour.  */
+  	  exp->X_op = O_symbol;
+  	  code = BFD_RELOC_32;
+  	  break;
+  	case 2:
+  	  exp->X_op = O_symbol;
+  	  code = BFD_RELOC_XSTORMY16_FPTR16;
+  	  break;
+  	default:
  	  as_bad ("unsupported fptr fixup size %d", nbytes);
  	  return;
  	}
      }
    else if (nbytes == 1)
      code = BFD_RELOC_8;


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