[llvm-dev] LTO prevention help
Jon Slenk via llvm-dev
llvm-dev at lists.llvm.org
Wed Oct 12 17:48:29 PDT 2016
I'm trying to learn about LTO. I have a static variable that I try to give
a non-compile-time-constant value to. With LTO turned off, the sprintf
happens i.e. a breakpoint set on that line does get triggered. With LTO
turned on (either Monolithic or Incremental), the code appears to be
removed/elided/deleted/forgotten/dropped/lost/ignored and the breakpoint is
never tripped.
What can I do to make my code survive through LTO? The variable makes it
through but the sprinf() line doesn't. Can I somehow tell LTO to not apply
to this function or line of code or file of code? (In reality this is
something I am trying to do via Xcode for iOS targets.)
thank you.
1. static void __attribute__((constructor))_initv1 () {
2. static char default_[] =
"0000000000000000000000000000000000000000000000000000000000000000";
3. sprintf( default_, "%lu", (unsigned long)5 );
4. }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161012/2aad0472/attachment.html>
More information about the llvm-dev
mailing list