FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mangling

 
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries
View previous topic :: View next topic  
Author Message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Sun May 28, 2006 1:08 am    Post subject: Mangling Reply with quote

I'm trying to do some mangling/demangling stuff, but I wonder how to make the correct decisions. In libphobos.a, you have two versions of the std.stdio.writefln symbol:

_D3std5stdio8writeflnFYv
_D3std5stdio9fwriteflnFPS3std1c5stdio6_iobufYv

Using ddl.Mangle.mangleNamespace on std.stdio.writefln gives me

3std5stdio8writefln

I think it should have _D in front too, but it still won't match with any of those above. I haven't tried demangling yet, how am I supposed to look up the right symbol? I'm not sure it is any point in caring about the last part, as the symbol table only points to the module in any case. Any thoughts?

It's for "lazy" loading of .a files, btw ...
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Mon May 29, 2006 7:17 am    Post subject: Re: Mangling Reply with quote

larsivi wrote:
I'm trying to do some mangling/demangling stuff, but I wonder how to make the correct decisions. In libphobos.a, you have two versions of the std.stdio.writefln symbol:

_D3std5stdio8writeflnFYv
_D3std5stdio9fwriteflnFPS3std1c5stdio6_iobufYv

Using ddl.Mangle.mangleNamespace on std.stdio.writefln gives me

3std5stdio8writefln

I think it should have _D in front too, but it still won't match with any of those above.


Lars, the process for getRawNamespace() hasn't been 100? nailed down yet, so by all means, improve it if you think it'll work better a different way. Smile

The idea behind it is to provide an easy way to determine if a symbol belongs to a particular module. So keeping the _D prefix might be a good idea, as it'll make symbol namespace comparisons much easier.

Quote:
I haven't tried demangling yet, how am I supposed to look up the right symbol? I'm not sure it is any point in caring about the last part, as the symbol table only points to the module in any case. Any thoughts?

It's for "lazy" loading of .a files, btw ...


As far as getRawNamespace() and looking up the right symbol, you may want to use the first defined moduleInfo symbol/instance within the module as a clear indicator as to what the module namespace actually is. Offhand, I don't know if ELF specifies what the 'name' of the module is like OMF, but if not, then just rely on the moduleInfo.

Of course this leaves the case where .c modules don't conform to the D namespace. In such a case, you should probably have getRawNamespace() reutrn "" so that the linker has a clear signal that the module has no discernable D namespace.

PS, I got h3r3tic's message, but dsource is being wierd about posting stuff. I'm going to run DDL against the latest compiler soon.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group