Questions tagged [llvm]

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. The llvm tag is mostly for writing C++ code (or another language via the C bindings) to interface with the LLVM library, not about any of the (growing amount of) tools that have LLVM under the hood. See the `llvm-codegen` tag for questions about machine code generated by LLVM.

Filter by
Sorted by
Tagged with
1 vote
0 answers
35 views

24-bit Custom Target

I'm trying to compile for a custom target that has a 24-bit pointer (the eZ80). I'm now stuck wondering if that's even possible in the current Rust toolchain? I tried creating a custom target file ...
Kestrel's user avatar
  • 13
-1 votes
0 answers
12 views

clang-16: error: linker command failed with exit code 1 (use -v to see invocation) [closed]

It's my first time to use clang. I try to run the llvm example Kaleidescope and it works when I use g++ to compile the .cc file, but it fails when using clang++ to compile it. clang++ -std=c++17 -g -...
shiiyi tong's user avatar
1 vote
1 answer
13 views

Numba: LLVM IR parsing error when trying to access elements in a typed list of jitted functions

I'm encountering an issue with Numba when trying to access elements in a typed list of jitted functions. The error message I receive is an "LLVM IR parsing error" with the line ret i8* null. ...
Dmitry Naumov's user avatar
1 vote
0 answers
25 views

is there a way to store arm64 assembly code in module using LLVM API?

I'm currently working on a compiler project using llvm. I have IR Module , But I want function which takes IR module as argument and return Assembly module of TARGET(ARM64 or aarch64). .My goal is to ...
Ayush Singh's user avatar
1 vote
1 answer
47 views

Macro to check if I am running MSVC or Intel compiler

I am using the newest Visual Studio 2022 and also installed the Intel C++ compiler. When I just write a simple main() to print the values of the macros MSC_VER and __INTEL_LLVM_COMPILER, I get ...
ijklr's user avatar
  • 145
-2 votes
0 answers
21 views

How to Compile External API Calls

I am planning to create an LLVM frontend compiler that converts JS code into LLVM IR. However, the JS code contains calls to external APIs that I've developed in C or C++. These APIs have a JavaScript ...
qorz's user avatar
  • 1
1 vote
0 answers
30 views

Compiling a program that uses PassManagerBuilder with LLVM 17

It appears LLVM has removed PassManagerBuilder.h now that they have upgraded to LLVM-17. There is a program that I would like to compile that uses PassManagerBuilder.h. Is there a way to compile it ...
John213214214's user avatar
0 votes
1 answer
17 views

Linker Errors when Building Shared Library with LLVM and C++

I'm working on a project where I'm trying to build a shared library using C++ and LLVM. The goal is to generate LLVM IR from an Abstract Syntax Tree (AST) representation of a programming language. ...
KAGE's user avatar
  • 1
0 votes
1 answer
28 views

Explaining LLVM for loop

