...

Text file src/cmd/go/testdata/script/gccgo_link_c.txt

Documentation: cmd/go/testdata/script

     1# Issue #7573
     2# cmd/cgo: undefined reference when linking a C-library using gccgo
     3
     4[!cgo] skip
     5[!exec:gccgo] skip
     6[cross] skip  # gccgo can't necessarily cross-compile, so don't assume it will reach the step where we expect it to fail
     7
     8! go build -x -compiler gccgo
     9stderr 'gccgo.*\-L [^ ]*alibpath \-lalib' # make sure that Go-inline "#cgo LDFLAGS:" ("-L alibpath -lalib") passed to gccgo linking stage
    10! stderr 'gccgo.*-lalib.*-lalib' # make sure -lalib is only passed once
    11
    12-- go.mod --
    13module m
    14-- cgoref.go --
    15package main
    16// #cgo LDFLAGS: -L alibpath -lalib
    17// void f(void) {}
    18import "C"
    19
    20func main() { C.f() }

View as plain text