I made a issue at github, and the details are as followed:
### What version of Go are you using (`go version`)?
<pre>
$ go version
go version go1.16 gollvm LLVM 13.0.0git linux/amd64
</pre>
### Does this issue reproduce with the latest release?
yes
### What operating system and processor architecture are you using (`go env`)?
<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/jx/workspace/gowork/bin"
GOCACHE="/home/jx/.cache/go-build"
GOENV="/home/jx/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jx/workspace/gowork/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jx/workspace/gowork"
GOPRIVATE=""
GOROOT="/home/jx/.local/go"
GOTMPDIR=""
GOTOOLDIR="/home/jx/.local/gollvm/tools"
GOVCS=""
GOVERSION="go1.16 gollvm LLVM 13.0.0git"
GCCGO="/home/jx/.local/gollvm/bin/llvm-goc"
AR="ar"
CC="/home/jx/workspace/llvm_area/llvm-project/build/bin/clang"
CXX="/home/jx/workspace/llvm_area/llvm-project/build/bin/clang++"
CGO_ENABLED="1"
GOMOD="/home/jx/workspace/batch_compile/awesome-go/picfit/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4288114194=/tmp/go-build -gno-record-gcc-switches -funwind-tables"
</pre></details>
### What did you do?
<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
-->
I attempted to compile mounts of go projects with gollvm, but some of them meet reference error to `reflect` or `pthread`
Some cases are followed:
This case meet `error: undefined reference to 'reflect.unsafe_New` while compiling
```
cd s2-geojson/cmd/s2-geojson
go build .
```
`Go` mentioned above is just gollvm
This case meet 'undefined reference to 'pthread_once' and many other functions start with `pthread_`
```
cd picfit/cmd/picfit
go build .
```
### What did you expect to see?
Projects are compiled successfully as the original go compiler
### What did you see instead?
For s2-geojson, I meet:
```
/home/jx/.cache/go-build/6b/6bd003c99eb0a9e7c6ea6d372307b292ec615c75c28f9b1f696896ae2fb4272b-d(_go_.o):gomodule:function github_0com_1ugorji_1go_1codec.intf2impls.intf2impl: error: undefined reference to 'reflect.unsafe_New'
/home/jx/.cache/go-build/6b/6bd003c99eb0a9e7c6ea6d372307b292ec615c75c28f9b1f696896ae2fb4272b-d(_go_.o):gomodule:function github_0com_1ugorji_1go_1codec.Decoder.interfaceExtConvertAndDecode: error: undefined reference to 'reflect.unsafe_New'
decode.go:509: error: undefined reference to 'reflect.unsafe_New'
decode.go:14935: error: undefined reference to 'reflect.unsafe_New'
```
For picfit, I meet:
<details><summary><code>build details</code> Output</summary><br><pre>
src/libavcodec/aacdec_template.c:1143: error: undefined reference to 'pthread_once'
src/libavcodec/h264dec.c:400: error: undefined reference to 'pthread_once'
src/libavcodec/pthread_frame.c:675: error: undefined reference to 'pthread_join'
src/libavcodec/pthread_slice.c:116: error: undefined reference to 'pthread_join'
/usr/lib/gcc/x86_64-linux-gnu/8/libgcc.a(generic-morestack-thread.o):function stack_split_initialize_thread: error: undefined reference to 'pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/8/libgcc.a(generic-morestack-thread.o):function __wrap_pthread_create: error: undefined reference to 'pthread_once'
</pre></details>
Is this a inherent defect for gollvm? Or what can I do to avoid the problem?
Thank you