https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81970

            Bug ID: 81970
           Summary: carchive gotools tests fail
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: ubizjak at gmail dot com
                CC: cmang at google dot com
  Target Milestone: ---

Following carchive gotools tests fail in gccgo testsuite:

FAIL: TestCgoCallbackGC
FAIL: TestInstall
FAIL: TestEarlySignalHandler
FAIL: TestSignalForwarding
FAIL: TestSignalForwardingExternal
FAIL: TestOsSignal
FAIL: TestSigaltstack
FAIL: TestPIE

The problem can be seen from the gotools log dump:

=== RUN   TestInstall
FAIL: TestInstall
        carchive_test.go:160: [gcc -fPIC -m64 -pthread
-fmessage-length=0
-fdebug-prefix-map=/tmp/go-build828417309=/tmp/go-build
-gno-record-gcc-switches -funwind-tables -I pkg/gccgo_linux_amd64_fPIC
-o ./testp1 main.c main_unix.c pkg/gccgo_linux_amd64_fPIC/liblibgo.a
-lgo]
        carchive_test.go:162:
pkg/gccgo_linux_amd64_fPIC/liblibgo.a(a.out.a.o): In function
`__go_init_main':
                /tmp/go-build/libgo/_obj/_cgo_gotypes.go:3: undefined
reference to `runtime.registerGCRoots'
                pkg/gccgo_linux_amd64_fPIC/liblibgo.a(a.out.a.o): In
function `__go_init_main':

/home/uros/gcc-build/gotools/carchive-test-dir/misc/cgo/testcarchive/src/libgo/libgo.go:18:
undefined reference to `runtime.writeBarrier'

/home/uros/gcc-build/gotools/carchive-test-dir/misc/cgo/testcarchive/src/libgo/libgo.go:18:
undefined reference to `runtime.writebarrierptr'
                pkg/gccgo_linux_amd64_fPIC/liblibgo.a(a.out.a.o): In
function `gostart':

/home/uros/gcc-build/x86_64-pc-linux-gnu/libgo/../../../git/gcc/libgo/runtime/go-libmain.c:111:
undefined reference to `runtime.schedinit'

/home/uros/gcc-build/x86_64-pc-linux-gnu/libgo/../../../git/gcc/libgo/runtime/go-libmain.c:112:
undefined reference to `runtime.main'
                collect2: error: ld returned 1 exit status
        carchive_test.go:163: exit status 1

The compiler in carchive_test.go:160 is called with the following command:

gcc -fPIC -m64 -pthread -fmessage-length=0
-fdebug-prefix-map=/tmp/go-build828417309=/tmp/go-build
-gno-record-gcc-switches -funwind-tables -I pkg/gccgo_linux_amd64_fPIC
-o ./testp1 main.c main_unix.c pkg/gccgo_linux_amd64_fPIC/liblibgo.a
-lgo

Please note that with -lgo, the default system-wide libgo shared
library is linked in. However, the test expects newly compiled library
from the libgo build directory. Manually adding correct -L path to the
above command builds functional executable.

 (The system-wide library in the above example is installed from the
current gcc-7 branch).

Reply via email to