From a9e991ac21c91599c55512191204d72bc8c18947 Mon Sep 17 00:00:00 2001 From: Peefy Date: Mon, 15 Jan 2024 18:41:19 +0800 Subject: [PATCH] feat: add linux aarch64 llvm target (#988) Signed-off-by: peefy --- kclvm/compiler/src/codegen/llvm/emit.rs | 4 +++- scripts/docker/kcl-builder-arm64/Dockerfile | 2 +- scripts/docker/kcl-builder/Dockerfile | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kclvm/compiler/src/codegen/llvm/emit.rs b/kclvm/compiler/src/codegen/llvm/emit.rs index 90397abd0..4077dfd2f 100644 --- a/kclvm/compiler/src/codegen/llvm/emit.rs +++ b/kclvm/compiler/src/codegen/llvm/emit.rs @@ -28,9 +28,11 @@ pub fn emit_code( ) -> Result<(), Box> { // Init LLVM targets LLVM_INIT.get_or_init(|| { - // TODO: linux arm and WASM target. + // TODO: WASM target. #[cfg(target_os = "linux")] inkwell::targets::Target::initialize_x86(&Default::default()); + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + inkwell::targets::Target::initialize_aarch64(&Default::default()); #[cfg(not(target_os = "linux"))] inkwell::targets::Target::initialize_all(&Default::default()); }); diff --git a/scripts/docker/kcl-builder-arm64/Dockerfile b/scripts/docker/kcl-builder-arm64/Dockerfile index da108c80c..bf33a3a27 100644 --- a/scripts/docker/kcl-builder-arm64/Dockerfile +++ b/scripts/docker/kcl-builder-arm64/Dockerfile @@ -8,7 +8,7 @@ FROM arm64v8/ubuntu:20.04 RUN apt-get update -RUN apt-get install -y curl make gcc git zlib-dev zlib1g-dev +RUN apt-get install -y curl make gcc git zlib1g-dev # rust RUN curl https://sh.rustup.rs -sSf | bash -s -- -y diff --git a/scripts/docker/kcl-builder/Dockerfile b/scripts/docker/kcl-builder/Dockerfile index e070b45ff..4e04df6fd 100644 --- a/scripts/docker/kcl-builder/Dockerfile +++ b/scripts/docker/kcl-builder/Dockerfile @@ -43,7 +43,7 @@ RUN apt-get install -y clang-12 lld-12 RUN ln -sf /usr/bin/clang-12 /usr/bin/clang RUN ln -sf /usr/bin/wasm-ld-12 /usr/bin/wasm-ld -# golang 1.19+ +# golang 1.20+ RUN mkdir -p /root/download && cd /root/download \ && wget https://dl.google.com/go/go1.20.5.linux-amd64.tar.gz \ && tar -zxvf go1.20.5.linux-amd64.tar.gz \