<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<br class=""><div class=""><br class=""></div><div class="">I recently updated a project which had been using LLVM 6 to LLVM 8, and ran into an issue where symbols which exist in libraries loaded with LLVMLoadLibraryPermanently — which were correctly resolved by the MCJIT in LLVM 6 — are resolved as the constant $0x0 (null) in LLVM 8, causing a crash in what had been working code.</div><div class=""><br class=""></div><div class="">The image below shows what’s seen in the debugger. Note the call of %rax on the last line, which had $0x0 stored into it two lines previously.</div><div class=""><br class=""></div><div class=""><img apple-inline="yes" id="E8D60CB5-9B7A-45E3-8DC7-994CBB12D9A6" width="509" height="104" src="cid:A7C7A546-5309-40D4-9C18-76AAF8AAE52D@hsd1.il.comcast.net." class=""></div><div class=""><br class=""></div><div class="">Here is the LLVM IR which produced the assembly above:</div><div class=""><img apple-inline="yes" id="CA8D121E-E10A-4CE4-92C8-248CFC9BE1D0" width="313" height="53" src="cid:B97BA589-09EF-4C6E-A07A-8C5DD9DF2E75@hsd1.il.comcast.net." class=""></div><div class=""><br class=""></div><div class="">The project uses the LLVM C API (via the Rust llvm-sys crate) and had no other changes between the working and the new non-working state.</div><div class=""><br class=""></div><div class="">Symbols within the module the execution engine was constructed with are resolved correctly; only symbols within loaded dynamic libraries fail to resolve.</div><div class=""><br class=""></div><div class="">Using LLVMSearchForAddressOfSymbol does <i class="">correctly</i> resolve the symbols from the dynamic library — it’s only when JITed that resolution fails.</div><div class=""><br class=""></div><div class="">My questions are:</div><div class=""><br class=""></div><div class=""><ol class="MailOutline"><li class="">Is there a way to get LLVM JIT to crash when a symbol fails to resolve, rather than fill in a constant null? That it didn’t crash in the first place was surprising to me — it took a whole day to track down that this resolution failure was even the problem.</li><li class="">Were there any changes to the way LLVM's JIT resolves symbols between LLVM 6 and LLVM 8?</li><ul class=""><li class="">I checked the documentation for the LLVMCreateJITCompiledForModule and LLVMLoadLibraryPermanently but found nothing to suggest the behavior would have changed (no deprecation warning, no new documentation).</li></ul></ol></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I’d appreciate any help or suggestions. I’m unsure how to proceed debugging or fixing this.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Connor</div><div class=""> </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>