Skip to content

Commit 6593b3f

Browse files
authored
LLVMCreateTargetMachineWithOpts: disable large data (#4220)
for x86-64, llvm 17 and later sometimes uses "l" prefix for data sections. cf. llvm/llvm-project@4324937 because 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/jnQdJeabxiU llvm/llvm-project@1feb00a
1 parent c2d7fa3 commit 6593b3f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/iwasm/compilation/aot_llvm_extra2.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,17 @@ LLVMCreateTargetMachineWithOpts(LLVMTargetRef ctarget, const char *triple,
159159
auto cm = convert(code_model, &jit);
160160
auto targetmachine = target->createTargetMachine(triple, cpu, features,
161161
opts, rm, cm, ol, jit);
162+
#if LLVM_VERSION_MAJOR >= 18
163+
// always place data in normal data section.
164+
//
165+
// note that:
166+
// - our aot file emitter/loader doesn't support x86-64 large data
167+
// sections. (eg .lrodata)
168+
// - for our purposes, "data" is usually something the compiler
169+
// generated. (eg. jump tables) we probably never benefit from
170+
// large data sections.
171+
targetmachine->setLargeDataThreshold(UINT64_MAX);
172+
#endif
162173
return reinterpret_cast<LLVMTargetMachineRef>(targetmachine);
163174
}
164175

0 commit comments

Comments
 (0)