go build -gccgoflags -static-libgo -x -work 1> transcript.txt 2>&1
WORK=$(egrep -m 1 '(WORK=|llvm-goc -c)' transcript.txt | awk '{ print substr ($0, 6 ) }')
/gollvm/install/bin/llvm-goc -c -O2 -g -m64 -fdebug-prefix-map=$WORK=/tmp/go-build \
-gno-record-gcc-switches -fgo-pkgpath=$PWD \
-fgo-relative-import-path=$PWD -o $WORK/b001/_go_.o \
-I $WORK/b001/_importcfgroot_ -o $LLFILE -S -emit-llvm $MAINFILE
But when I try to convert to binary via clang the file I've some error:
clang helloworld.ll -o helloworldLLVM
warning: overriding the module target triple with x86_64-pc-linux-gnu [-Woverride-module]
1 warning generated.
/usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/helloworld-bcb8cc.o: in function `_..z2fopt..z2fvmsdk..z2fhelloworld.describe':
/opt/vmsdk/helloworld/./describe.go:6: undefined reference to `runtime.newobject'
/usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to `runtime.writeBarrier'
/usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to `fmt.Printf'
/usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to `runtime.typedmemmove'
/usr/bin/ld: /tmp/helloworld-bcb8cc.o:(.rodata.string..d[string..d]+0x18): undefined reference to `runtime.strequal..f'
/usr/bin/ld: /tmp/helloworld-bcb8cc.o:(.rodata.type...1string[type...1string]+0x18): undefined reference to `runtime.memequal64..f'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm this is the first time I use this buildchain and I don't understand what I'm doing wrong. Can someone help me?
Those are the commit I've used for build gollvm, if needed
llvm-project: 43ff75f2c3feef64f9d73328230d34dac8832a91
llvm-project/llvm/tools/gollvm: 44a7a475cfd3b871b7a5a0941b8ab1ea9d489adc
llvm-project/llvm/tools/gollvm/gofrontend: be0d2cc2df9f98d967c242594838f86362dae2e7
llvm-project/llvm/tools/gollvm/libgo/libffi: 737d4faa00d681b4c758057f67e1a02d813d01c2
llvm-project/llvm/tools/gollvm/libgo/libbacktrace: 5a99ff7fed66b8ea8f09c9805c138524a7035ece
Thanks in advance!