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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b120de38-d603-4a8d-a029-34351abc051cn%40googlegroups.com.

Reply via email to