how to debug go build errors

Ian Lance Taylor
Fri Feb 9 00:39:00 GMT 2018

On Thu, Feb 8, 2018 at 3:24 PM, Martin Sebor <> wrote:
> While testing what should be an innocuous patch to add LTO
> to a bunch of middle-end warning options
> I get Go errors during ordinary bootstrap about undefined names
> for errno constants:
> /opt/notnfs/msebor/src/gcc/84212/libgo/go/syscall/env_unix.go:96:10: error:
> reference to undefined name ‘EINVAL’
> Bootstrapping all other front ends (including Ada and Brig),
> succeeds and there are no regressions in the test suite.
> I have no experience with Go.  Does anything about the patch
> jump out at you that could be causing this?  If not, can you
> suggest how to debug it?

No, I don't see why your patch would cause this problem.

EINVAL should be defined in the generated file
TARGET/libgo/sysinfo.go.  You should see, among many others, the lines
    const _EINVAL = 22
    const EINVAL = Errno(_EINVAL)

That file is built by the shell script libgo/, which looks
at the generated file TARGET/libgo/gen-sysinfo.go.  The gen-sysinfo.go
file is built by running the C compiler with the -fdump-go-spec option
on the file libgo/sysinfo.c (essentially GCC_FOR_TARGET
-fdump-go-spec=gen-sysinfo.go -std=gnu99 -S sysinfo.c).  I guess
something along that chain has broken, but I don't know what.


More information about the Gcc mailing list