This is the mail archive of the binutils@sourceware.cygnus.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]

Re: Zero valued N_FUN stabs in shared objects: Why?


On Sep 10,  7:49pm, Ian Lance Taylor wrote:

>        Why do shared objects on Solaris and Linux have zero-valued
>        N_FUN stabs?
> 
> Good question.  It doesn't happen with binutils 2.9.1, but it does
> happen in the current development sources.
> 
> It's because of this bit of code in elf_i386_relocate_section in
> bfd/elf32-i386.c:
> 
> 			  /* DWARF will emit R_386_32 relocations in its
> 			     sections against symbols defined externally
> 			     in shared libraries.  We can't do anything
> 			     with them here.  */
> 			  || (input_section->flags & SEC_DEBUGGING) != 0)))
> 
> If I remove that, N_FUN stabs are no longer zero.

Good call.  I've tested your suggested change and it does indeed solve
the problems that I was seeing on Linux.  (The N_FUN stabs addresses
are no longer zero, and I no longer need to enable the
SOFUN_ADDRESS_MAYBE_MISSING hack in gdb to debug shared objects on
linux/x86.)

But Solaris/sparc is still broken...  Someone (I don't know who) gave
the patch below to Jim Blandy (for our customer to try), but it does
not cure the problem of the N_FUN stabs being zero.

Any ideas?

Kevin

Index: elf32-sparc.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/elf32-sparc.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 elf32-sparc.c
--- elf32-sparc.c	1999/05/03 07:28:56	1.1.1.1
+++ elf32-sparc.c	1999/05/17 03:54:39
@@ -1526,11 +1526,13 @@
 	      ++sreloc->reloc_count;
 
 	      /* This reloc will be computed at runtime, so there's no
-                 need to do anything now, unless this is a RELATIVE
-                 reloc in an unallocated section.  */
+                 need to do anything now.  However, if this is a
+                 RELATIVE or 32 reloc in an unallocated section, we
+                 resolve it now for the benefit of gdb.  */
 	      if (skip
 		  || (input_section->flags & SEC_ALLOC) != 0
-		  || ELF32_R_TYPE (outrel.r_info) != R_SPARC_RELATIVE)
+		  || (ELF32_R_TYPE (outrel.r_info) != R_SPARC_RELATIVE
+		      && ELF32_R_TYPE (outrel.r_info) != R_SPARC_32))
 		continue;
 	    }
 	  break;


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