Skip to content
/ llvm Public

llvm tools for Playbit

License

Notifications You must be signed in to change notification settings

playbit/llvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0ee183d · Mar 11, 2025

History

64 Commits
Mar 9, 2024
Mar 11, 2025
Apr 19, 2024
Mar 6, 2024
Apr 6, 2024
Sep 11, 2024
Jul 21, 2024
Jul 21, 2024
Apr 13, 2024
Feb 28, 2025
Apr 11, 2024
Sep 11, 2024
Jun 3, 2024
Jun 3, 2024
Apr 11, 2024
Apr 13, 2024
Mar 6, 2024
May 24, 2024
Apr 11, 2024
Feb 15, 2025
Apr 13, 2024
Sep 12, 2024
Jun 3, 2024
Feb 28, 2025
May 5, 2024
May 5, 2024
May 24, 2024
Jun 25, 2024
Mar 6, 2024
Apr 13, 2024
Jun 3, 2024
Jun 3, 2024
Jun 3, 2024
Feb 28, 2025
Mar 6, 2024
Mar 9, 2024
Apr 11, 2024
Apr 11, 2024
Mar 9, 2024
Dec 2, 2024
Sep 11, 2024
May 5, 2024

Repository files navigation

llvm for Playbit

Packages

The different packages are named symbolically:

  • "toolchain" contains compiler & linker for the host platform
  • "compiler-rt" contains compiler builtins & sanitizers for a target platform
  • "sysroot" contains system headers & libraries for a target platform
  • "libcxx" contains libc++ headers & libraries for a target platform
  • "llvmdev" contains llvm headers & libraries for a target platform (you don't need this)
llvm-VERSION-toolchain-HOST      clang, lld et al for running on HOST
llvm-VERSION-compiler-rt-TARGET  clang builtins, sanitizers etc for TARGET
llvm-VERSION-libcxx-TARGET       libc++, libc++abi and libunwind for TARGET
llvm-VERSION-sysroot-TARGET      libc and system headers for TARGET

Using

Use a pre-built version for your host system and install packages for whatever targets you want to build for:

$ mkdir llvm && cd llvm
$ tar -xf ../llvm-17.0.3-toolchain-$(uname -m)-playbit.tar.xz
$ tar -xf ../llvm-17.0.3-compiler-rt-aarch64-linux.tar.xz
$ tar -xf ../llvm-17.0.3-compiler-rt-x86_64-linux.tar.xz
$ tar -xf ../llvm-17.0.3-compiler-rt-wasm32-wasi.tar.xz
$ tar -xf ../llvm-17.0.3-libcxx-aarch64-linux.tar.xz
$ tar -xf ../llvm-17.0.3-libcxx-x86_64-linux.tar.xz
$ tar -xf ../llvm-17.0.3-libcxx-wasm32-wasi.tar.xz
$ tar -xf ../llvm-17.0.3-sysroot-aarch64-playbit.tar.xz
$ tar -xf ../llvm-17.0.3-sysroot-x86_64-playbit.tar.xz
$ tar -xf ../llvm-17.0.3-sysroot-wasm32-playbit.tar.xz

Build an example program:

$ cat << END > hello.c
#include <stdio.h>
int main(int argc, char* argv[]) {
  printf("hello from C program %s\n", argv[0]);
  return 0;
}
END
$ bin/clang hello.c -o hello
$ ./hello
hello from C program ./hello

Build for another architecture by setting --target:

$ bin/clang hello.c -o hello.a64 --target=aarch64-playbit
$ bin/clang hello.c -o hello.x86 --target=x86_64-playbit
$ bin/clang hello.c -o hello.wasm --target=wasm32-playbit

Let's verify that it worked:

$ for f in hello.a64 hello.x86; do \
bin/readelf --file-header $f | grep Machine; done
  Machine:                           AArch64
  Machine:                           Advanced Micro Devices X86-64
$ head -c4 hello.wasm | hexdump -c
0000000  \0   a   s   m

Building from source

See ./build.sh -h for options.

To build everything, run build.sh without arguments:

$ ./build.sh