Emmanuel Thivierge via llvm-dev
2019-Apr-08 19:10 UTC
[llvm-dev] ORC jit calling a function that uses the stl
Hi, I have been trying to use the new ORC jit to execute a c function using c++ that was compiled to llvm bytecode (clang++.exe -c -g -emit-llvm -std=c++2a -o CxxJit.bc CxxJit.cpp). I guess the first thing I need to say is that I am on windows, this could explain why I have those issues. The file to jit is this: #include "CxxJit.h" #include <stdio.h> #include <vector> extern "C" { void doWork() { std::vector<int32_t> vec(10000); printf("doWork() = %d \n", 12); } } Now If I only have the printf everything works but when I try to create a std::vector It fails to lookup the symbol. In the error stream I have one symbol not found and a bunch of symbol that failed to materialize. JIT session error: Symbols not found: { ??3 at YAXPEAX_K@Z } Failed to materialize symbols: { ??0?$vector at HV?$allocator at H@std@@@std@ @QEAA at _KAEBV?$allocator at H@1@@Z, doWork, ?_Myfirst@?$vector at HV?$allocator at H @std@@@std@@AEAAAEAPEAHXZ, ??$forward at AEBV?$allocator at H@std@@@std@ @YAAEBV?$allocator at H@0 at AEBV10@@Z, ?_Get_second@?$_Compressed_pair at V ?$allocator at H@std@@V?$_Vector_val at U?$_Simple_types at H@std@@@2@$00 at std @@QEAAAEAV?$_Vector_val at U?$_Simple_types at H@std@@@2 at XZ, ?_Tidy@?$vector at HV ?$allocator at H@std@@@std@@AEAAXXZ, ?_Orphan_all at _Container_base0@std@@QEAAXXZ, ??1?$vector at HV?$allocator at H@std@@@std@@QEAA at XZ, ??$?0AEBV?$allocator at H@std@ @$$V@?$_Compressed_pair at V?$allocator at H@std@@V?$_Vector_val at U ?$_Simple_types at H@std@@@2@$00 at std@@QEAA at U_One_then_variadic_args_t@1 at AEBV ?$allocator at H@1@@Z, ?_Release at _Fake_proxy_ptr_impl@std@@QEAAXXZ, ??0?$allocator at H@std@@QEAA at XZ, ?_Getal@?$vector at HV?$allocator at H@std@@@std@ @AEAAAEAV?$allocator at H@2 at XZ, ??$_Allocate@$0BA at U_Default_allocate_traits @std@@$0A@@std@@YAPEAX_K at Z, ?_Allocate at _Default_allocate_traits@std @@SAPEAX_K at Z, ??_C at _0BD@OLBABOEK at vector?$DMT?$DO?5too?5long?$AA@, ??1?$_Tidy_guard at V?$vector at HV?$allocator at H@std@@@std@@@std@@QEAA at XZ, ?_Destroy@?$vector at HV?$allocator at H@std@@@std@@AEAAXPEAH0 at Z, ?_Getal@ ?$vector at HV?$allocator at H@std@@@std@@AEBAAEBV?$allocator at H@2 at XZ, main, ??$_Construct_n_copies_of_ty at U_Value_init_tag@std@@@?$vector at HV?$allocator at H @std@@@std@@AEAAX_KAEBU_Value_init_tag at 1@@Z, ??0_Fake_proxy_ptr_impl at std @@QEAA at AEBU_Fake_allocator@1 at AEBU_Container_base0@1@@Z, ?_Buy_nonzero@ ?$vector at HV?$allocator at H@std@@@std@@AEAAX_K at Z, ?_Orphan_all@?$vector at HV ?$allocator at H@std@@@std@@AEAAXXZ, ??$_Allocate_manually_vector_aligned at U_Default_allocate_traits@std@@@std@ @YAPEAX_K at Z, ?_Mylast@?$vector at HV?$allocator at H@std@@@std@@AEAAAEAPEAHXZ, ?max_size@?$vector at HV?$allocator at H@std@@@std@@QEBA_KXZ, ??$_Zero_range at PEAH @std@@YAPEAHQEAH0 at Z, ?max_size@?$_Default_allocator_traits at V?$allocator at H @std@@@std@@SA_KAEBV?$allocator at H@2@@Z, ?_Adjust_manually_vector_aligned at std @@YAXAEAPEAXAEA_K at Z, ?deallocate@?$allocator at H@std@@QEAAXQEAH_K at Z, ?max@ ?$numeric_limits at _J@std@@SA_JXZ, ??$_Uninitialized_value_construct_n at PEAH_KV ?$allocator at H@std@@@std@@YAPEAHPEAH_KAEAV?$allocator at H@0@@Z, ??$_Destroy_range at V?$allocator at H@std@@@std@@YAXPEAH0AEAV?$allocator at H@0@@Z, ?_Get_data@?$vector at HV?$allocator at H@std@@@std@@AEAAAEAV?$_Vector_val at U ?$_Simple_types at H@std@@@2 at XZ, ?_Get_first@?$_Compressed_pair at V?$allocator at H @std@@V?$_Vector_val at U?$_Simple_types at H@std@@@2@$00 at std @@QEAAAEAV?$allocator at H@2 at XZ, ??$_Min_value at _K@std@@YAAEB_KAEB_K0 at Z, ??$_Get_size_of_n@$03 at std@@YA_K_K at Z, ?_Ufill@?$vector at HV?$allocator at H@std@ @@std@@AEAAPEAHPEAH_KU_Value_init_tag at 2@@Z, ??$_Uninitialized_value_construct_n1 at PEAH_KV?$allocator at H@std@@@std@ @YAPEAHPEAH_KAEAV?$allocator at H@0 at U?$integral_constant at _N$00 at 0@@Z, ??0?$_Vector_val at U?$_Simple_types at H@std@@@std@@QEAA at XZ, ?_Buy_raw@ ?$vector at HV?$allocator at H@std@@@std@@AEAAX_K at Z, ?allocate@?$allocator at H@std@ @QEAAPEAH_K at Z, ?_Get_first@?$_Compressed_pair at V?$allocator at H@std@ @V?$_Vector_val at U?$_Simple_types at H@std@@@2@$00 at std@@QEBAAEBV?$allocator at H @2 at XZ, ??$_Deallocate@$0BA@$0A@@std@@YAXPEAX_K at Z, ?_Xlength@?$vector at HV ?$allocator at H@std@@@std@@CAXXZ } You can see the code that I am using here: https://gist.github.com/monamimani/1d8c5287eeaf83d5a6f619699d0c52c4 There is a bunch of reason I can imagine why this would happen: - The symbol are not there, I recently discover this llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr); but it doesn't change anything., - I am using this helper class http://llvm.org/doxygen/classllvm_1_1orc_1_1LLJIT.html, maybe the setup is not complet. I tried to compare with the example https://llvm.org/docs/tutorial/BuildingAJIT1.html, maybe I missed something. - The other thing I am considering is that llvm::orc::RTDyldObjectLinkingLayer is not working on windows and I would need to use llvm::orc::LegacyRTDyldObjectLinkingLayer ( because of the bool ExportedSymbolsOnly parameter in the findSymbol function. Does anybody have a hint about what I might try to fix this? Thanks a lot. Emmanuel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190408/8e88d3a7/attachment.html>
Lang Hames via llvm-dev
2019-Apr-26 18:39 UTC
[llvm-dev] ORC jit calling a function that uses the stl
Hi Emmanuel, JIT session error: Symbols not found: { ??3 at YAXPEAX_K@Z } This is the important bit. You're right that the rest of the error message is likely fallout due to this error. Are you using clang++ to compile that snippet? If so, can you send the clang version and invocation that you're using? Cheers, Lang. On Mon, Apr 8, 2019 at 12:11 PM Emmanuel Thivierge via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > I have been trying to use the new ORC jit to execute a c function using > c++ that was compiled to llvm bytecode (clang++.exe -c -g -emit-llvm > -std=c++2a -o CxxJit.bc CxxJit.cpp). > I guess the first thing I need to say is that I am on windows, this could > explain why I have those issues. > > The file to jit is this: > #include "CxxJit.h" > #include <stdio.h> > #include <vector> > > extern "C" > { > void doWork() > { > std::vector<int32_t> vec(10000); > printf("doWork() = %d \n", 12); > } > } > > Now If I only have the printf everything works but when I try to create a > std::vector It fails to lookup the symbol. In the error stream I have one > symbol not found and a bunch of symbol that failed to materialize. > JIT session error: Symbols not found: { ??3 at YAXPEAX_K@Z } > Failed to materialize symbols: { ??0?$vector at HV?$allocator at H@std@@@std@ > @QEAA at _KAEBV?$allocator at H@1@@Z, doWork, ?_Myfirst@?$vector at HV?$allocator at H > @std@@@std@@AEAAAEAPEAHXZ, ??$forward at AEBV?$allocator at H@std@@@std@ > @YAAEBV?$allocator at H@0 at AEBV10@@Z, ?_Get_second@?$_Compressed_pair at V > ?$allocator at H@std@@V?$_Vector_val at U?$_Simple_types at H@std@@@2@$00 at std > @@QEAAAEAV?$_Vector_val at U?$_Simple_types at H@std@@@2 at XZ, ?_Tidy@?$vector at HV > ?$allocator at H@std@@@std@@AEAAXXZ, ?_Orphan_all at _Container_base0@std@@QEAAXXZ, > ??1?$vector at HV?$allocator at H@std@@@std@@QEAA at XZ, ??$?0AEBV?$allocator at H > @std@@$$V@?$_Compressed_pair at V?$allocator at H@std@@V?$_Vector_val at U > ?$_Simple_types at H@std@@@2@$00 at std@@QEAA at U_One_then_variadic_args_t@1 at AEBV > ?$allocator at H@1@@Z, ?_Release at _Fake_proxy_ptr_impl@std@@QEAAXXZ, > ??0?$allocator at H@std@@QEAA at XZ, ?_Getal@?$vector at HV?$allocator at H@std@@@std@ > @AEAAAEAV?$allocator at H@2 at XZ, ??$_Allocate@$0BA at U_Default_allocate_traits > @std@@$0A@@std@@YAPEAX_K at Z, ?_Allocate at _Default_allocate_traits@std > @@SAPEAX_K at Z, ??_C at _0BD@OLBABOEK at vector?$DMT?$DO?5too?5long?$AA@, > ??1?$_Tidy_guard at V?$vector at HV?$allocator at H@std@@@std@@@std@@QEAA at XZ, > ?_Destroy@?$vector at HV?$allocator at H@std@@@std@@AEAAXPEAH0 at Z, ?_Getal@ > ?$vector at HV?$allocator at H@std@@@std@@AEBAAEBV?$allocator at H@2 at XZ, main, > ??$_Construct_n_copies_of_ty at U_Value_init_tag@std@@@?$vector at HV > ?$allocator at H@std@@@std@@AEAAX_KAEBU_Value_init_tag at 1@@Z, > ??0_Fake_proxy_ptr_impl at std@@QEAA at AEBU_Fake_allocator > @1 at AEBU_Container_base0@1@@Z, ?_Buy_nonzero@?$vector at HV?$allocator at H@std@ > @@std@@AEAAX_K at Z, ?_Orphan_all@?$vector at HV?$allocator at H@std@@@std@@AEAAXXZ, > ??$_Allocate_manually_vector_aligned at U_Default_allocate_traits@std@@@std@ > @YAPEAX_K at Z, ?_Mylast@?$vector at HV?$allocator at H@std@@@std@@AEAAAEAPEAHXZ, > ?max_size@?$vector at HV?$allocator at H@std@@@std@@QEBA_KXZ, > ??$_Zero_range at PEAH@std@@YAPEAHQEAH0 at Z, ?max_size@ > ?$_Default_allocator_traits at V?$allocator at H@std@@@std@ > @SA_KAEBV?$allocator at H@2@@Z, ?_Adjust_manually_vector_aligned at std > @@YAXAEAPEAXAEA_K at Z, ?deallocate@?$allocator at H@std@@QEAAXQEAH_K at Z, ?max@ > ?$numeric_limits at _J@std@@SA_JXZ, > ??$_Uninitialized_value_construct_n at PEAH_KV?$allocator at H@std@@@std@ > @YAPEAHPEAH_KAEAV?$allocator at H@0@@Z, ??$_Destroy_range at V?$allocator at H@std@ > @@std@@YAXPEAH0AEAV?$allocator at H@0@@Z, ?_Get_data@?$vector at HV?$allocator at H > @std@@@std@@AEAAAEAV?$_Vector_val at U?$_Simple_types at H@std@@@2 at XZ, > ?_Get_first@?$_Compressed_pair at V?$allocator at H@std@@V?$_Vector_val at U > ?$_Simple_types at H@std@@@2@$00 at std@@QEAAAEAV?$allocator at H@2 at XZ, > ??$_Min_value at _K@std@@YAAEB_KAEB_K0 at Z, ??$_Get_size_of_n@$03 at std@@YA_K_K at Z, > ?_Ufill@?$vector at HV?$allocator at H@std@@@std@ > @AEAAPEAHPEAH_KU_Value_init_tag at 2@@Z, > ??$_Uninitialized_value_construct_n1 at PEAH_KV?$allocator at H@std@@@std@ > @YAPEAHPEAH_KAEAV?$allocator at H@0 at U?$integral_constant at _N$00 at 0@@Z, > ??0?$_Vector_val at U?$_Simple_types at H@std@@@std@@QEAA at XZ, ?_Buy_raw@ > ?$vector at HV?$allocator at H@std@@@std@@AEAAX_K at Z, ?allocate@?$allocator at H > @std@@QEAAPEAH_K at Z, ?_Get_first@?$_Compressed_pair at V?$allocator at H@std@ > @V?$_Vector_val at U?$_Simple_types at H@std@@@2@$00 at std@@QEBAAEBV?$allocator at H > @2 at XZ, ??$_Deallocate@$0BA@$0A@@std@@YAXPEAX_K at Z, ?_Xlength@?$vector at HV > ?$allocator at H@std@@@std@@CAXXZ } > > You can see the code that I am using here: > https://gist.github.com/monamimani/1d8c5287eeaf83d5a6f619699d0c52c4 > > There is a bunch of reason I can imagine why this would happen: > - The symbol are not there, I recently discover > this llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr); but it > doesn't change anything., > - I am using this helper class > http://llvm.org/doxygen/classllvm_1_1orc_1_1LLJIT.html, maybe the setup > is not complet. I tried to compare with the example > https://llvm.org/docs/tutorial/BuildingAJIT1.html, maybe I missed > something. > - The other thing I am considering is that > llvm::orc::RTDyldObjectLinkingLayer is not working on windows and I would > need to use llvm::orc::LegacyRTDyldObjectLinkingLayer ( because of the bool > ExportedSymbolsOnly parameter in the findSymbol function. > > Does anybody have a hint about what I might try to fix this? > > Thanks a lot. > Emmanuel > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190426/3a05c22b/attachment.html>