This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Zero valued N_FUN stabs in shared objects: Why?
- To: Ian Lance Taylor <ian AT zembu dot com>, kevinb AT cygnus dot com, drepper AT cygnus dot com, rth AT cygnus dot com
- Subject: Re: Zero valued N_FUN stabs in shared objects: Why?
- From: Kevin Buettner <kevinb AT cygnus dot com>
- Date: Mon, 13 Sep 1999 12:44:52 -0700
- Cc: gdb AT sourceware.cygnus dot com, binutils AT sourceware.cygnus dot com, jimb AT cygnus dot com
- References: <990910221813.ZM20583@ocotillo.lan> <19990910234925.15322.qmail@daffy.airs.com>
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;