This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Obtaining current address for .stabs
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: John Levon <levon at movementarian dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 4 Mar 2002 15:11:24 -0500
- Subject: Re: Obtaining current address for .stabs
- References: <20020304025202.GA22758@compsoc.man.ac.uk>
On Mon, Mar 04, 2002 at 02:52:02AM +0000, John Levon wrote:
>
> I need to manually code some .stabs data via inline asm with gcc.
Why? Why, God, why?
Stabs does not have any support for multiple sections. Anything
working is a bit of luck. Use DWARF-2 and address ranges (which you
are not going to be able to do in inline assembly.).
> root linux 174 uname -a
> Linux nastic 2.4.17rmap9smp #6 SMP Sat Mar 2 17:52:39 GMT 2002 i686
> unknown
> root linux 175 as --version
> GNU assembler 2.10.90
>
>
> My original code looked like this :
>
> #define __stabs_text_lock_asm(l) \
> ".section .text.lock,\"ax\"\n" \
> ".stabs \"" __FILE__ "\",100,0,0,.\n" \
> ".stabs " "\"text_lock_" #l \
> " at " __FILE__ \
> " line " __STRINGIFY(__LINE__) \
> ":F(0,20)\",36,0,0,. \n" \
> ".previous\n"
>
> Now this is inserted before linux kernel code that generates actual
> code in the .text.lock section.
You're being very complicated here. Why mess with sections? .stabs do
not generate code; put them interspersed with .text. Have them
reference a symbol declared in .text.lock in the following code. What
happens then?
You may need an empty (ending) N_FUN stab if you don't want the linker
to mangle you later.
> given the differences, it seems that the .stabs data (which ends up in
> .stab and .stabstr) is advancing the location counter, even though it
> ends up automagically in a different section. For example it looks like
> 12 is added on for every file (100) entry, and 8 for every normal
> function (36) entry.
Conclusion here is almost certainly wrong.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer