[LLVMdev] need to access static functions as extern

dan mihai dnmh68 at hotmail.com
Thu Oct 22 15:35:01 PDT 2009


It is in a bitcode module.
What I do and seems to work is change the linkage to external:
  F.setLinkage(llvm::GlobalValue::ExternalLinkage);
However I do not understand all the implications of this.
It looks like the name is mangled, probably unique. Is this correct?
If so, it might be OK to simply change the linkage ...

Dan

> Date: Thu, 22 Oct 2009 13:59:13 -0500
> Subject: Re: [LLVMdev] need to access static functions as extern
> From: kennethuil at gmail.com
> To: dnmh68 at hotmail.com
> 
> On Thu, Oct 22, 2009 at 1:52 PM, dan mihai <dnmh68 at hotmail.com> wrote:
> > Hello,
> >
> > I write some instrumentation which needs to call static function from other
> > files.
> > Is there a way to associate a global name/alias to a static function?
> >
> > I need to turn the assembly code
> >     .align    16
> >     .type    some_static.2467, at function
> > some_static.2467:
> >     CODE
> >
> >
> >
> > into
> >
> >     .align    16
> >     .type    some_static.2467, at function
> > some_static.2467:
> >     .align    16
> >     .globl    some_extern_alias.2467
> >     .type    some_extern_alias.2467, at function
> > some_extern_alias.2467:
> >      CODE
> >
> >
> > and now I can call some_extern_alias.2467
> > Is there a way to perform this automatically in llvm?
> >
> > Thank you,
> > Dan
> 
> Perhaps.  Is this static function in a bitcode module or in native form?
> 
> If it's in bitcode, you can always add a public function to that
> bitcode module that just calls the static function.
 		 	   		  
_________________________________________________________________
Windows 7: It helps you do more. Explore Windows 7.
http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen3:102009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091022/354ddcab/attachment.html>


More information about the llvm-dev mailing list