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]

Re: FYI: patches for powerpc-aix...


On Feb 19, 2013, at 3:41 AM, Alan Modra wrote:

> On Mon, Feb 18, 2013 at 03:05:28PM -0800, Joel Brobecker wrote:
>>    /tmp//ccY5Nx8U.s: Assembler messages:
>>    /tmp//ccY5Nx8U.s:241: Internal error, aborting at /homes/brobecke/act/binutils/binutils-head/gas/config/tc-ppc.c line 3319 in md_assemble
> 
> Likely my 2012-11-05 tc-ppc.c change exposing lack of support for
> relocs in _bfd_xcoff_reloc_type_lookup.  Taking a wild stab at it (I
> don't speak xcoff):

Hello,

this patch fixes this regression. There was in fact two regressions:

1) Usual references to TOC (as emitted by gcc, eg: lwz 3,LC..1(2))
were not recognized as is by ppc_is_toc_sym, because the symbol class
is now XMC_TC0. Previously the local symbol was discarded and replaced
by a reference to the XMC_TC symbol defined by the .tc pseudo

2) Unusual reference to csect relative symbols (as they appear in the
gas testsuite) crashed gas before gas now needs a BFD_RELOC_16 reloc.

This patch fixes one regression in the gas testsuite, and I was able
to cross-compile an hello world program using gcc.

Ok to apply ?

bfd/
2013-05-15  Tristan Gingold  <gingold@adacore.com>

	* coff-rs6000.c (xcoff_howto_table): Add R_POS_16 entry.
	(_bfd_xcoff_reloc_type_lookup): Handle BFD_RELOC_16.

gas/
2013-05-15  Tristan Gingold  <gingold@adacore.com>

	* config/tc-ppc.c (ppc_is_toc_sym): Symbols of class XMC_TC
	are also TOC symbols.

--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -1099,6 +1099,21 @@ reloc_howto_type xcoff_howto_table[] =
 	 0xffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
+  /* Standard 16 bit relocation.  Note that this relocation is only
+     internally used by gas.  */
+  HOWTO (R_POS,			/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 FALSE,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield, /* complain_on_overflow */
+	 0,			/* special_function */
+	 "R_POS_16",		/* name */
+	 TRUE,			/* partial_inplace */
+	 0xffff,		/* src_mask */
+	 0xffff,		/* dst_mask */
+	 FALSE),		/* pcrel_offset */
 };
 
 void
@@ -1146,6 +1161,8 @@ _bfd_xcoff_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
       return &xcoff_howto_table[8];
     case BFD_RELOC_PPC_TOC16:
       return &xcoff_howto_table[3];
+    case BFD_RELOC_16:
+      return &xcoff_howto_table[0x1f];
     case BFD_RELOC_32:
     case BFD_RELOC_CTOR:
       return &xcoff_howto_table[0];

--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -2428,7 +2428,8 @@ static int
 ppc_is_toc_sym (symbolS *sym)
 {
 #ifdef OBJ_XCOFF
-  return symbol_get_tc (sym)->symbol_class == XMC_TC;
+  return (symbol_get_tc (sym)->symbol_class == XMC_TC
+	  || symbol_get_tc (sym)->symbol_class == XMC_TC0);
 #endif
 #ifdef OBJ_ELF
   const char *sname = segment_name (S_GET_SEGMENT (sym));


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