Conversation
Add support for compiling gollvm for other arch by specifying GOLLVM_DRIVER_DIR to a prebuilt gollvm with two targets, and folders of crosscompiler by -L, -I in GOLLVM_EXTRA_GOCFLAGS. Example usage: cmake -Wno-dev -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CROSSCOMPILING=True -DLLVM_DEFAULT_TARGET_TRIPLE=riscv64-unknown-linux-gnu -DGOLLVM_USE_SPLIT_STACK=OFF -DLLVM_TARGET_ARCH=RISCV64 -DLLVM_TARGETS_TO_BUILD=RISCV -DCMAKE_C_COMPILER=/opt/riscv/bin/riscv64-unknown-linux-gnu-gcc -DCMAKE_CXX_COMPILER=/opt/riscv/bin/riscv64-unknown-linux-gnu-g++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-latomic -DCMAKE_CXX_FLAGS=-latomic -DCMAKE_INSTALL_PREFIX=/tmp/gollvm-install -DLLVM_USE_LINKER=bfd -DGOLLVM_DEFAULT_LINKER=bfd -DLLVM_TABLEGEN=../build-x86/bin/llvm-tblgen -DCLANG_TABLEGEN=../build-x86/clang-tblgen -DGOLLVM_DRIVER_DIR=../build-x86/bin -DGOLLVM_EXTRA_GOCFLAGS="--target=riscv64-unknown-linux-gnu --gcc-toolchain=/opt/riscv/bin --sysroot=/opt/riscv/sysroot -I /opt/riscv/sysroot/usr/lib64/lp64d -I /opt/riscv/riscv64-unknown-linux-gnu/bin -I /opt/riscv/lib/gcc/riscv64-unknown-linux-gnu/11.1.0 -L/opt/riscv/bin" -G Ninja Change-Id: I557df1ea8e69d4dadaa6c64b7ebc076393d4c530
co-authored with Funan Zeng, Xufan Lu This CL adds linux riscv64 support for Gollvm, with this patch we can build and run Go programs with Gollvm on linux riscv64. The main changes include: 1, RISC-V C ABI implementation. 2, port existing unit test cases on amd64 to risc-v. It should be emphasized that since ld.gold does not support risc-v, we must specify force cmake to use ld.bfd, and add cmake parameter -DGOLLVM_USE_SPLIT_STACK=OFF when building. Change-Id: Iad7779cdd0c3c62611d992d3e2fc8b50a536cc95
044a777 to
6209ac8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please check! packed up for upstream