[LLVMdev] [llvm-c] Proposal: Make LLVMInitializeNativeTarget and co. non-inline

Moritz Maxeiner moritzmaxeiner at googlemail.com
Mon Feb 18 06:49:15 PST 2013


Hi,

when building llvm as a shared library LLVMInitializeNativeTarget and co.
(located in llvm/Support/TargetSelect) will not get
exported as symbol into the shared library, because they are static inline.
Since they are functions defined in the C API no one else inside LLVM 
calls them,
which results in them not being exported.

This is, of course, no problem for C programs using the C API, because 
they get
these functions by simply doing #include on the headers; but for Non-C 
languages,
that are C compatible and want to use LLVM via the C API that is a problem,
because there's no way for them to get at these functions (other than
to write additional C code, which is not always desired).

Since LLVMInitializeNativeTarget and co. are functions in the C API,
do not get called by other LLVM functions and will likely be called
by user code only once at startup, there does not seem to be a fundamental
need for them to be inlined.

This is why I propose to make them non-inline, normal functions that
get declared in their current header and defined in lib/IR/Core.cpp.

The list of functions affected by this is:
void llvm::InitializeAllTargetInfos ()
void llvm::InitializeAllTargets ()
void llvm::InitializeAllTargetMCs ()
void llvm::InitializeAllAsmPrinters ()
void llvm::InitializeAllAsmParsers ()
void llvm::InitializeAllDisassemblers ()
bool llvm::InitializeNativeTarget ()
bool llvm::InitializeNativeTargetAsmPrinter ()
bool llvm::InitializeNativeTargetAsmParser ()
bool llvm::InitializeNativeTargetDisassembler ()



More information about the llvm-dev mailing list