aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-jitlink
AgeCommit message (Collapse)AuthorFilesLines
20 hours[Support] Deprecate one form of support::endian::byte_swap (NFC) (#161045)Kazu Hirata1-4/+4
This is a follow-up to #156140 and #160979, which deprecated one form of write and read, respectively. We have two forms of byte_swap: template <typename value_type> [[nodiscard]] inline value_type byte_swap(value_type value, endianness endian) template <typename value_type, endianness endian> [[nodiscard]] inline value_type byte_swap(value_type value) The difference is that endian is a function parameter in the former but a template parameter in the latter. This patch streamlines the code by migrating the use of the latter to the former while deprecating the latter because the latter is just forwarded to the former.
2025-09-09MC: Use Triple form of lookupTarget in more places (#157591)Matt Arsenault1-17/+16
2025-09-08MC: Add Triple overloads for more MC constructors (#157321)Matt Arsenault1-3/+3
Avoids more Triple->string->Triple round trip. This is a continuation of f137c3d592e96330e450a8fd63ef7e8877fc1908
2025-08-20[NFC][CMake] quote ${CMAKE_SYSTEM_NAME} consistently (#154537)David Tenty1-2/+2
A CMake change included in CMake 4.0 makes `AIX` into a variable (similar to `APPLE`, etc.) https://gitlab.kitware.com/cmake/cmake/-/commit/ff03db6657c38c8cf992877ea66174c33d0bcb0b However, `${CMAKE_SYSTEM_NAME}` unfortunately also expands exactly to `AIX` and `if` auto-expands variable names in CMake. That means you get a double expansion if you write: `if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")` which becomes: `if (AIX MATCHES "AIX")` which is as if you wrote: `if (ON MATCHES "AIX")` You can prevent this by quoting the expansion of "${CMAKE_SYSTEM_NAME}", due to policy [CMP0054](https://cmake.org/cmake/help/latest/policy/CMP0054.html#policy:CMP0054) which is on by default in 4.0+. Most of the LLVM CMake already does this, but this PR fixes the remaining cases where we do not.
2025-06-26[ORC] Extract MemoryAccess from ExecutorProcessControl, break up header. ↵Lang Hames1-0/+1
(#145671) This moves the MemoryAccess interface out of the ExecutorProcessControl class and splits implementation classes InProcessMemoryManager and SelfExecutorProcessControl out of ExecutorProcessControl.h and into their own headers.
2025-06-18[llvm] explicitly link llvm-jitlink-executor with ExecutionEngine (#144778)Andrew Rogers1-0/+1
## Overview Explicitly link `llvm-jitlink-executor` with `ExecutionEngine` to avoid link failures when building LLVM as a Windows DLL. This link dependency should probably have always been declared here, but didn't matter when building against an LLVM static library because it was (presumably) picked up as a transitive dependency. This change is required to enable the Windows DLL build because `llvm-jitlink-executor` is declared using `add_llvm_utility` which invokes `add_llvm_executable` with [`DISABLE_LLVM_LINK_LLVM_DYLIB`](https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/AddLLVM.cmake#L500-L502) so it links statically against its dependencies instead of against the main LLVM library. ## Background The effort to support building LLVM as a Windows DLL is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307).
2025-05-29[ORC] Remove an unused header. NFC.Lang Hames1-1/+0
2025-05-27[ORC] Refactor visit-members in StaticLibraryDefinitionGenerator. (#141546)Lang Hames2-3/+22
This refactor was motivated by two bugs identified in out-of-tree builds: 1. Some implementations of the VisitMembersFunction type (often used to implement special loading semantics, e.g. -all_load or -ObjC) were assuming that buffers for archive members were null-terminated, which they are not in general. This was triggering occasional assertions. 2. Archives may include multiple members with the same file name, e.g. when constructed by appending files with the same name: % llvm-ar crs libfoo.a foo.o % llvm-ar q libfoo.a foo.o % llvm-ar t libfoo.a foo.o foo.o While confusing, these members may be safe to link (provided that they're individually valid and don't define duplicate symbols). In ORC however, the archive member name may be used to construct an ORC initializer symbol, which must also be unique. In that case the duplicate member names lead to a duplicate definition error even if the members define unrelated symbols. In addition to these bugs, StaticLibraryDefinitionGenerator had grown a collection of all member buffers (ObjectFilesMap), a BumpPtrAllocator that was redundantly storing synthesized archive member names (these are copied into the MemoryBuffers created for each Object, but were never freed in the allocator), and a set of COFF-specific import files. To fix the bugs above and simplify StaticLibraryDefinitionGenerator this patch makes the following changes: 1. StaticLibraryDefinitionGenerator::VisitMembersFunction is generalized to take a reference to the containing archive, and the index of the member within the archive. It now returns an Expected<bool> indicating whether the member visited should be treated as loadable, not loadable, or as invalidating the entire archive. 2. A static StaticLibraryDefinitionGenerator::createMemberBuffer method is added which creates MemoryBuffers with unique names of the form `<archive-name>[<index>](<member-name>)`. This defers construction of member names until they're loaded, allowing the BumpPtrAllocator (with its redundant name storage) to be removed. 3. The ObjectFilesMap (symbol name -> memory-buffer-ref) is replaced with a SymbolToMemberIndexMap (symbol name -> index) which should be smaller and faster to construct. 4. The 'loadability' result from VisitMemberFunctions is now taken into consideration when building the SymbolToMemberIndexMap so that members that have already been loaded / filtered out can be skipped, and do not take up any ongoing space. 5. The COFF ImportedDynamicLibraries member is moved out into the COFFImportFileScanner utility, which can be used as a VisitMemberFunction. This fixes the bugs described above; and should lower memory consumption slightly, especially for archives with many files and / or symbol where most files are eventually loaded.
2025-05-20Revert "[llvm][NFC] Use `llvm::sort()`" (#140668)Iris Shi1-3/+4
2025-05-17[llvm][NFC] Use `llvm::sort()` (#140335)Iris Shi1-4/+3
2025-05-15[llvm-jitlink] Use std::optional::value_or (NFC) (#140173)Kazu Hirata1-1/+1
2025-04-16[llvm] Use llvm::append_range (NFC) (#136066)Kazu Hirata1-1/+1
This patch replaces: llvm::copy(Src, std::back_inserter(Dst)); with: llvm::append_range(Dst, Src); for breavity. One side benefit is that llvm::append_range eventually calls llvm::SmallVector::reserve if Dst is of llvm::SmallVector.
2025-03-12[ORC] Drop EHFrameRegistrar, register eh-frames with AllocActions (#130719)Lang Hames2-9/+6
This simplifies resource management, and should improve performance for most use cases.
2025-03-09[llvm-jitlink] Avoid repeated hash lookups (NFC) (#130465)Kazu Hirata1-2/+3
2025-03-06[llvm-jitlink] Avoid repeated hash lookups (NFC) (#129993)Kazu Hirata1-2/+3
2025-03-03[NFC]Make file-local cl::opt global variables static (#126486)chrisPyr1-3/+3
#125983
2025-03-02[llvm-jitlink] Avoid repeated hash lookups (NFC) (#129422)Kazu Hirata1-2/+2
2025-02-25[ORC][llvm-jitlink] Extend weak-linking emulation to real dylibs.Lang Hames1-16/+14
Commit 253e11695ba added support for emulating weak-linking against dylibs that are (under the emulation) absent at runtime. This commit extends emulated weak linking support to allow a real dylib to supply the interface (i.e. -weak-lx / -weak_library can be pointed at a dylib, in which case they should be read as "weak-link against this dylib, behavining as if it weren't actually present at runtime").
2025-02-25[ORC][llvm-jitlink] Add support for emulating ld64 -weak-lx / -weak_library.Lang Hames1-1/+91
Linking libraries in ld64 with -weak-lx / -weak_library causes all references to symbols in those libraries to be made weak, allowing the librarie to be missing at runtime. This patch extends EPCDynamicLibrarySearchGenerator with support for emulating this behavior: If an instance is constructed with an Allow predicate but no dylib handle then all symbols matching the predicate are immediately resolved to null. The llvm-jitlink tool is updated with -weak-lx / -weak_library options for testing. Unlike their ld64 counterparts these options take a TBD file as input, and always resolve all exports in the TBD file to null.
2025-02-23[llvm-jitlink] Avoid repeated hash lookups (NFC) (#128399)Kazu Hirata1-2/+3
2025-02-23[llvm-jitlink] Only use candidate library extensions during library search.Lang Hames1-6/+6
While processing library link options that check search paths (-lx, -hidden-lx, etc.) we shouldn't generate candidate paths with extensions that are invalid for the option being visited (e.g. -hidden-lx only applies to archives, so we shouldn't generate candidates with `.so` extensions). Note: Candidate extensions should probably be further filtered based on the OS of the executing process. This patch is a step in the right direction though.
2025-02-21[llvm-jitlink] Apply symbol scope modifiers explicitly for -hidden-lx.Lang Hames2-5/+22
We had been abusing the setOverrideObjectFlagsWithResponsibilityFlags method to do this. Handling it explicitly ensures that flags are only modified on the intended files, and not accedintally modified elsewhere.
2025-02-14Revert "[llvm-jitlink] Explicit exports for builtin runtime functions in ↵dyung1-27/+0
MinGW executables" (#127297) Reverts llvm/llvm-project#107375 This was causing a build bot failure (https://lab.llvm.org/buildbot/#/builders/201/builds/2954) and also breaks building with VS2019. See https://github.com/llvm/llvm-project/pull/107375#issuecomment-2660709198 for details.
2025-02-14[llvm-jitlink] Explicit exports for builtin runtime functions in MinGW ↵Stefan Gränitz1-0/+27
executables (#107375) Use explicit exports to fix the symbol resolution part of https://github.com/llvm/llvm-project/issues/98714 in MinGW
2025-02-12[ORC] Switch to singleton pattern for UnwindInfoManager. (#126691)Lang Hames2-0/+19
The find-dynamic-unwind-info callback registration APIs in libunwind limit the number of callbacks that can be registered. If we use multiple UnwindInfoManager instances, each with their own own callback function (as was the case prior to this patch) we can quickly exceed this limit (see https://github.com/llvm/llvm-project/issues/126611). This patch updates the UnwindInfoManager class to use a singleton pattern, with the single instance shared between all LLVM JITs in the process. This change does _not_ apply to compact unwind info registered through the ORC runtime (which currently installs its own callbacks). As a bonus this change eliminates the need to load an IR "bouncer" module to supply the unique callback for each instance, so support for compact-unwind can be extended to the llvm-jitlink tools (which does not support adding IR).
2025-02-07[ORC] Force eh-frame use for older Darwins on x86-64 in MachOPlatform, LLJIT.Lang Hames1-0/+3
The system libunwind on older Darwins does not support JIT registration of compact-unwind. Since the CompactUnwindManager utility discards redundant eh-frame FDEs by default we need to remove the compact-unwind section first when targeting older libunwinds in order to preserve eh-frames. While LLJIT was already doing this as of eae6d6d18bd, MachOPlatform was not. This was causing buildbot failures in the ORC runtime (e.g. in https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/3479/). This patch updates both LLJIT and MachOPlatform to check a bootstrap value, "darwin-use-ehframes-only", to determine whether to forcibly preserve eh-frame sections. If this value is present and set to true then compact-unwind sections will be discarded, causing eh-frames to be preserved. If the value is absent or set to false then compact-unwind will be used and redundant FDEs in eh-frames discarded (FDEs that are needed by the compact-unwind section are always preserved). rdar://143895614
2025-01-20[ORC] Move EHFrameRegistrationPlugin into its own header + source file. NFC.Lang Hames1-0/+1
2025-01-10Reapply "[ORC][llvm-jitlink] Add SimpleLazyReexportsSpeculator..." with fixes.Lang Hames2-14/+149
This reapplies 6d72bf47606, which was reverted in 57447d3ddf to investigate build failures, e.g. https://lab.llvm.org/buildbot/#/builders/3/builds/10114. The original patch contained an invalid unused friend declaration of std::make_shared. This has been removed.
2025-01-10Revert "[ORC][llvm-jitlink] Add SimpleLazyReexportsSpeculator, use in ↵Lang Hames2-149/+14
llvm-jitlink." This reverts commit 6d72bf47606c2a288b911d682fd96129c9c1466d while I fix bot failures.
2025-01-10[ORC][llvm-jitlink] Add SimpleLazyReexportsSpeculator, use in llvm-jitlink.Lang Hames2-14/+149
Also adds a new IdleTask type and updates DynamicThreadPoolTaskDispatcher to schedule IdleTasks whenever the total number of threads running is less than the maximum number of MaterializationThreads. A SimpleLazyReexportsSpeculator instance maintains a list of speculation suggestions ((JITDylib, Function) pairs) and registered lazy reexports. When speculation opportunities are available (having been added via addSpeculationSuggestions or when lazy reexports were created) it schedules an IdleTask that triggers the next speculative lookup as soon as resources are available. Speculation suggestions are processed first, followed by lookups for lazy reexport bodies. A callback can be registered at object construction time to record lazy reexport executions as they happen, and these executions can be fed back into the speculator as suggestions on subsequent executions. The llvm-jitlink tool is updated to support speculation when lazy linking is used via three new arguments: -speculate=[none|simple] : When the 'simple' value is specified a SimpleLazyReexportsSpeculator instances is used for speculation. -speculate-order <path> : Specifies a path to a CSV containing (jit dylib name, function name) triples to use as speculative suggestions in the current run. -record-lazy-execs <path> : Specifies a path in which to record lazy function executions as a CSV of (jit dylib name, function name) pairs, suitable for use with -speculate-order. The same path can be passed to -speculate-order and -record-lazy-execs, in which case the file will be overwritten at the end of the execution. No testcase yet: Speculative linking is difficult to test (since by definition execution behavior should be unaffected by speculation) and this is an new prototype of the concept*. Tests will be added in the future once the interface and behavior settle down. * An earlier implementation of the speculation concept can be found in llvm/include/llvm/ExecutionEngine/Orc/Speculation.h. Both systems have the same goal (hiding compilation latency) but different mechanisms. This patch relies entirely on information available in the controller, where the old system could receive additional information from the JIT'd runtime via callbacks. I aim to combine the two in the future, but want to gain more practical experience with speculation first.
2025-01-09[llvm-jitlink] Shut down the session on an error return path.Lang Hames1-0/+1
Ensures cleanup of task dispatcher threads. This may address some of the nondeterministic failures seen in llvm-jitlink regression tests recently.
2025-01-08[llvm-jitlink] Use -num-threads=0 for regression tests relying on debug output.Lang Hames1-0/+6
ORC and JITLink debugging output write the dbgs() raw_ostream, which isn't thread-safe. Use -num-threads=0 to force single-threaded linking for tests that produce debugging output. The llvm-jitlink tool is updated to suggest -num-threads=0 when debugging output is enabled.
2025-01-02[llvm-jitlink] Fix llvm-jitlink for LLVM_ENABLE_THREADS=Off.Lang Hames1-2/+16
Commit edca1d9bad2 enabled threaded linking by default in llvm-jitlink, but we need to handle the case where LLVM is built with -DLLVM_ENABLE_THREADS=Off. This patch updates the llvm-jitlink tool to switch back to materialization on the main thread (equivalent to llvm-jitlink -num-threads=0 ...) when LLVM is built without thread support.
2025-01-02"Reapply "[llvm-jitlink] Use concurrent linking by default." with more fixes.Lang Hames4-8/+54
This reapplies edca1d9bad2 which was reverted in 7ec139ad4bc due to bot failures. LocalDependencyPropagation.s is updated to use -num-threads=0 in order to avoid interleaving debugging output. ELFNixPlatform.h is updated to protect the deferred runtime function calls map during bootstrap.
2024-12-24Revert "Reapply "[llvm-jitlink] Use concurrent linking by default." with ↵NAKAMURA Takumi4-54/+8
fixes. (#120958)" Caused random failures. This reverts commit 93d4b1f7a72f366c1ea91b2d65991266053be8d9. (llvmorg-20-init-16299-g93d4b1f7a72f)
2024-12-24Reapply "[llvm-jitlink] Use concurrent linking by default." with fixes. ↵Lang Hames4-8/+54
(#120958) Reapplies commit edca1d9bad2 which was reverted in 34531cff638 while I investigated bot failures, (e.g. https://lab.llvm.org/buildbot/#/builders/137/builds/10791). Commit 158a60051d2 should address the -check failures on the bots, which were caused by checks running earlier under the concurrent linking scheme before all files referenced by the checks had been fully linked. This patch also fixes the -threads option failure by renaming the option to -num-threads to avoid clashing with the ThreadCount cl::opt variable defined in ThinLTOCodeGenerator.cpp.
2024-12-23[llvm-jitlink] Wait for reachable files to link before running checks.Lang Hames2-0/+27
ORC dependence tracking is fine-grained (i.e. per-symbol), however when running -check mode we want to wait for all links triggered by the entry point lookup to complete, regardless of whether the code / data in them is actually reachable from the entry point. This simplifies test-cases, since authors don't need to reason about per-symbol dependencies to know that additional files will be linked (if referenced transitively in any way from the test-case). The new Session::waitForFilesLinkedFromEntryPointFile utility does _not_ wait for lazily linked (-lazy) files. This will be used to fix buildbot errors caused by edca1d9bad2.
2024-12-23Revert "[llvm-jitlink] Use concurrent linking by default."Lang Hames5-55/+8
This reverts commit edca1d9bad2 while I investigate bot failures, e.g. https://lab.llvm.org/buildbot/#/builders/137/builds/10791.
2024-12-23[llvm-jitlink] Use concurrent linking by default.Lang Hames5-8/+55
Adds a -threads option to llvm-jitlink. By default llvm-jitlink will now use a DynamicThreadPoolTaskDispatcher with the number of materialization threads set to whatever is returned by std::hardware_concurrency(). This brings the default in-place linking behavior in line with the concurrent linking that is used for -oop-executor and -oop-executor-connect mode. In-place linking on the main thread can be forced by passing -threads=0.
2024-12-16[llvm-jitlink] Avoid some SymbolStringPtr copies.Lang Hames1-4/+3
2024-12-09Reapply "[ORC] Introduce LazyReexportsManager, ... (#118923)" with fixes.Lang Hames2-48/+28
This re-applies 570ecdcf8b4, which was reverted in 74e8a37ff32 due to bot failures. This commit renames sysv_resolve.cpp to resolve.cpp, which was the cause of the config errors.
2024-12-09Revert "Reapply "[ORC] Introduce LazyReexportsManager, … (#118923)" with ↵Lang Hames2-28/+48
fixes" This reverts commit 41652c6c92958a87b8505b9b1e6f008856e392ac while I investigate more bot failures.
2024-12-09Reapply "[ORC] Introduce LazyReexportsManager, … (#118923)" with fixesLang Hames2-48/+28
This reapplies 570ecdcf8b4, which was reverted in 6073dd923b8 due to bot failures. The test failures on Linux were fixed by: 1. Removing an overly restrictive assertion (query dependence on a symbol no longer implies a MaterializingInfo for that symbol) 2. Adding reentry and resolver files to the ORC runtime CMakeLists.txt for Linux. 3. Adding the __orc_rt_reentry -> __orc_rt_sysv_reentry alias to ELFNixPlatform.
2024-12-07Revert "[ORC] Introduce LazyReexportsManager, JITLinkTrampolines, … (#118923)"Lang Hames2-28/+48
This reverts commit 570ecdcf8b44aec853ce381a5f6b77222b041afa while I investigate bot failures, e.g. https://lab.llvm.org/buildbot/#/builders/17/builds/4446.
2024-12-07[ORC] Introduce LazyReexportsManager, JITLinkTrampolines, ORC-RT base… ↵Lang Hames2-48/+28
(#118923) …d reentry. These utilities provide new, more generic and easier to use support for lazy compilation in ORC. LazyReexportsManager is an alternative to LazyCallThroughManager. It takes requests for lazy re-entry points in the form of an alias map: lazy-reexports = { ( <entry point symbol #1>, <implementation symbol #1> ), ( <entry point symbol #2>, <implementation symbol #2> ), ... ( <entry point symbol #n>, <implementation symbol #n> ) } LazyReexportsManager then: 1. binds the entry points to the implementation names in an internal table. 2. creates a JIT re-entry trampoline for each entry point. 3. creates a redirectable symbol for each of the entry point name and binds redirectable symbol to the corresponding reentry trampoline. When an entry point symbol is first called at runtime (which may be on any thread of the JIT'd program) it will re-enter the JIT via the trampoline and trigger a lookup for the implementation symbol stored in LazyReexportsManager's internal table. When the lookup completes the entry point symbol will be updated (via the RedirectableSymbolManager) to point at the implementation symbol, and execution will proceed to the implementation symbol. Actual construction of the re-entry trampolines and redirectable symbols is delegated to an EmitTrampolines functor and the RedirectableSymbolsManager respectively. JITLinkReentryTrampolines.h provides a JITLink-based implementation of the EmitTrampolines functor. (AArch64 only in this patch, but other architectures will be added in the near future). Register state save and reentry functionality is added to the ORC runtime in the __orc_rt_sysv_resolve and __orc_rt_resolve_implementation functions (the latter is generic, the former will need custom implementations for each ABI and architecture to be supported, however this should be much less effort than the existing OrcABISupport approach, since the ORC runtime allows this code to be written as native assembly). The resulting system: 1. Works equally well for in-process and out-of-process JIT'd code. 2. Requires less boilerplate to set up. Given an ObjectLinkingLayer and PlatformJD (JITDylib containing the ORC runtime), setup is just: ```c++ auto RSMgr = JITLinkRedirectableSymbolManager::Create(OLL); if (!RSMgr) return RSMgr.takeError(); auto LRMgr = createJITLinkLazyReexportsManager(OLL, **RSMgr, PlatformJD); if (!LRMgr) return LRMgr.takeError(); ``` after which lazy reexports can be introduced with: ```c++ JD.define(lazyReexports(LRMgr, <alias map>)); ``` LazyObectLinkingLayer is updated to use this new method, but the LLVM-IR level CompileOnDemandLayer will continue to use LazyCallThroughManager and OrcABISupport until the new system supports a wider range of architectures and ABIs. The llvm-jitlink utility's -lazy option now uses the new scheme. Since it depends on the ORC runtime, the lazy-link.ll testcase and associated helpers are moved to the ORC runtime.
2024-12-06[JITLink] Switch to SymbolStringPtr for Symbol names (#115796)Jared Wyles2-23/+26
Use SymbolStringPtr for Symbol names in LinkGraph. This reduces string interning on the boundary between JITLink and ORC, and allows pointer comparisons (rather than string comparisons) between Symbol names. This should improve the performance and readability of code that bridges between JITLink and ORC (e.g. ObjectLinkingLayer and ObjectLinkingLayer::Plugins). To enable use of SymbolStringPtr a std::shared_ptr<SymbolStringPool> is added to LinkGraph and threaded through to its construction sites in LLVM and Bolt. All LinkGraphs that are to have symbol names compared by pointer equality must point to the same SymbolStringPool instance, which in ORC sessions should be the pool attached to the ExecutionSession. --------- Co-authored-by: Lang Hames <lhames@gmail.com>
2024-11-18[ORC] Add LazyObjectLinkingLayer, lazy-linking support to llvm-jitlink (#116002)Lang Hames2-14/+129
LazyObjectLinkingLayer can be used to add object files that will not be linked into the executor unless some function that they define is called at runtime. (References to data members defined by these objects will still trigger immediate linking) To implement lazy linking, LazyObjectLinkingLayer uses the lazyReexports utility to construct stubs for each function in a given object file, and an ObjectLinkingLayer::Plugin to rename the function bodies at link-time. (Data symbols are not renamed) The llvm-jitlink utility is extended with a -lazy option that can be passed before input files or archives to add them using the lazy linking layer rather than the base ObjectLinkingLayer.
2024-11-11[ORC] Move absoluteSymbols from Core.h to new AbsoluteSymbols.h header. NFC.Lang Hames1-0/+1
Continuing Core.h clean-up. If you see any errors about a missing absoluteSymbols function you need to include the new AbsoluteSymbols.h header.
2024-11-10[JITLink] Use `rsplit` on `-sectcreate` argument in llvm-jitlink (#115511)Douglas1-1/+1
This accounts for cases where the file path may contain an `@` symbol. In such cases, the split occurs too early causing argument parsing to fail.
2024-11-07[ORC] Switch to new visibility macros for JIT debug symbols (#113848)Thomas Fransham1-1/+2
Use LLVM_ALWAYS_EXPORT for __jit_debug_descriptor and __jit_debug_register_code so there exported even if LLVM is not built as a shared library. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on windows #109483.