[LLVMdev] Copy function pointer contents (original) (raw)

Tim Northover t.p.northover at gmail.com
Tue Oct 21 09:42:40 PDT 2014


My first experiments shew that it works but I'd like to know it could have any side effects?

I'd be very worried about doing that. For an isolated function with no external references, and referenced by nothing externally, you might get away with it (make sure it's compiled PIC!). But outside those bounds, all kinds of things could go wrong:

My goal is to delete a finalized module and just keep the copyed function (to decrease the memory use)

I think you should be able to just keep the output around and delete the input Module & associated compile-time data. That's a large part of what the various MemoryManagers are there to handle, I think.

Cheers.

Tim.



More information about the llvm-dev mailing list