Obtaining current address for .stabs

Daniel Jacobowitz drow@mvista.com
Mon Mar 4 12:11:00 GMT 2002


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



More information about the Binutils mailing list