dotnet / LLVMSharp

LLVM bindings for .NET Standard written in C# using ClangSharp
MIT License
838 stars 95 forks source link

Initialize All and Initialize Native Functions Not Found #210

Closed charleyah closed 1 year ago

charleyah commented 1 year ago

While using LLVMSharp 5.0.0 from Nuget on Windows, I noticed a minor issue where none of the InitializeAll and InitializeNative entry points can be found in libLLVM. I say minor as the Initialize functions for specific targets works fine as a workaround.

After a export dump of libLLVM.dll I found InitializeAll and InitializeNative functions have leading underscores which don't match the specified EntryPoints in the bindings.

As these function names seem to be inconsistent with all other exported functions this looks like an issue for LLVM-C rather than a LLVMSharp, but as I found it using LLVMSharp I'll raise it here first incase the solution is to just update the bindings. I haven't confirmed if other bindings have a similar issue.

X86 Initialize Functions (for reference)

    600  257 00FCD330 LLVMInitializeX86AsmParser
    601  258 00FD6750 LLVMInitializeX86AsmPrinter
    602  259 0114B2E0 LLVMInitializeX86Disassembler
    603  25A 00FD40C0 LLVMInitializeX86Target
    604  25B 0114DAC0 LLVMInitializeX86TargetInfo
    605  25C 0113EAA0 LLVMInitializeX86TargetMC

InitializeAll Functions

    527  20E 00069340 LLVMInitializeAllAsmParsers_
    528  20F 000692F0 LLVMInitializeAllAsmPrinters_
    529  210 00069380 LLVMInitializeAllDisassemblers_
    530  211 00069200 LLVMInitializeAllTargetInfos_
    531  212 000692A0 LLVMInitializeAllTargetMCs_
    532  213 00069250 LLVMInitializeAllTargets_

InitializeNative Functions

    573  23C 000693F0 LLVMInitializeNativeAsmParser_
    574  23D 00069400 LLVMInitializeNativeAsmPrinter_
    575  23E 00069410 LLVMInitializeNativeDisassembler_
    576  23F 000693D0 LLVMInitializeNativeTarget_
charleyah commented 1 year ago

closing as not an issue in pre-release v15.0.0-beta1.