* Replacement for the .stabs directive
@ 2016-08-19 19:55 Umesh Kalappa
2016-08-24 21:56 ` Jim Wilson
0 siblings, 1 reply; 3+ messages in thread
From: Umesh Kalappa @ 2016-08-19 19:55 UTC (permalink / raw)
To: LLVM Developers Mailing List, gcc, eager, Binutils
Hello Everyone ,
We have the legacy code ,that uses the .stabs directive quiet often
in the source code like
.stabs "symbol_name", 100, 0, 0, 0 + .label_one f;
.label_one
stmt
and ,the above code is wrapped with the inline asm in the c source file .
we are using clang 3.8(with lto) and as you know that builtin
assembler / MC streamer don't have support fir .stabs directive.
we are looking to emulate the above .stabs semantic i.e associative
the label_one address with "symbol_name" ,by dwarf or any gas
directives .
Any suggestions,how we can achieve that ?
Thank you
~Umesh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Replacement for the .stabs directive
2016-08-19 19:55 Replacement for the .stabs directive Umesh Kalappa
@ 2016-08-24 21:56 ` Jim Wilson
2016-08-29 23:31 ` Michael Eager
0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2016-08-24 21:56 UTC (permalink / raw)
To: Umesh Kalappa, LLVM Developers Mailing List, gcc, eager, Binutils
On 08/19/2016 12:55 PM, Umesh Kalappa via llvm-dev wrote:
> We have the legacy code ,that uses the .stabs directive quiet often
> in the source code like
>
> .stabs "symbol_name", 100, 0, 0, 0 + .label_one f;
>
> .label_one
> stmt
> and ,the above code is wrapped with the inline asm in the c source file .
Presumably the ".label_one f" is actually "1f" and the ".label_one" is
"1:". That would make more sense, as this is a use of the GNU as local
label feature.
Unfortunately, there is no easy to do this in dwarf, as dwarf debug info
is split across multiple sections and encoded. Maybe this could work if
you handled it like a comdat symbol, but that would be inconvenient, and
might not even work. This seems like a option not worth pursuing.
The fact that this worked for stabs is more accident by design. The
code never should have been written this way in the first place.
You can make the association between a symbol name and an address by
using an equivalence. E.g. you could do
asm ("symbol_name = 1f");
but this puts the symbol_name in the symbol table, which works only if
symbol_name is unique or maybe unique within its scope if function
local. If the name was unique, you probably wouldn't have used the ugly
stabs trick in the first place, so this might not work. If the symbol
names aren't unique, maybe you can change the code to make them unique?
Using an equivalence gives the same effective result as using
symbol_name: stmt
Jim
PS Cross posting like this is discouraged. I would suggest just asking
assembler questions on the binutils list.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Replacement for the .stabs directive
2016-08-24 21:56 ` Jim Wilson
@ 2016-08-29 23:31 ` Michael Eager
0 siblings, 0 replies; 3+ messages in thread
From: Michael Eager @ 2016-08-29 23:31 UTC (permalink / raw)
To: Jim Wilson, Umesh Kalappa, eager, Binutils
On 08/24/2016 02:56 PM, Jim Wilson wrote:
> On 08/19/2016 12:55 PM, Umesh Kalappa via llvm-dev wrote:
>> We have the legacy code ,that uses the .stabs directive quiet often
>> in the source code like
>>
>> .stabs "symbol_name", 100, 0, 0, 0 + .label_one f;
>>
>> .label_one
>> stmt
>> and ,the above code is wrapped with the inline asm in the c source file .
>
> Presumably the ".label_one f" is actually "1f" and the ".label_one" is "1:". That would make more
> sense, as this is a use of the GNU as local label feature.
>
> Unfortunately, there is no easy to do this in dwarf, as dwarf debug info is split across multiple
> sections and encoded. Maybe this could work if you handled it like a comdat symbol, but that would
> be inconvenient, and might not even work. This seems like a option not worth pursuing.
>
> The fact that this worked for stabs is more accident by design. The code never should have been
> written this way in the first place.
>
> You can make the association between a symbol name and an address by using an equivalence. E.g. you
> could do
> asm ("symbol_name = 1f");
> but this puts the symbol_name in the symbol table, which works only if symbol_name is unique or
> maybe unique within its scope if function local. If the name was unique, you probably wouldn't have
> used the ugly stabs trick in the first place, so this might not work. If the symbol names aren't
> unique, maybe you can change the code to make them unique? Using an equivalence gives the same
> effective result as using
> symbol_name: stmt
>
> Jim
>
> PS Cross posting like this is discouraged. I would suggest just asking assembler questions on the
> binutils list.
Trimming the CC list, as Jim suggested.
Umesh --
I'm not sure I understand what you are trying to do.
If you want a code label to be described in DWARF, you can create a DIE:
DW_TAG_label
DW_AT_name "symbol_name"
DW_AT_low_pc .label_one
See DWARF Ver. 4 standard, section 3.5.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-29 23:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19 19:55 Replacement for the .stabs directive Umesh Kalappa
2016-08-24 21:56 ` Jim Wilson
2016-08-29 23:31 ` Michael Eager
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).