Reputation: 7699
Say a function f_a
in module m_a
calls another function f_b
in module m_b
. This is the only reference across module m_a
. Now, I'd like to make module m_a
self-contained, i.e. eliminate references to the other module. However, module m_b
is very large in size. (In this case it contains all maths functions in fast/accurate and single/double implementation). Is there a way to only add function f_b
to module m_a
using LLVM C++ API? Or do I have to use the linker API and merge the whole module m_b
into m_a
?
Upvotes: 1
Views: 149
Reputation: 7600
In general you need the linker, the function in module b could use variables only declared there and other functions there, you should inspect the code to be able to do that for a generic function. The linker would be the solution that would work in every case.
Upvotes: 1
Reputation: 17415
Use a text editor and cut'n'paste the function to the target module. If you link the whole m_b, the linker should still be able to detect that large parts of it aren't used and discard them when creating the final executable. What exactly is the issue you are trying to solve?
Upvotes: 1