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]

[PATCH] Unaligned relocs in .debug_line on SPARC


Hi,

The assembler emits unaligned relocs in .debug_line on SPARC.  While the GNU 
linker can grok them, the Sun linker cannot (at least on Solaris 8) and, for 
example, this prevents GCC from bootstrapping with GNU as and Sun ld there.

Hence the attached patch, which lets GCC bootstrap in the above configuration.


2006-11-27  Eric Botcazou  <ebotcazou@adacore.com>

gas/
	* config/tc-sparc.c (tc_gen_reloc): Turn aligned relocs into
	their unaligned counterparts in debugging sections.


-- 
Eric Botcazou
Index: config/tc-sparc.c
===================================================================
RCS file: /paris.a/cvs/Dev/binutils/gas/config/tc-sparc.c,v
retrieving revision 1.1.1.4
diff -u -p -r1.1.1.4 tc-sparc.c
--- config/tc-sparc.c	9 Oct 2006 13:35:12 -0000	1.1.1.4
+++ config/tc-sparc.c	26 Nov 2006 16:44:23 -0000
@@ -3439,7 +3439,7 @@ md_apply_fix (fixP, valP, segment)
 
 arelent **
 tc_gen_reloc (section, fixp)
-     asection *section ATTRIBUTE_UNUSED;
+     asection *section;
      fixS *fixp;
 {
   static arelent *relocs[3];
@@ -3581,6 +3581,16 @@ tc_gen_reloc (section, fixp)
 	}
     }
 #endif /* defined (OBJ_ELF) || defined (OBJ_AOUT)  */
+
+  /* Nothing is aligned in DWARF debugging sections.  */
+  if (bfd_get_section_flags (stdoutput, section) & SEC_DEBUGGING)
+    switch (code)
+      {
+      case BFD_RELOC_16: code = BFD_RELOC_SPARC_UA16; break;
+      case BFD_RELOC_32: code = BFD_RELOC_SPARC_UA32; break;
+      case BFD_RELOC_64: code = BFD_RELOC_SPARC_UA64; break;
+      default: break;
+      }
 
   if (code == BFD_RELOC_SPARC_OLO10)
     reloc->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_LO10);

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