Hi,
Yeah, the problem with the bitcode file generation is that Clang does not store LLVM IR function declarations if they are not really used, i.e. if these functions are not invoked inside the library.
Here are a couple possible work-arounds:


You could add some empty bodies to your function declarations just to make Clang emit them into the BC file. Then, you can add some code at the very beginning of the your LLVMIRGen to remove the bodies from such functions (maybe based on their names or naming convention). This way they become declarations of external functions. Your code will compile just fine and you’ll be able to link them against the actual implementations from your GCC-compiled libraries.


Alternatively, you could at the very beginning of the your LLVMIRGen add the code to create declarations of your external functions using LLVM APIs for creating functions. The rest should just work.


Please let me know if these solutions would work for you.