Жуков Кирилл Семенович via llvm-dev
2018-Apr-04 12:35 UTC
[llvm-dev] weird behaviour of llvm::linker::LinkInModule()
<div>Hello!</div><div>I created a new llvm module (<strong>A</strong>) - to create a 'glue' code.</div><div>I want to call some functions from another module (<strong>B</strong>);</div><div>I load module <strong>B</strong> withing the same LLVMContext, and create a function declaration in module A via:</div><div> auto functionInAnotherModule = ModuleB.getFunction(callableName);</div><div> auto functionType = functionInAnotherModule->getFunctionType();</div><div> auto localFunction = llvm::Function::Create(functionType, llvm::GlobalValue::LinkageTypes::ExternalWeakLinkage, callableName, &ModuleA);</div><div> </div><div> Function seems to be copied, together with complex types its using:</div><div> ; ModuleID = 'JitModule'</div><div> source_filename = "JitModule" </div><div> %struct._EN12RecordStreamE = type { %class.RecordStream }</div><div> declare extern_weak void @_EN12RecordStream4InitEPTsN18_EN12RecordStreamEEPvv(%struct._EN12RecordStreamE*, i8*)</div><div> </div><div> ... But later I'm not able to link in ModuleB to ModuleA using linker.linkInModule(std::move(ModuleB));</div><div> llvm says: Assertion failed: !(Pair.first != Ty && Pair.second == Ty) && "mapping to a source type",...</div><div> </div><div> Could someone point me what conceptually I did wrong?</div>
Maybe Matching Threads
- Branch 'as' - 7 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_with.c libswfdec/swfdec_sprite_movie.c test/trace
- [LLVMdev] MCJIT versus getLazyBitcodeModule?
- How to extract functions from Module A and put them into Module B, and generate a new IR file?
- [LLVMdev] Inter-module calls
- [LLVMdev] Inter-module calls