plctlab / gollvm Goto Github PK
View Code? Open in Web Editor NEWPorting gollvm to riscv64 platform.
License: Other
Porting gollvm to riscv64 platform.
License: Other
[65/1543] Performing configure step for 'libgmp'
FAILED: tools/gollvm/libgmp-prefix/src/libgmp-stamp/libgmp-configure /home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/libgmp-prefix/src/libgmp-stamp/libgmp-configure
cd /home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/external/gmp-build && /home/sunshaoce/bin/cmake-3.21.4-linux-x86_64/bin/cmake -P /home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/libgmp-prefix/src/libgmp-stamp/libgmp-configure-Debug.cmake && /home/sunshaoce/bin/cmake-3.21.4-linux-x86_64/bin/cmake -E touch /home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/libgmp-prefix/src/libgmp-stamp/libgmp-configure
CMake Error at /home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/libgmp-prefix/src/libgmp-stamp/libgmp-configure-Debug.cmake:49 (message):
Command failed: 1
'/home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/external/gmp/configure' '--prefix=/home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/external/install' 'CFLAGS=-I/home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/external/install/include -fPIC -DPIC' 'LDFLAGS=-L/home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/external/install/lib' 'CC=/home/sunshaoce/bin/riscv/linux/bin/riscv64-unknown-linux-gnu-gcc' 'CXX=/home/sunshaoce/bin/riscv/linux/bin/riscv64-unknown-linux-gnu-g++'
See also
/home/sunshaoce/pro/gollvm-project/llvm-project/build/tools/gollvm/libgmp-prefix/src/libgmp-stamp/libgmp-configure-*.log
ninja: build stopped: subcommand failed.
On ubuntu-20.04.2-preinstalled-server-riscv64 (qemu):
cmake -DCMAKE_BUILD_TYPE=Debug -DGOLLVM_USE_SPLIT_STACK=OFF -DGOLLVM_DEFAULT_LINKER=bfd -DLLVM_USE_LINKER=bfd -DLLVM_TARGETS_TO_BUILD="RISCV" -G Ninja ../llvm-project/llvm -D CMAKE_INSTALL_PREFIX=../install-debug/
ninja gollvm
Error:
[1/1215] Building Go package 'runtime' (PIC)
FAILED: tools/gollvm/libgo/.pic/runtime.o
cd /home/ubuntu/build-debug/tools/gollvm/libgo && /usr/bin/cmake -E make_directory ././.pic && /home/ubuntu/build-debug/./bin/llvm-goc -c -o /home/ubuntu/build-debug/tools/gollvm/libgo/./.pic/runtime.o -fPIC -fgo-pkgpath=runtime -fgo-c-header=runtime.inc.raw -fgo-compiling-runtime -fno-split-stack -I . /home/ubuntu/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/alg.go
[list of source files] /home/ubuntu/build-debug/tools/gollvm/libgo/goroot.go
PromoteIntegerOperand Op #0: t23: i64 = EH_DWARF_CFA Constant:i32<0>, cgo_gccgo.go:86:16
Do not know how to promote this operator's operand!
UNREACHABLE executed at /home/ubuntu/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:1567!
#0 0x0000002abf47bf68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (.localalias) /home/ubuntu/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:22
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/ubuntu/build-debug/./bin/llvm-goc
[see above]
/home/ubuntu/build-debug/tools/gollvm/libgo/goroot.go
1. Running pass 'Function Pass Manager' on module 'gomodule'.
2. Running pass 'RISCV DAG->DAG Pattern Instruction Selection' on function
'@syscall.CgocallBack'
Aborted (core dumped)
Hardware: unmatched004
comand: ninja check-gollvm -k 20
all log:
log-check-gollvm-k-20.txt
输入:llvm-goc --target=riscv64-unknown-linux-gnu -march=rv64gc -fgo-pkgpath=foo -O0 -S test.go -o test.s
test.go 的内容
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
遇到的问题
test.go:4:5: error: reference to undefined name 'fmt'
unsupported llvm::CallingConv::ID 0
unsupported llvm::CallingConv::ID 0
unsupported llvm::CallingConv::ID 0
unsupported llvm::CallingConv::ID 0
Latest code: https://github.com/realqhc/gollvm/tree/gollvm-build-riscv
Download : llvm-goc bin:https://github.com/realqhc/gollvm/releases/tag/0.0.1
cat hello.go
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
llvm-goc -static-libgo -latomic hello.go
$ ./a.out
Segmentation fault (core dumped)
gdb a.out
GNU gdb (Ubuntu 10.1-2ubuntu2) 10.1.90.20210411-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "riscv64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...
(gdb) r
Starting program: /home/liaochunyu/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/riscv64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
runtime.argv_index (argv=0x30000000003, i=-2967) at /home/anakano/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/runtime1.go:69
69 /home/anakano/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/runtime1.go: No such file or directory.
(gdb)
复现方法:
clone yt的llvm-for-gollvm分支,clone我的fork中gollvm-build-riscv分支
cd llvm/tools
git clone [email protected]:realqhc/gollvm.git -b gollvm-build-riscv --recusive
cd ../../
mkdir build; cd build
cmake -DCMAKE_BUILD_TYPE=Debug `-DGOLLVM_USE_SPLIT_STACK=OFF -DGOLLVM_DEFAULT_LINKER=bfd -DLLVM_USE_LINKER=bfd -G Ninja ../llvm
ninja gollvm
报错
tools/gollvm/libgo/ffi.h:504:5: error: #if with no expression
504 | #if
| ^
llvm: upstream commit bfb4c0c37078aa5ce251752d99310ccb05e1296a
gollvm: upstream commit 0e34e09
environment: p6
steps:
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_LINKER=gold -G Ninja ../llvm
ninja check-gollvm -k 30
all log:
log_x86.txt
126:FAILED: tools/gollvm/libgo/CMakeFiles/check_libgo_runtime_debug
128:failed to rethrow unwind exception (reason=5)
188:FAILED: tools/gollvm/gotools/CMakeFiles/check_cgo_tool
201:FAILED: tools/gollvm/gotools/CMakeFiles/check_carchive_tool
206:FAILED: tools/gollvm/gotools/CMakeFiles/check_vet_tool
211:FAILED: tools/gollvm/gotools/CMakeFiles/check_go_tool
285:FAILED: tools/gollvm/libgo/CMakeFiles/check_libgo_mime
287:--- FAIL: TestTypeByExtensionUNIX (0.00s)
289:FAIL
480:FAILED: tools/gollvm/libgo/CMakeFiles/check_libgo_runtime
484:FAILED: tools/gollvm/gotools/CMakeFiles/check_runtime_with_gotool
490:FAILED: tools/gollvm/libgo/CMakeFiles/check_libgo_runtime_pprof
492:--- FAIL: TestCPUProfile (7.13s)
706:--- FAIL: TestCPUProfileLabel (6.94s)
896:--- FAIL: TestCPUProfileMultithreadMagnitude (18.76s)
898: --- FAIL: TestCPUProfileMultithreadMagnitude/serial (7.32s)
1099: --- FAIL: TestCPUProfileMultithreadMagnitude/parallel (11.44s)
1594: pprof_test.go:126: Failure of this test may indicate that your system suffers from a known Linux kernel bug fixed on newer kernels. See https://golang.org/issue/49065.
1595:--- FAIL: TestCPUProfileMultithreaded (8.53s)
1981:--- FAIL: TestCPUProfileRecursion (7.14s)
2359:--- FAIL: TestLabelSystemstack (7.26s)
2641:--- FAIL: TestTimeVDSO (6.93s)
2921:FAIL
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.