export GCCGO=gccgo-9
go build -compiler=gccgo -gccgoflags -static
it fails with
# github.com/paleozogt/helloworld
/tmp/go-build070129611/b001/_gomod_.go:3:3: error: __debug_modinfo__ is not a function; //go:linkname is only supported for functions
3 | //go:linkname __debug_modinfo__ runtime.modinfo
| ^
If I don’t use gccgo, it works. Or, if I use gccgo and delete go.mod, the above command works. So, I can either build modules or use gccgo, but not both. What is going on here?
Using go 1.14rc1 is also broken, though the error changes to:
# github.com/paleozogt/helloworld
/usr/bin/ld: $WORK/b001/_pkg_.a(_go_.o): in function `main.main..init0':
/tmp/go-build/b001/_gomod_.go:5: undefined reference to `runtime.setmodinfo'
collect2: error: ld returned 1 exit status