[cfe-users] Linker Stripping

Xin Tong trent.tong at gmail.com
Mon Oct 14 05:42:29 PDT 2013


On Mon, Oct 14, 2013 at 9:36 PM, Dallman, John <john.dallman at siemens.com>wrote:

>  > I want to pass them to libraries later loaded into the application.
>
>
>
> > If the global is not used, would the linker be able to optimize
>
> > the global out and in turn optimize the function out again ?
>
>
>
> Potentially, but the fix is fairly simple. Create a global that holds
> pointers to the functions. Have the
>
> code that wants to pass pointers to those functions read the pointers from
> that global.
>
>
>
> However, this begs the question of why the part of your code that
> currently tries to pass the function
>
> pointers isn't being recognised as referring to the functions in question.
> How does that code work?
>

Ok this is the whole story. These *unused* functions are defined in LLVM
lli. and they are referenced in the bitcode lli is interpreting/JITting.
the bitcode expects lli to able to resolve these functions at JIT time.
 basically, the bitcode is somewhat like libraries loaded into the lli
application. However, the linker optimized these functions out because it
sees no invocation of them in the final executable.


>
>
> --
>
> John Dallman
>
>
>
> -----------------
> Siemens Industry Software Limited is a limited company registered in
> England and Wales.
> Registered number: 3476850.
> Registered office: Faraday House, Sir William Siemens Square, Frimley,
> Surrey, GU16 8QD.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20131014/b256e888/attachment.html>


More information about the cfe-users mailing list