This is the mail archive of the mailing list for the GDB 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]

64-bit sparc stabs are broken

The Solaris native assembler generates R_SPARC_32 relocations for
stabs, and so does the GNU assembler.  However, unlike GNU ld,
Solaris' native linker disregards relocation overflows when resolving
such relocations in 64-bit mode: addresses start at 0x100000000, but
we get no complaint from Solaris ld, whereas GNU ld dies with a
relocation overflow message.

This patch arranges for GNU ld to ignore relocation overflows in the
.stabs section, which is necessary to get a Solaris 7/sparc
binutils+GCC bootstrap to complete.  I still haven't checked whether
GDB is going to need any change in order to work correctly with 64-bit

The patch was approved by Richard Henderson.  I'm checking it in.

Index: bfd/ChangeLog
from  Alexandre Oliva  <>

	* elf64-sparc.c (sparc64_elf_relocate_section): Disregard
	overflows in the .stab section.

Index: bfd/elf64-sparc.c
RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
retrieving revision 1.41
diff -u -p -r1.41 elf64-sparc.c
--- bfd/elf64-sparc.c 2001/11/11 23:51:36 1.41
+++ bfd/elf64-sparc.c 2001/11/15 04:08:12
@@ -2627,6 +2627,16 @@ sparc64_elf_relocate_section (output_bfd
 	    const char *name;
+	    /* The Solaris native linker silently disregards
+	       overflows.  We don't, but this breaks stabs debugging
+	       info, whose relocations are only 32-bits wide.  Ignore
+	       overflows in this case.  */
+	    if (r_type == R_SPARC_32
+		&& (input_section->flags & SEC_DEBUGGING) != 0
+		&& strcmp (bfd_section_name (input_bfd, input_section),
+			   ".stab") == 0)
+	      break;
 	    if (h != NULL)
 		if (h->root.type == bfd_link_hash_undefweak

Alexandre Oliva   Enjoy Guarana', see
Red Hat GCC Developer                  aoliva@{,}
CS PhD student at IC-Unicamp        oliva@{,}
Free Software Evangelist    *Please* write to mailing lists, not to me

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