[llvm-dev] clang interpreter failed to materialize symbols

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev
(+Lang for JIT/interpreter questions)

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev
Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:
(+Lang for JIT/interpreter questions)

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev
Hi Stefan,

No, I haven’t. Will try that later tonight.
Thanks!

-
Best,
Igor
Sent from my iPhone

On Jan 14, 2020, at 11:46 AM, Stefan Gränitz <[hidden email]> wrote:

 Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:
(+Lang for JIT/interpreter questions)

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev
In reply to this post by Johannes Doerfert via llvm-dev

Hi Stefan,

 

I just tried it. Here is what I got:

PS C:\Users\giv_u\source\repos\ConsoleApplication1\ConsoleApplication1> lli -jit-kind=orc-lazy .\ConsoleApplication1.bc

Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file C:\dev\llvm-project\llvm\include\llvm/Support/Casting.h, line 264

 

--

Thanks,

Igor

 

Sent from Mail for Windows 10

 

From: [hidden email]
Sent: Tuesday, January 14, 2020 11:46 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]; [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols

 

Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:

(+Lang for JIT/interpreter questions)

 

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

 


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev
Interesting.. not stacktrace?

On 15/01/2020 01:38, Igor Gomon wrote:

Hi Stefan,

 

I just tried it. Here is what I got:

PS C:\Users\giv_u\source\repos\ConsoleApplication1\ConsoleApplication1> lli -jit-kind=orc-lazy .\ConsoleApplication1.bc

Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file C:\dev\llvm-project\llvm\include\llvm/Support/Casting.h, line 264

 

--

Thanks,

Igor

 

Sent from Mail for Windows 10

 

From: [hidden email]
Sent: Tuesday, January 14, 2020 11:46 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]; [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols

 

Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:

(+Lang for JIT/interpreter questions)

 

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

 

-- 
https://flowcrypt.com/pub/stefan.graenitz@...

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev

Correct. There is not stack trace. App exists shortly after the failed assert with exit code 3.

 

Sent from Mail for Windows 10

 

From: [hidden email]
Sent: Wednesday, January 15, 2020 5:13 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]; [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols

 

Interesting.. not stacktrace?

On 15/01/2020 01:38, Igor Gomon wrote:

Hi Stefan,

 

I just tried it. Here is what I got:

PS C:\Users\giv_u\source\repos\ConsoleApplication1\ConsoleApplication1> lli -jit-kind=orc-lazy .\ConsoleApplication1.bc

Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file C:\dev\llvm-project\llvm\include\llvm/Support/Casting.h, line 264

 

--

Thanks,

Igor

 

Sent from Mail for Windows 10

 

From: [hidden email]
Sent: Tuesday, January 14, 2020 11:46 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]; [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols

 

Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:

(+Lang for JIT/interpreter questions)

 

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev




_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

 

-- 
https://flowcrypt.com/pub/stefan.graenitz@...

 


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev
In reply to this post by Johannes Doerfert via llvm-dev
Hi Stefan,

I just tried the -jit-kind=orc-lazy with lli executable and it solves the problem on Ubuntu 18.04 (still does not work on Windows 10). But this solution is good enough for me now. Thanks again for your help!

--
Best Regards,
Igor

From: Igor Gomon <[hidden email]>
Sent: Tuesday, January 14, 2020 7:38 PM
To: Stefan Gränitz <[hidden email]>
Cc: David Blaikie <[hidden email]>; Lang Hames <[hidden email]>; [hidden email] <[hidden email]>
Subject: RE: [llvm-dev] clang interpreter failed to materialize symbols
 

Hi Stefan,

 

I just tried it. Here is what I got:

PS C:\Users\giv_u\source\repos\ConsoleApplication1\ConsoleApplication1> lli -jit-kind=orc-lazy .\ConsoleApplication1.bc

Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file C:\dev\llvm-project\llvm\include\llvm/Support/Casting.h, line 264

 

--

Thanks,

Igor

 

Sent from Mail for Windows 10

 

From: [hidden email]
Sent: Tuesday, January 14, 2020 11:46 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]; [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols

 

Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:

(+Lang for JIT/interpreter questions)

 

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

 


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev
Hi Igor,

Regarding that stack trace: C++ code and interactions with the C++ standard library are not as well supported as C/libC, especially on Windows.

What happens if you write your hello-world program in C using printf?

Does your use-case require C++?

— Lang.

Sent from my iPad

On Jan 15, 2020, at 9:51 PM, Igor Gomon <[hidden email]> wrote:


Hi Stefan,

I just tried the -jit-kind=orc-lazy with lli executable and it solves the problem on Ubuntu 18.04 (still does not work on Windows 10). But this solution is good enough for me now. Thanks again for your help!

--
Best Regards,
Igor

From: Igor Gomon <[hidden email]>
Sent: Tuesday, January 14, 2020 7:38 PM
To: Stefan Gränitz <[hidden email]>
Cc: David Blaikie <[hidden email]>; Lang Hames <[hidden email]>; [hidden email] <[hidden email]>
Subject: RE: [llvm-dev] clang interpreter failed to materialize symbols
 

Hi Stefan,

 

I just tried it. Here is what I got:

PS C:\Users\giv_u\source\repos\ConsoleApplication1\ConsoleApplication1> lli -jit-kind=orc-lazy .\ConsoleApplication1.bc

Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file C:\dev\llvm-project\llvm\include\llvm/Support/Casting.h, line 264

 

--

Thanks,

Igor

 

Sent from Mail for Windows 10

 

From: [hidden email]
Sent: Tuesday, January 14, 2020 11:46 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]; [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols

 

Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:

(+Lang for JIT/interpreter questions)

 

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

 


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev
Hi Lang,

I have tried the same program but using stdio.h and printf(). It works fine on Windows.
But my use-case requires C++ support. I currently have a C++ text editor app in the App Store and I am working on adding on-device compilation and running capabilities (ideally). The reason for C++ support is because I believe there is a large community of people who are studying C++ in school and they would appreciate the convenience of entering and running their code on their iOS device.

--
Best Regards,
Igor


From: Lang Hames <[hidden email]>
Sent: Thursday, January 16, 2020 10:01 PM
To: Igor Gomon <[hidden email]>
Cc: Stefan Gränitz <[hidden email]>; David Blaikie <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols
 
Hi Igor,

Regarding that stack trace: C++ code and interactions with the C++ standard library are not as well supported as C/libC, especially on Windows.

What happens if you write your hello-world program in C using printf?

Does your use-case require C++?

— Lang.

Sent from my iPad

On Jan 15, 2020, at 9:51 PM, Igor Gomon <[hidden email]> wrote:


Hi Stefan,

I just tried the -jit-kind=orc-lazy with lli executable and it solves the problem on Ubuntu 18.04 (still does not work on Windows 10). But this solution is good enough for me now. Thanks again for your help!

--
Best Regards,
Igor

From: Igor Gomon <[hidden email]>
Sent: Tuesday, January 14, 2020 7:38 PM
To: Stefan Gränitz <[hidden email]>
Cc: David Blaikie <[hidden email]>; Lang Hames <[hidden email]>; [hidden email] <[hidden email]>
Subject: RE: [llvm-dev] clang interpreter failed to materialize symbols
 

Hi Stefan,

 

I just tried it. Here is what I got:

PS C:\Users\giv_u\source\repos\ConsoleApplication1\ConsoleApplication1> lli -jit-kind=orc-lazy .\ConsoleApplication1.bc

Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file C:\dev\llvm-project\llvm\include\llvm/Support/Casting.h, line 264

 

--

Thanks,

Igor

 

Sent from Mail for Windows 10

 

From: [hidden email]
Sent: Tuesday, January 14, 2020 11:46 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]; [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols

 

Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:

(+Lang for JIT/interpreter questions)

 

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

 


_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang interpreter failed to materialize symbols

Johannes Doerfert via llvm-dev

the convenience of entering and running their code on their iOS device.
Off-topic FYI: Not sure if this may have changed in the meantime, but in the past iOS didn't allow 3rd-party Apps to run JIT-compiled code.

https://stackoverflow.com/questions/5054732


On 17/01/2020 05:24, Igor Gomon wrote:
Hi Lang,

I have tried the same program but using stdio.h and printf(). It works fine on Windows.
But my use-case requires C++ support. I currently have a C++ text editor app in the App Store and I am working on adding on-device compilation and running capabilities (ideally). The reason for C++ support is because I believe there is a large community of people who are studying C++ in school and they would appreciate the convenience of entering and running their code on their iOS device.

--
Best Regards,
Igor


From: Lang Hames [hidden email]
Sent: Thursday, January 16, 2020 10:01 PM
To: Igor Gomon [hidden email]
Cc: Stefan Gränitz [hidden email]; David Blaikie [hidden email]; [hidden email] [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols
 
Hi Igor,

Regarding that stack trace: C++ code and interactions with the C++ standard library are not as well supported as C/libC, especially on Windows.

What happens if you write your hello-world program in C using printf?

Does your use-case require C++?

— Lang.

Sent from my iPad

On Jan 15, 2020, at 9:51 PM, Igor Gomon [hidden email] wrote:


Hi Stefan,

I just tried the -jit-kind=orc-lazy with lli executable and it solves the problem on Ubuntu 18.04 (still does not work on Windows 10). But this solution is good enough for me now. Thanks again for your help!

--
Best Regards,
Igor

From: Igor Gomon [hidden email]
Sent: Tuesday, January 14, 2020 7:38 PM
To: Stefan Gränitz [hidden email]
Cc: David Blaikie [hidden email]; Lang Hames [hidden email]; [hidden email] [hidden email]
Subject: RE: [llvm-dev] clang interpreter failed to materialize symbols
 

Hi Stefan,

 

I just tried it. Here is what I got:

PS C:\Users\giv_u\source\repos\ConsoleApplication1\ConsoleApplication1> lli -jit-kind=orc-lazy .\ConsoleApplication1.bc

Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file C:\dev\llvm-project\llvm\include\llvm/Support/Casting.h, line 264

 

--

Thanks,

Igor

 

Sent from Mail for Windows 10

 

From: [hidden email]
Sent: Tuesday, January 14, 2020 11:46 AM
To: [hidden email]
Cc: [hidden email]; [hidden email]; [hidden email]
Subject: Re: [llvm-dev] clang interpreter failed to materialize symbols

 

Hi Igor, not sure if that will work, but have you tried lli -jit-kind=orc-lazy ? The default is still MCJIT:
https://github.com/llvm/llvm-project/blob/master/llvm/tools/lli/lli.cpp#L88

On 13/01/2020 19:07, David Blaikie via llvm-dev wrote:

(+Lang for JIT/interpreter questions)

 

On Sun, Jan 5, 2020 at 5:00 PM Igor Gomon via llvm-dev <[hidden email]> wrote:

Hello,

 

I am new to LLVM and what I am trying to do is to get a very simple “hello-world” C++ program to compile to LLVM IR and then to run it using lli tool.

So here is the program code (hello.cpp):

#include <iostream>

int main (int argc, char *argv[])

{

    std::cout << "Hello World!\n";

    return 0;

}

Below are the steps I do to achieve that goal:

  1. clang++.exe hello.cpp -S -emit-llvm -o hello.ll (produces hello.ll about 307KB in size)
  2. llvm-link.exe hello.ll -o hello.bc (produces the bit-code file about 79KB in size).
  3. lli.exe hello.bc (terminates with a segmentation fault). The dump is below.

 

I understand that some symbols are not loaded (C++ standard library symbols). I am not sure how I can specify the location of those symbols to lli tool (I tried –extra-object option but no effect).

Could someone please let me know what am I missing or doing wrong?

Any help is greatly appreciated!!!

 

--

Thanks,

Igor

 

Stack dump:

0.      Program arguments: C:\dev\llvm-project\build\Debug\bin\lli.exe .\hello.bc

0x0000000000000000 (0x0000000000000010 0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186) <unknown module>

0x000001AF8A3004F6 (0xCCCCCCCCCCCCCCCC 0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000) <unknown module>

0x0000000000000010 (0x000000575B18D640 0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE) <unknown module>

0xCCCCCCCCCCCCCCCC (0x00007FF68DEF6186 0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0) <unknown module>

0x000000575B18D640 (0x000001AF8A4B0000 0xFFFFFFFFFFFFFFFE 0x000000575B18D6A0 0x000001AF8A300032) <unknown module>

0x00007FF68DEF6186 (0x000001AF8A85B410 0x000000575B18D678 0xCCCCCCCCCCCCCCCC 0x000001AF8A4B0000), std::_Construct_in_place<std::_Container_proxy,std::_Container_base12 *>() + 0x56 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 205

0x00007FF68DEF45E8 (0x0000000000000000 0x000000005B18D6B1 0xFFFFFFFFFFFFFFFE 0x000000575B18DB80), std::_Container_base12::_Alloc_proxy<std::allocator<std::_Container_proxy> >() + 0x58 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xmemory, line 1100

0x00007FF68DF36634 (0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC 0x0000000000000001), std::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >::vector<llvm::GenericValue,std::allocator<llvm::GenericValue> >() + 0x54 bytes(s), C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\vector, line 446

0x00007FF68E06B048 (0x000001AF8A6A3058 0x0000000000000001 0xCCCCCCCCCCCCCCCC 0xCCCCCCCCCCCCCCCC), llvm::APInt::getZExtValue() + 0x28 bytes(s), C:\dev\llvm-project\llvm\include\llvm\ADT\APInt.h, line 1589 + 0xA byte(s)

0x00007FF68ED9E0F0 (0x000001AF8A563310 0x000000575B18DB88 0x000001AF8A583F18 0x000000575B18DBC0), llvm::MCJIT::runFunction() + 0x480 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\MCJIT\MCJIT.cpp, line 550 + 0x16 byte(s)

0x00007FF68EC09680 (0x000001AF8A563310 0x000001AF8A583F18 0x00007FF6920964A0 0x000001AF8A532460), llvm::ExecutionEngine::runFunctionAsMain() + 0x410 bytes(s), C:\dev\llvm-project\llvm\lib\ExecutionEngine\ExecutionEngine.cpp, line 470 + 0x65 byte(s)

0x00007FF68DEE4200 (0x0000000000000002 0x000001AF8A5515B0 0x000001AF8A532460 0x00007FF6909C0A7D), main() + 0x1D10 bytes(s), C:\dev\llvm-project\llvm\tools\lli\lli.cpp, line 614 + 0x4D byte(s)

0x00007FF6909C1A29 (0x00007FF690C2C000 0x00007FF690C2FE30 0x0000000000000000 0x0000000000000000), invoke_main() + 0x39 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 79

0x00007FF6909C190E (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main_seh() + 0x12E bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 288 + 0x5 byte(s)

0x00007FF6909C17CE (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), __scrt_common_main() + 0xE bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl, line 331

0x00007FF6909C1AB9 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), mainCRTStartup() + 0x9 bytes(s), d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp, line 17

0x00007FFC76417BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)

0x00007FFC7746CED1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)

 

Sent from Mail for Windows 10

 

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-- 
https://flowcrypt.com/pub/stefan.graenitz@...

 

-- 
https://flowcrypt.com/pub/stefan.graenitz@...

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev