On Thu, Aug 24, 2017 at 3:19 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
> Hello!
>
> 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).

Thanks.  I have committed this patch which should fix the problem.
Bootstrapped and tested on x86_64-pc-linux-gnu.

Ian


2017-08-30  Ian Lance Taylor  <i...@google.com>

* configure.ac: Substitute GOC_FOR_TARGET and GCC_FOR_TARGET.
* Makefile.am (MOSTLYCLEANFILES): Add check-gcc.
(check-gccgo): Create via a temporary file.
(check-gcc): New target.
(CHECK_ENV): Set CC.
(ECHO_ENV): Report CC.
(check-go-tool): Depend on check-gcc.
(check-runtime, check-cgo-test, check-carchive-test): Likewise.
* configure, Makefile.in: Rebuild.
Index: configure.ac
===================================================================
--- configure.ac        (revision 251533)
+++ configure.ac        (working copy)
@@ -46,6 +46,11 @@ AC_PROG_INSTALL
 AC_PROG_CC
 AC_PROG_GO
 
+# These should be defined by the top-level configure.
+# Copy them into Makefile.
+AC_SUBST(GOC_FOR_TARGET)
+AC_SUBST(GCC_FOR_TARGET)
+
 AM_CONDITIONAL(NATIVE, test "$host_alias" = "$target_alias")
 
 dnl Test for -lsocket and -lnsl.  Copied from libjava/configure.ac.
Index: Makefile.am
===================================================================
--- Makefile.am (revision 251533)
+++ Makefile.am (working copy)
@@ -109,7 +109,8 @@ s-zdefaultcc: Makefile
 
 MOSTLYCLEANFILES = \
        zdefaultcc.go s-zdefaultcc \
-       check-gccgo gotools.head *-testlog gotools.sum gotools.log *.sent
+       check-gccgo check-gcc gotools.head *-testlog gotools.sum gotools.log \
+       *.sent
 
 mostlyclean-local:
        rm -rf check-go-dir check-runtime-dir cgo-test-dir carchive-test-dir
@@ -155,11 +156,22 @@ check-head:
 # check-gccgo is a little shell script that executes gccgo with the
 # options to pick up the newly built libgo.
 check-gccgo: Makefile
-       rm -f $@
-       echo "#!/bin/sh" > $@
+       rm -f $@ $@.tmp
+       echo "#!/bin/sh" > $@.tmp
        abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
-       echo "$(GOCOMPILE)" '"$$@"' "-I $${abs_libgodir} -L $${abs_libgodir} -L 
$${abs_libgodir}/.libs" >> $@
-       chmod +x $@
+       echo "$(GOCOMPILE)" '"$$@"' "-I $${abs_libgodir} -L $${abs_libgodir} -L 
$${abs_libgodir}/.libs" >> $@.tmp
+       chmod +x $@.tmp
+       mv -f $@.tmp $@
+
+# check-gcc is a little shell script that executes the newly built gcc
+# with the options to pick up the newly built libgo.
+check-gcc: Makefile
+       rm -f $@ $@.tmp
+       echo "#!/bin/sh" > $@.tmp
+       abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
+       echo "$(GCC_FOR_TARGET)" '"$$@"' "-L $${abs_libgodir} -L 
$${abs_libgodir}/.libs" >> $@.tmp
+       chmod +x $@.tmp
+       mv -f $@.tmp $@
 
 # CHECK_ENV sets up the environment to run the newly built go tool.
 # If you change this, change ECHO_ENV, below.
@@ -168,6 +180,8 @@ CHECK_ENV = \
        export PATH; \
        GCCGO="$(abs_builddir)/check-gccgo"; \
        export GCCGO; \
+       CC="$(abs_builddir)/check-gcc"; \
+       export CC; \
        GCCGOTOOLDIR="$(abs_builddir)"; \
        export GCCGOTOOLDIR; \
        GO_TESTING_GOTOOLS=yes; \
@@ -180,10 +194,10 @@ CHECK_ENV = \
 
 # ECHO_ENV is a variant of CHECK_ENV to put into a testlog file.
 # It assumes that abs_libgodir is set.
-ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' 
GCCGOTOOLDIR='$(abs_builddir)' GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo 
$${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` 
GOROOT=`echo $${abs_libgodir}`
+ECHO_ENV = PATH=`echo $(abs_builddir):$${PATH} | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'` GCCGO='$(abs_builddir)/check-gccgo' 
CC='$(abs_builddir)/check-gcc' GCCGOTOOLDIR='$(abs_builddir)' 
GO_TESTING_GOTOOLS=yes LD_LIBRARY_PATH=`echo 
$${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` 
GOROOT=`echo $${abs_libgodir}`
 
 # check-go-tools runs `go test cmd/go` in our environment.
-check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+check-go-tool: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc
        rm -rf check-go-dir cmd_go-testlog
        $(MKDIR_P) check-go-dir/src/cmd/go
        cp $(cmdsrcdir)/go/*.go check-go-dir/src/cmd/go/
@@ -203,7 +217,7 @@ check-go-tool: go$(EXEEXT) cgo$(EXEEXT)
 # The runtime package is also tested as part of libgo,
 # but the runtime tests use the go tool heavily, so testing
 # here too will catch more problems.
-check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+check-runtime: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc
        rm -rf check-runtime-dir runtime-testlog
        $(MKDIR_P) check-runtime-dir
        @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
@@ -222,7 +236,7 @@ check-runtime: go$(EXEEXT) cgo$(EXEEXT)
        grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/'
 
 # check-cgo-test runs `go test misc/cgo/test` in our environment.
-check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+check-cgo-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc
        rm -rf cgo-test-dir cgo-testlog
        $(MKDIR_P) cgo-test-dir/misc/cgo
        cp -r $(libgomiscdir)/cgo/test cgo-test-dir/misc/cgo/
@@ -236,7 +250,7 @@ check-cgo-test: go$(EXEEXT) cgo$(EXEEXT)
 
 # check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go`
 # in our environment.
-check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo
+check-carchive-test: go$(EXEEXT) cgo$(EXEEXT) check-head check-gccgo check-gcc
        rm -rf carchive-test-dir carchive-testlog
        $(MKDIR_P) carchive-test-dir/misc/cgo
        cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/

Reply via email to