Calling LLVM functions sometimes causes the program to crash abruptly with no feedback whatsoever (exit code 0 even). Now, this usually happens when something is being done wrongly, but right now I'm experiencing a crash like this at LLVM.TargetMachineEmitToFile caused by some code elsewhere, but outputting LLVM IR and then compiling that using llc works fine.
I have found that the following code in my project is causing it to crash:
var objectIdPtr = LLVM.BuildStructGEP(
_builder,
GetMethodObjectInstance(checkedFunction.LlvmValue!.Value),
0,
"".ToCString()
);
var objectId = LLVM.BuildLoad(
_builder,
objectIdPtr,
"objectId".ToCString()
);
where GetMethodObjectInstance simply does LLVM.GetParam(method, 0). When outputting as LLVM IR, I find no issues with it, and neither does llc. Yet, LLVM.TargetMachineEmitToFile causes it to crash, and I am getting no feedback. This can't be expected behaviour, right?
Calling LLVM functions sometimes causes the program to crash abruptly with no feedback whatsoever (exit code 0 even). Now, this usually happens when something is being done wrongly, but right now I'm experiencing a crash like this at
LLVM.TargetMachineEmitToFile
caused by some code elsewhere, but outputting LLVM IR and then compiling that usingllc
works fine.I have found that the following code in my project is causing it to crash:
where
GetMethodObjectInstance
simply doesLLVM.GetParam(method, 0)
. When outputting as LLVM IR, I find no issues with it, and neither doesllc
. Yet,LLVM.TargetMachineEmitToFile
causes it to crash, and I am getting no feedback. This can't be expected behaviour, right?