Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hello World in LLVM-Assembly Language on Windows

As an experienced programmer I feel quite dumb asking such a question: Is there a step-by-step tutorial explaining how to write a "Hello World"-Program in LLVM-Assembly Language resulting in a simple "hello.exe" which can be executed on a Standard Windows PC?

I followed dozens of such tutorial explaining how to checkout, make, compile llvm, etc. But either they require some other Software (which results in another tutorial-Marathon), or they ended up with some "Path/File/Dll not found"-Error (which results in another tutorial-Marathon). I achieved to let llvm.exe execute ... once. Now Windows reports the application to be crashing?!

Now I feel completely lost in a maze of outdated tutorials, errors, incompatibilities, emulators/VMs, IDE, Crosslinks, 32 vs. 64-Bit, with/out WinGW, with/out Cygwin, with/out Visual Studio, with/out clang, experimental, not supported, missing Environment-variables etc.

I expected to find an installer or archive containing a bunch of precompiled dll- and exe-files which can be used via command line out of the box. I just want to USE a bare llvm-toolset - no clang, no Visual Studio (if possible) - just like javac.exe, masm.exe, fasm.exe, link.exe, ...

If I have to compile llvm on my own, the possibility to achieve this via Eclipse-CDT would be great - I was unable to import the Project without any FileNotFound-Errors; which was related to some make-specific incompatibilities regarding the directory structure ... cmake should have solved that problem, but the only tutorial I found so far was about cmake-gui - which failed to install for some other reasons ...

Can someone please point me to an up-to-date tutorial on how to get a working llvm-as.exe or write a step-by-step-instruction how he/she achieved the above?

Thanks in advance - I lost three days on this so far :/

like image 611
Kai Giebeler Avatar asked Oct 20 '13 21:10

Kai Giebeler


Video Answer


1 Answers

LLVM historically had second-rate support on Windows, but quite recently things have changed so you have good timing. Check out this LLVM blog post from just a month ago. It points to this page with binary builds of the LLVM toolchain for Windows. Once you have the tools, then the flow to a "hello world" is similar to other platforms. It would be a good idea to start with the LLVM tutorial.

FWIW there's also a getting started on Windows guide, though I'm not sure how up to date it is w.r.t the blog post mentioned above. It does create a "hello world" LLVM IR file in the process, though.

like image 166
Eli Bendersky Avatar answered Oct 10 '22 22:10

Eli Bendersky