0

I am using llvm-opt to optimize bitcode which is then compiled to machine code, after which the .text section of the resulting object file is copied to an existing binary. This means that the PLT is not available, thus the bitcode should not contain any calls to external functions (since their PLT entries will be invalidated after the copy). However, llvm is inserting intrinsics during optimization that the backend is filling in with calls to external functions. E.g., memcpy/memset intrinsics result in calls to memcpy/memset from the standard library. Is there some way to stop llvm-opt from creating these intrinsics?

taddeus
  • 102
  • 3
  • I have used my existing opt pass to replace the memcpy/memset intrinsics with calls or routines of my own. Hmm. Prior to running your pass, you could llvm-link in another bitcode file with a memcpy/memset that are forced inline. You might be able to workaround that way. – Brian Aug 05 '16 at 12:22
  • Yeah this was my first thought as well, it's I just that I have very little time to implement this because of a deadline, so I was wondering if I could set some flag that is passed to codegen / opt. I also just noticed that the function call is only generated in some cases, but not in others. For example, a memset with constant args will translate into some immediate `mov` instructions for efficiency, which is a lot of work to replicate in custom linked helpers. – taddeus Aug 05 '16 at 14:45

0 Answers0