Is Clang lli API available? - clang

Is there any API for clang's lli tool available? I'd like to use it but i can't invoke executable in my environment.

Related

Why is LLC.exe missing in LLVM windows?

I've been trying to use emscripten to build C into WASM and Javascript. Emscripten requires clang so I installed it but then it says "emcc: error: llc executable not found at C:\Program Files\LLVM\bin\llc.exe" when running emcc and em++. Is there a reason that LLC.exe is missing in the windows version? If so how do I get it.
llc is a developer tool. If you want it, build it from llvm-project source. This is/will not included in the release binary.

Complete and isolated LLVM/musl toolchain

What I'm trying to achieve is to compile an GNU independent and isolated LLVM toolchain using musl as clib.
Recently LLVM 4.0 has been released with lot's of new cool features, including production ready LLD, so also the linking step could be handled by LLVM.
More or less the stack is:
clang
llvm
lld
compiler-rt
libcxx
libcxxabi
musl
Following this, it is actually possible to do so without much patching or such (apart from compiling musl), but sadly, there is no good documentation about that.
Any suggestions?
There is an example of using Clang + Musl together to compile "Hello World" in C here: https://github.com/njlr/portable-cxx
It only requires wget, tar and make to be installed. Clang and Musl are downloaded as part of the build process.
The key is to disable the usual include paths using -nostdinc and then add the Musl ones using -isystem.
I was solving the same problem with my NGTC (Non-GNU toolchain) project. Please take a look at my build scripts and patches.
I used this toolchain to build a small Linux distro without any code from GNU project: nenuzhnix.

clang/clang++ not detecting standard header files like iostream.h and stdio.h

I ran clang++ -v testfile.cpp and found that many standard headers were missing from the directory C:\LLVM\lib\clang\3.9.0\include. I downloaded a pre-built binary of clang 3.9.0 for 32 bit windows from this link.
Can someone please help me sort out this mess and explain me why the standard libraries are missing in the pre-build version of clang? I've searched the web for hours to get the answer and solution to this problem but couldn't find one. Thanks in advance.
why the standard libraries are missing in the pre-build version of clang?
Your Windows binary download comprises only binary build tools
plus a handful of clang-specific headers because you are supposed
to use clang, on Windows, in lieu of another native compiler that provides your
standard library. Similarly if you install clang on Linux you'll build against
the GCC standard library by default.
Your internet search seemingly failed to lead you to Installing clang++ to compile and link on Windows, which
explains how to integrate clang with the mingw-w64 GCC standard library for 32- and/or 64-bit work
in the manner that clang for Windows expects and supports.

lldb on Windows, possible?

I just build clang on Windows following this. To make it kind of complete it seems the compiler lldb should be made also.
How do I build lldb with mingw? Or it should be build with clang?
The people who work on the Windows port of lldb use Visual Studio. The instructions for building lldb on Windows are here:
http://lldb.llvm.org/build.html#BuildingLldbOnWindows
Basically follow the build instructions for Linux:
http://lldb.llvm.org/build.html#BuildingLldbOnLinux
I recommend you to use ninja for windows instead of make (it's faster) but that's up to you.
Preferably use a mingw build of python. You find instructions on this here:
Build Python with Mingw and gcc
Alternatively you can use cmake for python build:
https://github.com/python-cmake-buildsystem/python-cmake-buildsystem
In the chapter "Building LLDB" itself use the latest stable source from llvm, cland and lldb and rename the folder as shown in the directory hierarchy image.
If you want to try building llvm and clang with clang, try to put a build of clang + llvm in your path (and avoid VC + gcc). In this case you might need a clang-build of python too. I did not try this out.
If you get build errors try to use the headers from predef.sf.net.

Error compiling NEON for iOS 5.1 with clang integrated assembler

I try to compile NEON assembly code with LLVM clang integrated macro assembler (the LLVM compiler shipped with XCode 4.3) and get the following error:
vld1.8 {D0}, [R0] - invalid operand for instruction
What can be the reason? Why this instruction is successfuly compiled by GAS for Android and can't be compiled by 'clang -integrated-as ...' for iOS? Thanks.
After a day of experimenting I've found a solution. I've just compiled LLVM from the SVN source base (version 3.2). The integrated macro assembler in LLVM 3.2svn supports ARM NEON ISA much better compared to LLVM 3.0svn shipped with XCode 4.3.1. The problem with VLD NEON instruction have been automatically resolved.
Those, who use gas-preprocessor.pl Perl script, may try to switch from GAS 1.38 (it's external GNU assembler used by LLVM on Mac OS X 10.7.X) to LLVM integrated macro assembler and stop using unnecessary preprocessing.
I've not used clang for assembly but the following site might help: ARM Assembly
In addition, this may help as it solved someone else's issue with ARM assembly (selecting the correct device, lower case instructions etc...): Useful Stackoverflow answer

Resources