I am following along this post however I am new to C++ and LLVM and need help breaking down what everything means in this for loop for(auto I = inst_begin(F), E = inst_end(F); I != E; ++I) { ...
corkeygo's user avatar
1 vote
0 answers
31 views

Clang format stop operators alligning on wrap

clang-format is formatting like this: std::ostream& operator<<( std::ostream& os, const Camera& c ) { return os << c.latitude << ", " << c.longitude &...
Aidan's user avatar
  • 413
-1 votes
0 answers
8 views

Install (compile) issue with LLVM + Clang with coverage options

I am trying to install LLVM through source code using the following commands to get the source coverage of Clang: $git clone https://github.com/llvm/llvm-project.git $cd llvm-project $mkdir build $cd ...
HJL's user avatar
  • 127
0 votes
1 answer
19 views

Is it possible to relocate MergedGlobals to specific bss/data regions?

I am using the MPU to grant access to specific regions of memory. (Target is a microcontroller + zephyr-rtos, rust compiled as a static lib). The app crashes with an MPU Fault. I have traced the ...
Marius's user avatar
  • 380
0 votes
1 answer
10 views

Clang Analysis CFG loop identification finds the while loop but fails to print the associated code fragment and line number

I am trying to use Clang to find all the loops at the source code level of an input source file. My code currently can identify for-loops in the source file and printout the line number. It also seems ...
Kokoro's user avatar
  • 1
1 vote
0 answers
45 views

Is it possible to call C functions from within LLVM JIT-compiled functions?

I'm trying to call one or more precompiled C functions from within one or more LLVM JIT-compiled functions. (When I say "precompiled" here, I just mean that the function is in my source ...
SocraticMathTutor's user avatar
-1 votes
0 answers
71 views

Iterator spaceship operator failing to compile on macOS but not windows or ubuntu - LLVM 15.0.2

I'm having trouble getting my custom iterator to compile on macOS when it successfully compiles on windows and ubuntu with LLVM 15.0.2. The error I get is Error: /Users/runner/work/Evie/Evie/src/...
DWil's user avatar
  • 9
0 votes
0 answers
30 views

ninja build does not pick flags while running build

I am trying to build llvm code (https://github.com/llvm/llvm-project.git) using cmake with Ninja generator. So basically as a first step i am configuring cmake with Ninja generator :- cmake configure ...
vam's user avatar
  • 11
0 votes
0 answers
19 views

How to perform data flow analysis on function parameters in IR

enter image description here How to determine whether a GEP instruction, when accessing a structure member, originates directly or indirectly from a function parameter? What I think of is the ...
Vie's user avatar
  • 3
0 votes
1 answer
27 views

GCC, GDC, and LLVM and LDC compilers’ prefetch builtins - exact meaning of the locality parameter

In the description of the x86 prefetch instructions, I found the following explanation for the instructions’ hint number "Fetches the line of data from memory that contains the byte specified ...
Cecil Ward's user avatar
0 votes
1 answer
25 views

How to build libclang_rt.builtins.a?

I'm trying to build Chromium, and I get an error that the file libclang_rt.builtins.a is missing. It seems that this file is a static library that is part of compiler-rt, so it should be getting ...
Brian Bi's user avatar
  • 112k
2 votes
1 answer
47 views

How to find SourceLocation of the outer template parameter list of a class template member function definition?

I am working on a Clang AST generated from the following source code: template<class T> struct my_class { template<class U> void foo(U arg); }; template<class V> template<...
Jared Hoberock's user avatar
0 votes
1 answer
34 views

GCC not standard / non-conforming optimization flags?

I'm looking for compiler optimization flags that disregard standards compliance to produce better performing/smaller binaries. Thus far I found: -ffast-math -fno-math-errno -funsafe-math-...
vfjpl's user avatar
  • 11
0 votes
1 answer
22 views

how to modify the operand in this IR

%1 = load i32, i32* getelementptr inbounds (%struct.A, %struct.A* @g_a, i64 0, i32 1, i32 2), align 4, !tbaa !10 I want to change the number from i64 0, i32 1, i32 2 to i64 0, i32 0, i32 1 first I get ...
Vie's user avatar
  • 3
4 votes
0 answers
220 views

Using LLVM-based tools (clang, Rust, Zig) to compile for N64

I’m trying to use the LLVM-based zig cc to compile C code (and eventually other LLVM-based languages like Rust/Zig) for the R4300i / VR4300 MIPS CPU, which is the processor in the N64. But I don't see ...
CrepeGoat's user avatar
  • 2,315
0 votes
1 answer
33 views

What is the simplest instruction set with a current supported toolchain? [closed]

I am planning as an exercise to learn Verilog to implement a CPU core. As this is my first time doing it, I am wondering what would be the simplest CPU architecture with a currently supported ...
Fred Helmers's user avatar
0 votes
0 answers
30 views

Cross-compiling a loadable kernel module for Android

I'm trying to install the LiME tool for memory dumps in Android. LiME is implemented through a loadable kernel module, which, as I understand, forces me to prepare and compile the kernel for it. Their ...
Gabriel Rebello's user avatar
0 votes
0 answers
15 views

Integrating Custom build of clang-tidy in CodeChecker

I successfully installed CodeChecker (https://codechecker.readthedocs.io/en/latest/#install-guide). The check and analyze commands that CodeChecker provided work on my input files. Now, my task is to ...
Nachiket Deo's user avatar
2 votes
1 answer
43 views

In LLVM, can you specify that two different code paths will produce the same result?

I'm writing a C library for an embedded platform, and the platform's firmware has several routines for character output. One of the subroutines is general purpose - you load the ASCII character you ...
TheHans255's user avatar
  • 2,059
1 vote
1 answer
45 views

Is there a way to insert pre-written LLVM IR into a module

I am working on a compiler, and my language requires that some functions are already implemented and available. For example, if I wanted to implement a stack in my language (software) I would use the ...
Rajesh's user avatar
  • 13
0 votes
1 answer
31 views

How to make clang-format not break after = signs and not BinPackArguments

I'm using clang-format with a small configuration file, based on the Microsoft style. --- BasedOnStyle: Microsoft BinPackParameters: 'false' BinPackArguments: 'false' ColumnLimit: '120' #Other options....
Bob from IT's user avatar
0 votes
1 answer
45 views

How to install llvm on windows?

What is the best way to install llvm on windows? All the information I found refers to build it manually. Is there a better option to do it?
Pau's user avatar
  • 14.9k
0 votes
0 answers
29 views

Buffer Overflow Exception during evaluation process GraalVM

I am trying to execute a rust function in java using GraalVMs polyglot llvm features, however It is throwing a buffer overflow exception. I compiled a rust library into a llvm bytecode file for use ...
Wes's user avatar
  • 1
0 votes
0 answers
38 views

How to compile the C file that uses LLVM on Windows

I have installed LLVM by LLVM-16.0.0-win64.exe on windows. But it doesn't include llvm-config tool. What is the command line to compile my c file that include like #include "llvm/IR/LLVMContext.h&...
qw20012's user avatar
  • 89
3 votes
1 answer
90 views

How to load pass plugin in new pass manager?

I have written a pass-plugin for obfuscation and I would like to load this plugin using clang instead of opt in Windows. However, when I use the command .\bin\clang++.exe -O1 -Xclang -fpass-plugin='./...
I3r0nya's user avatar
  • 33
0 votes
0 answers
30 views

I cannot make executable from LLVMGetFunctionAddress

I am trying to a executable based of my LLVMModule and here is my init LLVMInitializeCore(LLVMGetGlobalPassRegistry()); LLVMInitializeAllTargets(); LLVMInitializeAllTargetMCs(); ...
Kostia Ilnytskyi's user avatar
0 votes
1 answer
28 views

numba RuntimeError: No available targets are compatible with triple "arm-unknown-linux-gnu"

I am running a Python application on a Raspberry Pi (Model 4B - 8GB) and I am getting a runtime error. I had a lot of trouble even getting numba to run in the first place, because the available binary ...
stackoverflowing321's user avatar
1 vote
0 answers
39 views

determining llvm::ConstantInt type with big integers (or: what type is i501?)

In my llvm written compiler (using c++17), I want to synthesize a function that has an integer argument. If that integer's bit width is less than 65, I want that argument's type to be uint64_t. ...
Yoni's user avatar
  • 23
0 votes
0 answers
17 views

Error while compiling LLVM code: "call to non-static member function without an object argument"

I am working on an LLVM task where I need to create a custom LLVM attribute, named IsFragile. The task involves iterating over each control flow graph in the program and comparing basic block source ...
Dumbledore's user avatar
0 votes
1 answer
42 views

LLVM outputs differently than it should

I am pretty new to using LLVM C API, and never have encountered this issue before. From examples, I seen online when they create a LLVMTypeRef using LLVMIntTypeInContext and then LLVMPointerType, they ...
Kostia Ilnytskyi's user avatar
1 vote
0 answers
98 views

Why do modern C/C++ compilers put aditional unused data into the output binaries?

I'm a low-level developer and a reverse-engineer. While investigating malware and software compiled using different compilers such as LLVM GCC/G++ for windows I found out that modern compilers put ...
acessor's user avatar
  • 11
1 vote
1 answer
56 views

Is there a modern way to link with LLVM's libc++ in CMake?

I am building a C++ project for most platforms and would like to upgrade the standard to c++20. Currently, the main problem preventing this upgrade is macOS yelling at me because 10.12 does not ...
jacky la mouette's user avatar
0 votes
0 answers
11 views

When trying to build appleseed on linux against newly built llvm lib i get this error. Any possible fix?

[100%] Building CXX object src/appleseed.studio/CMakeFiles/appleseed.studio.dir/qrc_resources.cpp.o [100%] Linking CXX executable appleseed.studio /usr/bin/ld: /home/geck/gsoc_testing/prebuilt-linux-...
Abhiram's user avatar
0 votes
0 answers
14 views

Failed to compile with "-DLLVM_DISTRIBUTION_COMPONENTS="cxx;cxxabi;cxx-headers"

When trying to build cxx (LLVM 16), I got tons of errors saying missing headers and missing libraries. The build command was cmake -G Ninja /workspace/llvm-project/llvm \ -DLLVM_ENABLE_RUNTIMES=&...
aur3l14no's user avatar
1 vote
1 answer
31 views

Premake5 on Linux: Incorrect path for make include file

I have a premake5.lua file which I use to build my projects. The system works correctly on Windows, but as soon as I try to run the generated Makefiles on Linux with sudo make I get errors related to ...
Goubermouche's user avatar
0 votes
2 answers
79 views

Extract symbol table from ELF into a .o

I'm writing a bare metal application for a device connected over serial. The device already has some base code on it (maybe considered an OS), but I want to be able to cross-compile code on my ...
Michael M.'s user avatar
  • 10.5k
0 votes
0 answers
35 views

Some of the ASan option of LLVM Clang is not available while targeting risc-v

I'm observing the exact execution of the Address Sanitizer supported by LLVM. To do so, I was compiling some test codes with the option argument -fsanitize, just like -fsanitize=address, -fsanitize=...
8492nd's user avatar
  • 1
3 votes
2 answers
143 views

what compiler optimizations would be needed to optimize out this recursive call?

Here are two versions of a trivial arithmetic expression evaluator (playground link: https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=...
ajp's user avatar
  • 1,723
0 votes
0 answers
33 views

I want to access an array element without a ConstantInt LLVM

I'm currently creating a compiler for my programming language. Each statement has a codegen method which generate the IR for it. When creating the codegen method for the subscript expression (e.g. ...
Gkcrafting's user avatar
0 votes
1 answer
27 views

Extracting array index variable and for loop iteration variable in LLVM IR

I want to write a LLVM pass to get array indexing info and for loop index info of a program. Consider the following very simple program which accesses a 2D array. int main() { int i, j, arr2d[5][...
Atanu Barai's user avatar
0 votes
1 answer
91 views

Error with "#include <cstdint>" using Clang++-17

I installed llvm-17 using Automatic install script(https://apt.llvm.org/llvm.sh) into my Ubuntu machine. Then, I tried to compile some c++ files, but Compile Failed. main.cc:1:10: fatal error: '...
Rurou2's user avatar
  • 167
0 votes
1 answer
57 views

How to cast `[8 x i1]` to `i8` in LLVM IR

I am writing a compiler that generates LLVM IR. But the helper library (ollvm) I am using supports only three integer types: i1, i32 and i64. However, I need byte (i8) values for chars and strings. ...
Furetur's user avatar
  • 471

1
2 3 4 5
128