llvmcpy icon indicating copy to clipboard operation
llvmcpy copied to clipboard

Native target initialisation functions are missing

Open aurorusidk opened this issue 1 year ago • 1 comments
trafficstars

The set of functions LLVMInitializeNative* and LLVMInitializeAll* do not appear to exist in the bindings.

A typical LLVM-C program might include the following lines to automatically configure for the current host:

LLVMInitializeNativeTarget();
LLVMInitializeNativeAsmParser();
LLVMInitializeNativeAsmPrinter();

Searching the module showed no results for the expected bound names (llvm.initialize_native_target(), etc.), however, the target specific functions are loaded correctly (e.g., llvm.initialize_x86_target() and llvm.initialize_riscv_target()).

I believe this may be because the functions are defined in Target.h as static, and therefore presumably being omitted.

aurorusidk avatar Aug 26 '24 13:08 aurorusidk

I'm afraid we can't provide access to those. They are not not public symbols in the shared libraries provided by LLVM libraries.

You can check out the available LLVMInitialize* symbols with the following script:

for LIBRARY in libLLVM*.so; do
    readelf -s --dyn-syms "$LIBRARY" | grep '\bLLVMInitialize'
done | awk '{ print $8 }' | sort -u

They are designed to be embedded in the user of the LLVM C API. However, we don't compile any header! I'm afraid that the we either reimplement those functions in Python or we need to get upstream to fix it.

aleclearmind avatar Feb 13 '25 09:02 aleclearmind