LLVMCreateTargetMachineWithOpts: disable large data (#4220)
for x86-64, llvm 17 and later sometimes uses "l" prefix for data sections. cf.43249378dabecause our aot file emitter/loader doesn't support such sections, it ends up with load-time errors solving symbols like ".lrodata". this commit fixes it by avoid placing data in the large data sections. references: https://groups.google.com/g/x86-64-abi/c/jnQdJeabxiU1feb00a28c
This commit is contained in:
@ -159,6 +159,17 @@ LLVMCreateTargetMachineWithOpts(LLVMTargetRef ctarget, const char *triple,
|
|||||||
auto cm = convert(code_model, &jit);
|
auto cm = convert(code_model, &jit);
|
||||||
auto targetmachine = target->createTargetMachine(triple, cpu, features,
|
auto targetmachine = target->createTargetMachine(triple, cpu, features,
|
||||||
opts, rm, cm, ol, jit);
|
opts, rm, cm, ol, jit);
|
||||||
|
#if LLVM_VERSION_MAJOR >= 18
|
||||||
|
// always place data in normal data section.
|
||||||
|
//
|
||||||
|
// note that:
|
||||||
|
// - our aot file emitter/loader doesn't support x86-64 large data
|
||||||
|
// sections. (eg .lrodata)
|
||||||
|
// - for our purposes, "data" is usually something the compiler
|
||||||
|
// generated. (eg. jump tables) we probably never benefit from
|
||||||
|
// large data sections.
|
||||||
|
targetmachine->setLargeDataThreshold(UINT64_MAX);
|
||||||
|
#endif
|
||||||
return reinterpret_cast<LLVMTargetMachineRef>(targetmachine);
|
return reinterpret_cast<LLVMTargetMachineRef>(targetmachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user