go version go1.18 gollvm LLVM 15.0.0git 20220823 (experimental) linux/amd64
I might have replied to you only, because the post is not shown on the discussion. 在2022年10月28日星期五 UTC+8 00:11:27<th...@google.com> 写道: > >/data/mygo/gollvm_workarea/install/bin/llvm-goc: error: unrecognized > command line option '-fgo-importcfg=/dev/null' > > The Go command only passes this option to the compiler if it thinks that > the compiler is the main go compiler ("gc") as opposed to gollvm. What > output do you get when you run "go version" ? > > Thanks, Than > > > On Thu, Oct 27, 2022 at 12:05 PM 'Qingwei Li' via golang-nuts < > golan...@googlegroups.com> wrote: > >> the GoLLVM is based on LLVM 15.0.0 >> >> Example to reproduce: >> The structure of project is as follows: >> >> ``` >> easyPkg/ >> ├── go.mod >> ├── main.go >> └── Pkg >> └── utils.go >> ``` >> >> main.go >> >> ``` >> package main >> >> import "easyPkg/Pkg" >> >> func main() { >> Pkg.PkgFunc() >> } >> ``` >> >> utils.go >> >> ``` >> package Pkg >> >> func PkgFunc() { >> println("pkgFunc") >> } >> ``` >> >> go.mod >> >> ``` >> module easyPkg >> >> go 1.18 >> ``` >> >> use `go build -x . 2> auto.sh` to get the building process. Then delete >> the generated binary file `easyPkg` and use `go clean -cache` to clean the >> building cache. Then I use the command `source auto.sh` to regenerate the >> binary, which fails. >> >> part of the error log is as follows >> >> ``` >> /data/mygo/gollvm_workarea/install/bin/llvm-goc: error: unrecognized >> command line option '-fgo-importcfg=/dev/null' >> /data/mygo/gollvm_workarea/install/bin/llvm-goc: error: unrecognized >> command line option '-ffile-prefix-map=a=b' >> ./main.go:3:19: error: >> /tmp/go-build3415416681/b001/_importcfgroot_/easyPkg/libPkg.a exists but >> does not contain any Go export data >> ./main.go:3:19: warning: easyPkg/Pkg: Not a directory >> ./main.go:3:19: error: import file 'easyPkg/Pkg' not found >> ./main.go:6:2: error: reference to undefined name 'Pkg' >> /usr/bin/ld.gold: error: /tmp/go-build3415416681/b001/_pkg_.a: member at >> 72 is not an ELF object >> /usr/bin/ld.gold: error: /tmp/go-build3415416681/b002/_pkg_.a: member at >> 72 is not an ELF object >> buildid: open /tmp/go-build3415416681/b001/exe/a.out: no such file or >> directory >> ``` >> >> what can I do on the auto.sh script to regenerate the binary file? Is the >> process dumped completed? >> >> On a single package with no subdirectory, the result of `go build -x .` >> is available for regenerating the binary file. >> >> Moreover, my main purpose is to add -emit-llvm option wherever `llvm-goc` >> appears and use `llvm-link -S` to link all object files generated by >> llvm-goc to get a whole LLVM IR file for the whole project. If the question >> above is now insoluble, is there any other way to get the whole project's >> LLVM IR? >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/b120de38-d603-4a8d-a029-34351abc051cn%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/b120de38-d603-4a8d-a029-34351abc051cn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/9ee5ffe6-7394-4317-8767-c7d9c321e1een%40googlegroups.com.