diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fddc59bb69..b15b9518b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,9 @@ jobs: strategy: matrix: config: - - {name: "Linux", os: ubuntu-latest, cmakegen: "", tc: "riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-linux-ubuntu14", tc-ext: ".tar.gz", unpack: "tar xf"} - - {name: "Windows", os: windows-latest, cmakegen: "-G \"MinGW Makefiles\"", tc: "riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-w64-mingw32", tc-ext: ".zip", unpack: "unzip"} - - {name: "Mac", os: macOS-latest, cmakegen: "", tc: "riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-apple-darwin", tc-ext: ".tar.gz", unpack: "tar xf"} + - {name: "Linux", os: ubuntu-latest, cmakegen: "", jit: "clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04", jit-ext: ".tar.xz", tc: "riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-linux-ubuntu14", tc-ext: ".tar.gz", unpack: "tar xf"} + - {name: "Windows", os: windows-latest, cmakegen: "-G \"MinGW Makefiles\"", jit: "LLVM-7.0.0-win64", jit-ext: ".exe", tc: "riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-w64-mingw32", tc-ext: ".zip", unpack: "unzip"} + - {name: "Mac", os: macOS-latest, cmakegen: "", jit: "clang+llvm-7.0.0-x86_64-apple-darwin", jit-ext: ".tar.xz", tc: "riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-apple-darwin", tc-ext: ".tar.gz", unpack: "tar xf"} runs-on: ${{ matrix.config.os }} name: ${{ matrix.config.name }} @@ -31,12 +31,22 @@ jobs: run: | choco install boost-msvc-14.1 --version=1.67.0 choco install wget unzip + choco install llvm --version=7.0.0 - name: Requirements (Mac) if: matrix.config.name == 'Mac' run: | brew install boost coreutils - + + - name: Requirements (Linux/Mac) + if: matrix.config.name == 'Linux' || matrix.config.name == 'Mac' + working-directory: ${{runner.workspace}} + shell: bash + run: | + wget https://releases.llvm.org/7.0.0/${{ matrix.config.jit }}${{ matrix.config.jit-ext }} + ${{ matrix.config.unpack }} ${{ matrix.config.jit }}${{ matrix.config.jit-ext }} + mv ${{ matrix.config.jit }} llvm-lib + - name: Requirements shell: bash working-directory: ${{runner.workspace}} @@ -51,7 +61,9 @@ jobs: - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=../install + run: | + export LLVM_DIR=${{runner.workspace}}/llvm-lib + cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=../install - name: Build working-directory: ${{runner.workspace}}/build @@ -89,5 +101,7 @@ jobs: run: | ./run_helper.sh ../SW/riscv/build/riscv_example ./run_helper.sh ../SW/riscv/build/riscv_example gcc + ./run_helper.sh ../SW/riscv/build/riscv_example llvm ./run_helper.sh ../SW/riscv_cpp/build/riscv_example ./run_helper.sh ../SW/riscv_cpp/build/riscv_example gcc + ./run_helper.sh ../SW/riscv_cpp/build/riscv_example llvm diff --git a/JITImpl/LLVM/CMakeLists.txt b/JITImpl/LLVM/CMakeLists.txt index 20dcbedc9c..4a05a27287 100644 --- a/JITImpl/LLVM/CMakeLists.txt +++ b/JITImpl/LLVM/CMakeLists.txt @@ -85,20 +85,18 @@ IF(LLVM_FOUND) ) ETISSPlugin(${PROJECT_NAME}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC - -Wl,--start-group - ${LLVM_LIBS} - clangFrontend clangCodeGen - clangLex + clangFrontend clangSerialization - clangAST - clangBasic - clangSema - clangEdit - clangAnalysis clangDriver clangParse - -Wl,--end-group - ) + clangSema + clangAnalysis + clangEdit + clangAST + clangLex + clangBasic + ${LLVM_LIBS} + ) TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC include ${LLVM_INCLUDE_DIRS}) ENDIF() diff --git a/JITImpl/LLVM/src/LLVMJIT.cpp b/JITImpl/LLVM/src/LLVMJIT.cpp index 059ad9b61a..f89624566f 100644 --- a/JITImpl/LLVM/src/LLVMJIT.cpp +++ b/JITImpl/LLVM/src/LLVMJIT.cpp @@ -163,6 +163,7 @@ void *LLVMJIT::translate(std::string code, std::set headerpaths, st args.push_back("-std=c99"); args.push_back("-isystem" + etiss::jitFiles() + "/clang_stdlib"); args.push_back("-isystem/usr/include"); + args.push_back("-isystem/usr/include/x86_64-linux-gnu"); for (const auto &headerPath : headerpaths) { args.push_back("-I" + headerPath); diff --git a/README.md b/README.md index 70cc306963..554de8dc35 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,7 @@ ETISS is supported on x86_64 Linux and Windows hosts. Tested compilers include G - GCC Compiler >= 5.0 - Boost >= 1.54 - Graphviz + Doxygen (For documentation generation) - - LLVM + Clang 7 - (If you want to use LLVM-JIT compiler then you have to setup LLVM and Clang - libraries somewhere on the host PC and source it with the environment variable - `LLVM_DIR`.) + - LLVM + Clang 7 (Please download appropriate pre-built binaries from https://releases.llvm.org/download.html) Packages for Ubuntu 18: @@ -55,6 +52,10 @@ Change to the created directory, e.g., $ cd build_dir +If LLVM-JIT compiler is used, source it with the environment variable: + + $ export LLVM_DIR=/path/to/llvm + Configure the build system, e.g., Replace `` `pwd`/installed`` with your `` if you do not like to install etiss into `build_dir/installed/`. Set up path to cmake if necessary.