Questions tagged [lli]

`lli` is a command-line tool for executing [tag:llvm-ir] modules.

lli is a command-line tool for executing modules. It is part of the broader project.

21 questions
26
votes
1 answer

How to emulate thread_local in llvm-ir?

The following code is currently does not work in lli: //main.cpp extern thread_local int tls; int main() { tls = 42; return 0; } //clang++ -S -emit-llvm main.cpp && lli main.ll llvm-ir: ; ModuleID = 'main.cpp' target datalayout =…
Gaetano
  • 1,090
  • 1
  • 9
  • 25
16
votes
1 answer

Name mangling confusion in LLVM

I have been trying to build and execute LLVM modules. My code for generating the modules is quite long, so I won't post it here. Instead my question is about how Clang and LLVM work together to achieve name mangling. I will explain my specific issue…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
9
votes
2 answers

lli: LLVM ERROR: Cannot select: X86ISD::WrapperRIP TargetGlobalTLSAddress:i64

Running the following code with clang++ -S -emit-llvm main.cpp && lli main.ll on Linux(Debian) #include int main () { return std::async([]{return 1;}).get(); } fails to run on lli due to the following error: LLVM ERROR: Cannot select:…
Gaetano
  • 1,090
  • 1
  • 9
  • 25
6
votes
1 answer

llvm error: Relocation not implemented yet! when running RxCpp in orcjit or lli

I would like to run RxCpp example in llvm's IR interpreter lli. Unfortunately, running any of the RxCpp examples fails in lli: git clone https://github.com/Reactive-Extensions/RxCpp.git --depth 1 cd RxCpp/Rx/v2/examples/pythogerian clang++ -S…
Gaetano
  • 1,090
  • 1
  • 9
  • 25
5
votes
1 answer

LLVM produced by rustc gives error about argument type of main when run with lli

I'm trying to learn a little about the LLVM IR, particularly what exactly rustc outputs. I'm having a little bit of trouble running even a very simple case. I put the following in a source file simple.rs: fn main() { let x = 7u32; let y = x…
Harry Braviner
  • 627
  • 4
  • 12
4
votes
0 answers

External functions from standard libraries are unresolved in lli

I am trying to run simple code in llvm lli (according to Getting Started with the LLVM System) #include int main() { printf("hello world\n"); return 0; } I got the .bc file with clang –O3 –emit-llvm hello.c –c –o hello.bc and lli…
yehudahs
  • 2,488
  • 8
  • 34
  • 54
3
votes
1 answer

LLVM Interepreter (lli) and shared object loading

I'm trying to use lli to interpret/JIT-compile a bitcode file a.bc that uses functions defined in a shared object afl-llvm-rt.so. When I try to use lli like this lli -dlopen ./afl-llvm-rt.so a.bc I get: PLEASE submit a bug report to…
3
votes
2 answers

How to run LLVM interpreter with a shared library?

I have mylib.c file which has some functions. I want to use those functions from my .c file as external ones in compiled llvm code. I'm playing with LLVM interpreter (lli-4.0) and I wonder how can I tell lli to use functions from my .c file?
vrom911
  • 694
  • 1
  • 5
  • 16
3
votes
0 answers

how to perform TargetLowering in a IR-trasformation pass?

To provide TLS support to orcjit, I'm like to transforom llvm::Modules without TLS emulation to ones that emulateTLS and depend on a Runtime. Similar functionality is already implemented in TargetLowering::LowerToTLSEmulatedModel, however it does…
Gaetano
  • 1,090
  • 1
  • 9
  • 25
2
votes
0 answers

How to Use LLVM JIT to execute c++ ir code on windows

the c++ code: #include int main() { std::cout << "hello world\n"; } use clang & lli: clang++ -S -emit-llvm hello.cpp -o hello.ll lli.exe hello.ll It reports a fatal error, something like "Program used external function…
yuucyf
  • 21
  • 2
1
vote
2 answers

lli is generating run-time error for clang++ generated IR while the generated executable is not generating run-time error for c++ source code

I am trying to generate a bit code from a c++ source code and running through the just-in-time compiler. When I compile through the clang++ and generate binary executable it runs perfectly but when I generated the bitcode and tried running through…
Leer
  • 11
  • 1
1
vote
1 answer

How can use I Address Sanitizer in lli (LLVM)

I would like to run a bitcode with address sanitizer argument, but I have a problem with that, if I run it, the segmentation fault will happen. $cat sample.c #include void *p; int main() { p = malloc(7); return 0; } $clang -emit-llvm…
David Tex
  • 87
  • 6
1
vote
1 answer

Compiled Haskell program to LLVM IR is missing main

following this SO post regarding the compilation of Haskell programs to LLVM IR, I took the same Haskell program and tried to run its resulting LLVM IR code: quicksort [] = [] quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) …
OrenIshShalom
  • 5,974
  • 9
  • 37
  • 87
0
votes
1 answer

NUnit tests calling cmd.exe commands with use of Processes don't pass

So I'm creating an NUnit project where each test: runs a new Process from System.Diagnostics uses cmd.exe to call lli.exe with an LLVM code file as an argument checks exit code and output of this command Everything goes well and tests are passed…
daveedoo
  • 1
  • 1
0
votes
1 answer

Using printf in LLVM IR

So, I have been writing a compiler for a simple lisp using Rust and generating LLVM IR using the Inkwell crate. While trying to find a way to print values to standard output, I came across many answers for using print function just like in C/C++. It…
Ayush Singh
  • 1,409
  • 3
  • 19
  • 31
1
2