Skip to content

Commit

Permalink
zzzzzz: linux
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Jun 25, 2024
1 parent a817f7d commit 76a054e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 60 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build-test-centos7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and Test on centos7 amd64

on: ["push", "pull_request"]

jobs:
build-and-test-centos7:
name: Build and Test on Linux ARM64
runs-on: ubuntu-latest
container: kcllang/kcl-builder:centos7
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: "true"

- name: Run custom ARM64 Docker image
run: |
source ~/.bash_profile
cat ~/.bash_profile
export PATH=$PATH:/opt/build/bin && sed -i '' 's/llvm12/llvm7/g' kclvm/compiler/Cargo.toml
make && make release
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: kcl-centos7-amd64
path: _build/dist/centos/kclvm
30 changes: 3 additions & 27 deletions .github/workflows/build-test-linux-arm64.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Build and Test on Linux ARCH64

on:
push:
branches:
- main
pull_request:
branches:
- main
on: ["push", "pull_request"]

jobs:
build-and-test-arm64:
Expand All @@ -17,33 +11,15 @@ jobs:
uses: actions/checkout@v3
with:
submodules: "true"

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21

- name: Install prerequisites
run: |
sudo apt-get update
sudo apt-get install -y git wget curl make python3 python3-pip clang-12 lld-12
sudo ln -sf /usr/bin/clang-12 /usr/bin/clang

- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.76
override: true
components: clippy, rustfmt

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Pull custom ARM64 Docker image
run: |
docker pull --platform linux/arm64 kcllang/kcl-builder-arm64
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PROJECT_NAME = KCLVM
PWD:=$(shell pwd)

VERSION := $(shell cat VERSION)
BUILD_IMAGE:=kcllang/kcl-builder
BUILD_IMAGE:=kcllang/kcl-builder:centos7

# export DOCKER_DEFAULT_PLATFORM=linux/amd64
# or
Expand Down
3 changes: 0 additions & 3 deletions kclvm/compiler/src/codegen/llvm/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use indexmap::{IndexMap, IndexSet};
use inkwell::basic_block::BasicBlock;
use inkwell::builder::Builder;
use inkwell::context::Context;
use inkwell::debug_info::{DICompileUnit, DebugInfoBuilder};
use inkwell::memory_buffer::MemoryBuffer;
use inkwell::module::{Linkage, Module};
use inkwell::support::LLVMString;
Expand Down Expand Up @@ -137,8 +136,6 @@ pub struct LLVMCodeGenContext<'ctx> {
/// LLVM module with debug info builder and compile unit.
pub struct DebugModule<'ctx> {
pub inner: Module<'ctx>,
pub dibuilder: DebugInfoBuilder<'ctx>,
pub compile_unit: DICompileUnit<'ctx>,
}

impl<'ctx> CodeGenObject for BasicValueEnum<'ctx> {}
Expand Down
30 changes: 1 addition & 29 deletions kclvm/compiler/src/codegen/llvm/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
// Copyright The KCL Authors. All rights reserved.

use super::context::{DebugModule, LLVMCodeGenContext};
use crate::codegen::traits::ProgramCodeGen;
use inkwell::module::Module;

impl<'ctx> LLVMCodeGenContext<'ctx> {
pub(crate) fn create_debug_module(&self, module: Module<'ctx>) -> DebugModule<'ctx> {
let (dibuilder, compile_unit) = module.create_debug_info_builder(
true,
/* language */ inkwell::debug_info::DWARFSourceLanguage::C,
/* filename */ &self.current_pkgpath(),
/* directory */ ".",
/* producer */ "kcl",
/* is_optimized */ false,
/* compiler command line flags */ "",
/* runtime_ver */ 0,
/* split_name */ "",
/* kind */ inkwell::debug_info::DWARFEmissionKind::Full,
/* dwo_id */ 0,
/* split_debug_inling */ false,
/* debug_info_for_profiling */ false,
/* sys_root */ ".",
"",
);
let debug_metadata_version = self.context.i32_type().const_int(3, false);
module.add_basic_value_flag(
"Debug Info Version",
inkwell::module::FlagBehavior::Warning,
debug_metadata_version,
);
DebugModule {
inner: module,
dibuilder,
compile_unit,
}
DebugModule { inner: module }
}
}

0 comments on commit 76a054e

Please sign in to comment.