Prepare to commit to gollvm#30
Draft
melonedo wants to merge 5 commits intoplctlab:gollvm-build-riscvfrom
Draft
Conversation
Add support for compiling gollvm for other arch by specifying GOLLVM_DRIVER_DIR to a prebuilt gollvm with two targets, and specify target, toolchain and sysroot in GOLLVM_EXTRA_GOCFLAGS.
Example usage:
RISCV=$HOME/toolchain
SOURCE=$HOME/llvm-project/llvm
TRIPLE=riscv64-unknown-linux-gnu
# host
cmake -G Ninja -S $SOURCE -B build-x86 \
-DCMAKE_INSTALL_PREFIX=install-x86 \
-DCMAKE_BUILD_TYPE=Debug \
-DLLVM_USE_LINKER=bfd \
-DGOLLVM_DEFAULT_LINKER=bfd \
-DLLVM_TARGET_ARCH="X86-64,RISCV64" \
-DLLVM_TARGETS_TO_BUILD="X86;RISCV"
# crosscompile
cmake -G Ninja -S $SOURCE -B build-riscv \
-DCMAKE_INSTALL_PREFIX=$INSTALL \
-DCMAKE_BUILD_TYPE=Debug \
-DLLVM_USE_LINKER=bfd \
-DGOLLVM_DEFAULT_LINKER=bfd \
-DCMAKE_CROSSCOMPILING=True \
-DLLVM_TARGET_ARCH=RISCV64 \
-DLLVM_DEFAULT_TARGET_TRIPLE=$TRIPLE \
-DLLVM_TARGETS_TO_BUILD=RISCV \
-DCMAKE_C_COMPILER=$RISCV/bin/$TRIPLE-gcc \
-DCMAKE_CXX_COMPILER=$RISCV/bin/$TRIPLE-g++ \
-DLLVM_TABLEGEN=$PWD/build-x86/bin/llvm-tblgen \
-DGOLLVM_DRIVER_DIR=$PWD/build-x86/bin \
-DGOLLVM_EXTRA_GOCFLAGS="--target=$TRIPLE \
--gcc-toolchain=$RISCV/ \
--sysroot=$RISCV/sysroot" \
-DGOLLVM_USE_SPLIT_STACK=OFF \
-DCMAKE_C_FLAGS=-latomic \
-DCMAKE_CXX_FLAGS=-latomic
# build gollvm crosscompiler
ninja -C build-x86 llvm-goc llvm-goc-token llvm-godumpspec
# cross compile gollvm, go tools and install
ninja -C build-riscv install-gollvm
Change-Id: Ie4997771fd21437f65d857b7aaae267b7a394f23
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/425199
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Currently, architecture information is passed to the compiler but not the integrated assembler, causing discrepancies in the ABI chosen by the two tools, especially on the RISC-V platform. This patch makes sure both share the same architecture information. Change-Id: I29f441e86e06f1f0b46c3ea62576a7d1291c2ce4 Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/425854 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
c1aec5f to
773e89c
Compare
This patch adds relevant flags for builoding on RISC-V linux platform, its C-ABI setup is on another patch. Change-Id: Ibfe22aabb7a6718ccf3e55c6cc35f70953d972d4
773e89c to
a7a31f2
Compare
This patch sets up the C-ABI oracle for the RISC-V linux platform. The main changes are: 1. The C calling convention is used to identify this platform. 2. C-ABI oracle and compile options are set for RISC-V linux. 3. The ABI is hardcoded as lp64d on RISC-V linux. Change-Id: I640cd7dbaf7d7efb6abdba93a04e9b9a37244eca
The check_xxx_tool tests fail immediately because go.mod is not present in the test directory. This patch copies these files to enable them but relies on the existence of go.sum, is there a better way? Change-Id: Ibb67d5bd687da3ca6e3ee63f4d787c1fc468e6ab
a7a31f2 to
4529268
Compare
Contributor
Author
|
Commit titles and descriptions are updated. |
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.
The first two commits are already merged into gollvm master. The last commit is likely to be changed so will be committed individually.The other two commits are to be committed.