Intermittent LLVM fatal error (abort in resolveRelocation()) when used from OSL

Greetings. I work a lot with shading, using the Open Shading Language, which uses LLVM to actually generate the running code. We have found in our app (3ds max) and intermittent crash that happens while doing a lot of interactive editing.

It’s been reported as a bug in OSL here Intermittent crash in LLVM_Util::getPointerToFunction(llvm::Function* func) · Issue #1712 · AcademySoftwareFoundation/OpenShadingLanguage · GitHub but while trying to figure the problem out I find the actual problem is in LLVM, and has to do with some stuff WAY above my paygrade (I am really just a user of OSL, not a coder, and the LLVM level is far beyond my personal understanding).

Basically, in a heavy interactive session, where shaders are getting recompiled while a renderer is running at the same time, we very intermittently end up hitting this fatal error:

case COFF::IMAGE_REL_AMD64_ADDR32NB: {
// ADDR32NB requires an offset less than 2GB from ‘ImageBase’.
// The MemoryManager can make sure this is always true by forcing the
// memory layout to be: CodeSection < ReadOnlySection < ReadWriteSection.
const uint64_t ImageBase = getImageBase();
if (Value < ImageBase || ((Value - ImageBase) > UINT32_MAX))
report_fatal_error("IMAGE_REL_AMD64_ADDR32NB relocation requires an "
“ordered section layout”);
else {
write32BitOffset(Target, RE.Addend, Value - ImageBase);
}
break;
}

Any ideas how to avoid that? Seems the 32 bit offset is the issue. Any way to force 64 bit offsets?

Thanks for ANY pointers from an LLVM noooob