From 25aa8bd7dad447ccbe2b855e5bc2b75c35e3dc21 Mon Sep 17 00:00:00 2001 From: modeco80 Date: Mon, 17 Jul 2023 02:09:59 -0400 Subject: [PATCH] uh i guess try this --- README.md | 5 +++-- ideas.md | 20 +++++++++++--------- scripts/build_llvm.sh | 22 +++------------------- 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index c65fd78..6d22371 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,13 @@ It provides: TODO: Steps to build the LCPU native module on Windows and Linux -LLVM is built using a podman container (see Containerfile). The steps for replicating this build follow: +LLVM is built using a podman container (see Containerfile). The steps for building follow (this should only need to be done once): ``` mkdir llvm_build podman build -t llvm-build -f Containerfile.llvm -podman run --rm --cpus 24 -m 32G --mount type=bind,source=$PWD/llvm_build,destination=/build/llvm-build localhost/llvm-build +podman run --rm --mount type=bind,source=$PWD/llvm_build,destination=/build/llvm-build localhost/llvm-build +cp -rv llvm_build/install lua/bin/llvm ``` diff --git a/ideas.md b/ideas.md index 729ae70..22abb19 100644 --- a/ideas.md +++ b/ideas.md @@ -19,14 +19,16 @@ This is basically the working ideas for the LCPU project. ### Integrated simple project workflow ### LLVM integration -- LLVM assembler (llvm-mc) is used - - clang for C code? (if it's not prohibitively expensive) - - In all cases (as/clang), the tools will all be firewalled to the given project data directory. - In the case of clang, an addional path will be allowed (clang freestanding headers), but that's the only exception. - - LLVM tools integrated into server library? Or installed in lua/bin? +- Use LLVM tools (clang as both assembler driver and C/C++ driver) for compilation. + - Prebuilt toolchain with compiler-rt can be built. (only needed since compiler-rt isn't usually built with most system clang installations.) -- Write assembly/maybe C code using a tiny project system (data for them would go in server data folder ?) +- Write assembly/maybe C/C++ code using a tiny project system (data for them would go in server data folder ?) + +- No conditional compilation + - All files in a project are built by that project + +- Diagnostic integration (by either using libclang) - Text editor used to edit project source files @@ -38,7 +40,7 @@ This is basically the working ideas for the LCPU project. - possibly override for "respectful" users and admins (admins probably wouldn't even count)? - Admin controlled per-user max LCPU entity count (default 8) - - Admins don't count + - Admins don't count to limits - Admin controled global (affects all placed LCPUs) scheduler cycle rate. - Couldn't be faster than tickrate though or we might block source (and.. well, i dont think i have to explain) @@ -48,5 +50,5 @@ This is basically the working ideas for the LCPU project. ## Addon interopability - Wiremod interopability - - Wiremod GPIO (which uses normal wire stuff) - - Console Screen + - Wiremod GPIO peripheral (to interface with wire world) + - special Console Screen peripheral (interfacing specifically with it) diff --git a/scripts/build_llvm.sh b/scripts/build_llvm.sh index c7d5891..507d0ab 100755 --- a/scripts/build_llvm.sh +++ b/scripts/build_llvm.sh @@ -15,26 +15,10 @@ cmake -Wno-dev -GNinja -S /build/llvm/llvm -B /build/llvm-build/build \ -DCMAKE_INSTALL_PREFIX="/build/llvm-build/install" \ -DLLVM_INCLUDE_TESTS=OFF \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ + -DLLVM_ENABLE_RUNTIMES="compiler-rt" \ + -DCOMPILER_RT_BAREMETAL_BUILD=ON \ -DLLVM_TARGETS_TO_BUILD="RISCV" \ - -DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-none-gnu" + -DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-unknown-gnu" ninja -C /build/llvm-build/build -j $JOBS ninja -C /build/llvm-build install - -# Build compiler-rt with our toolchain. -cmake -Wno-dev -GNinja -S /build/llvm/compiler-rt -B /build/llvm-build/build-compiler-rt \ - -DCMAKE_C_COMPILER="/build/llvm-build/install/bin/clang" \ - -DCMAKE_CXX_COMPILER="/build/llvm-build/install/bin/clang++" \ - -DCMAKE_C_FLAGS="-target riscv32-none-gnu" \ - -DCMAKE_CXX_FLAGS="-target riscv32-none-gnu" \ - -DCMAKE_INSTALL_PREFIX="/build/llvm-build/install/lib/clang/${LLVM_VERSION}" \ - -DLLVM_CONFIG_PATH="/build/llvm-build/install/bin/llvm-config" \ - -DCOMPILER_RT_BAREMETAL_BUILD=ON \ - -DCOMPILER_RT_BUILD_SANITIZERS=OFF \ - -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \ - -DCOMPILER_RT_BUILD_PROFILE=OFF \ - -DCOMPILER_RT_BUILD_MEMPROF=OFF \ - -DCOMPILER_RT_BUILD_ORC=OFF - -ninja -C /build/llvm-build/build-compiler-rt -j $JOBS -ninja -C /build/llvm-build/build-compiler-rt install