Skip to main content

All Questions

Tagged with
0 votes
1 answer
51 views

How to convert LLVM IR to other Intermediate Representations?

I want to know how LLVM IR can be converted t other intermediate representations. I know that using llc -march=wasm32 -filetype=asm arithmetic.ll -o example.wat one can convert LLVM IR to the WASM IR ...
Aditya Anand's user avatar
0 votes
0 answers
138 views

Compile clang into WASM using WASI-SDK

I'm trying to compile "clang" and "lld" into web assembly with the WASI-SDK 21.0 as my system root directory. I got build errors while compiling but I cannot resolve them properly. ...
Michael's user avatar
  • 327
0 votes
1 answer
814 views

How to compile C to LLVM IR in the browser with WASM?

I see through How to make clang compile to llvm IR that you can generate LLVM IR from C like this: clang -S -emit-llvm foo.c Which produces foo.ll as an LLVM IR-containing file. I see two WASM ...
Lance's user avatar
  • 77.9k
0 votes
0 answers
25 views

How does the instruction "atomic.fence" work on the code generated through LLVM "stackify pass"?

I am trying to find some example cases regarding the WebAssembly instruction atomic.fence, but what I only found on the Internet are the test cases in the LLVM implementation of this instruction, and ...
Jason Yu's user avatar
  • 2,022
5 votes
0 answers
208 views

Calling webassembly gc functions in c using emscripten/llvm

I am porting a library that uses libgc's garbage collected allocation to web using the emscripten/LLVM toolchain. I am aware that webassembly has MVP gc support. My idea is to redefine GC_MALLOC (the ...
uucp's user avatar
  • 429
0 votes
2 answers
234 views

compilation error of c code to web assembly

I am trying to compile a simple C code to web assembly $ clang --target=wasm32 main.c -o primes.wasm main.c:1:10: fatal error: 'stdio.h' file not found #include <stdio.h> ^~~~~~~~~ 1 ...
OrenIshShalom's user avatar
1 vote
0 answers
307 views

How to work with a reference to a JS object inside WASM, which is compiled from C++?

I'm trying to develop a C++ library that will work with HTML elements. So, I need classes that will store references to Element, which I will get through document.getElementById("id"). Since ...
pawn1337's user avatar
1 vote
1 answer
350 views

Invalid alignment value (Producer: 'LLVM14.0.0git' Reader: 'LLVM 13.0.0git')

I try to build wasm on my ubuntu desktop. I'm using Ubuntu 22.04 I tried to install llvm-14 in terminal. But it didn't work. Error is here: Invalid alignment value (Producer: 'LLVM14.0.0git' Reader: '...
efeozkesici's user avatar
4 votes
1 answer
3k views

Error linking .o file to .wasm with wasm-ld

I've been trying to convert a cpp file to wasm without emscripten recently and I've been running with some errors, for example, when I run these commands: clang++ --target=wasm32 -nostdlib -O3 -o ...
MisterJuanXDLOL's user avatar
1 vote
1 answer
881 views

WebAssembly wasm-ld cannot resolve __builtin_memcpy and __builtin_memset

I'm working on a C++/Wasm-Module and have a hard time with clang and wasm-ld. the toolchain lets me use builtin functions like __builtin_clz __builtin_floorf just fine. The following functions are ...
StefTheDrummer's user avatar
5 votes
1 answer
2k views

Can't compile to .wasm on Linux

Summary (Edit: removed all unnecessary information, added Windows10 experience, upgraded CLANG on Ubuntu to the same version, removed Debian10 due to old CLANG version) I've created a pretty simple ...
ern0's user avatar
  • 3,152
0 votes
1 answer
597 views

Does llvm support exception handling in WebAssembly?

The Exception Handling Proposal has been implemented in some environments, e.g. in binaryen. But has it been implemented in llvm yet? Will llvm based compilers (with wasm as a target) like clang or ...
talz's user avatar
  • 1,140
1 vote
0 answers
453 views

How should I translate RISC-V bytecode into WASM?

For a project I'm working on, it would be useful to be able to run RISC-V assembly in the browser fast. From what I can tell, I think the fastest way to do this is to translate the RISC-V assembly/...
A. Kriegman's user avatar
2 votes
2 answers
1k views

Accessing `__heap_base` when building a `.wasm` binary with Rust

Wanted to follow what it is done in this article: https://surma.dev/things/c-to-webassembly/ but with Rust and write a custom allocator. For that I would need to access __heap_base variable that llvm ...
Federico Rodríguez's user avatar
3 votes
1 answer
498 views

Why does clang emit i64 instructions when targeting wasm32?

I used clang --target=wasm32-unknown-wasi ... to compile a Hello World C program into WebAssembly. Everything goes fine, and the .wasm file can run correctly in runtime like wasmer. But when I check ...
gank york's user avatar

15 30 50 per page