[cfe-users] Linker Stripping

Xin Tong trent.tong at gmail.com
Mon Oct 14 05:26:51 PDT 2013


See answers below.


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

>  > some of my functions which are not used in the final
>
> > executable are optimized away by the clang++ linker.
>
> > Is there any way to prevent clang++ to strip away
>
> > these functions ?
>
>
>
> The obvious question first: why is this a problem? If they are not used,
> why do you need them?
>

I want to pass them to libraries later loaded into the application.


>
>
> An easy way to keep them around is to create a reference to them, so that
> they are "used"
>
> in some way. Calls to them, or pointers to them stored in globals, should
> do the trick.
>

If the global is not used, would the linker be able to optimize the global
out and in turn optimize the function out again ?

Thank you

Trent
 

>
>
> --
>
> 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/c74af40b/attachment.html>


More information about the cfe-users mailing list