From patchwork Mon Nov 11 15:42:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1192976 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-512964-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="dP9iUwE9"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="boulOLV6"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47BZrg0MGMz9sPk for ; Tue, 12 Nov 2019 02:42:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=t3b2FnWMgo8vmIfzNVBKtkbo/Vhjri75IS5cAXWHAzfcOPOadh ElVKtzdlO2FVN+LsXgqVPNLFBPcFP3AeTpoN4Gl25ov28UDWl5tPWzPxFUZ2IO03 qvrcUk57sdwxnUNEaO5dq5Egm6iof6UbqJyLmGugRaPJ8l90Vlk0PwPKI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=qzJ6YNgiUikd4Ahn+EZX/ojOwDI=; b=dP9iUwE9/AccYBlCzQko D91XhXDQMbVV8QaqyU4wqXv3mDSL0KY0MPbN5Qm5xBf+9/MSkCaboMfT+Yea1mjd BPW8TW1sTJ3t13UuLdT56h/iINsVPfwhcK2abYUQp+aCG01iOigjeWek3GZZj93/ DqDg6gMuggbDzWdXH78hUac= Received: (qmail 40708 invoked by alias); 11 Nov 2019 15:42:34 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 40695 invoked by uid 89); 11 Nov 2019 15:42:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=consequently, emulation, obtained, shlib_ext X-HELO: esa4.hgst.iphmx.com Received: from esa4.hgst.iphmx.com (HELO esa4.hgst.iphmx.com) (216.71.154.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Nov 2019 15:42:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1573486951; x=1605022951; h=date:from:to:cc:subject:message-id:mime-version; bh=lewBo9wz49cUC6vQA0r3Bc/LQxtYyj6+1/B8wwAevQU=; b=boulOLV6YR+IuW3UdA5qcaDnsBaF4baUHODx+okqFC17USVJlLQjtGGc 0b8iz8RPAJcVI46cVE7hqFkB/VlhlnTyba5XG/lVQy0Nll0LCyKs4rDox BqkSTBh9Y9C2tshXYZuMj0Aav/eVuc36EsVHg8H+mIOh/Gxg/EJZY1o8Q sAxtbSUm25J93IWTi/X33P0VHDOXjsWsiaFxMS2GP2NZo/pNpJ1frbRHd NmvFc4RjBcqhT27rwKY5Po4iPOlHUZtM/uJQb659TZIg7AtaKmLM2jbLw t68vzshNwaPA7Efaze2VrlaEm6X+LtDbtHTvNXrUkNIWiEmxA4swCGvXd w==; IronPort-SDR: 7dEqF4UrvlhN1ktY2TFEFvOIzrll2FVi37qJLfWBIMNLZukdWpQ6BOYPd4ch3nzGd/W34E7uX8 Rcy0xLNw7a941POX3/I4GmkJSrpLTNq6UqyFcpXL+8N1O2pQ194YPwEWti0ji12lOyCfG+n0U7 +B7kGa+Kmx4GWcOhPJz++HSp81LMRy2C2qYSWZunl8tApPFTOLGjd4ptgQ0/A9uzAddVpNAMol jrVZ+x1AMzvFxnsS1SpKg7NuNUQdFywCrC855al10sJzfeBZEBoYY0/apoQCnYg5267ZjqMi3b vgY= Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 11 Nov 2019 23:42:29 +0800 IronPort-SDR: VZ3bdbgmLbJ8fbtfu0HrqyQfIZBpehMP1PkHkSJb9wPLc30xGhrYSvQrogdpb3aeb0IzXwXXsw CvhyipZGHE3LsCYDh6hPOSEM8V11CKH/tBHAcqn+xf/bM+SORQRMgcxdanQiQBzIMNnJr8Oikz bLAGAezawJuzyX6mCqM3wVK0JW0+s7KKxLx1AgCIsr68Te2PkE2cqYncOBTk1T8mZbc7O/4998 9UF7NZJ/C75buAVxNW0S5/rarcEqviARvOq80kypTkGEuAH3T8FDIsRFh4Vh+IOgypkhhzF20A na8= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 07:37:32 -0800 IronPort-SDR: 40zvHfl/Isc6QP5peRF3TwiuAPyL4bI2b4FBDmlLXvEr++S9XycLxhgLwewPMCiqwwoF/J9KzN vnMuBM8VP/TBhSWK6Ehref2JRsItmEbBxbALepx7CskUU03zgymN4s1l0njcbPftPwDNuZ+L5i zqFgmDN4Hl2jWZWycXgG9YrPZPGd1easoTSMqMc21o68Ae6Fd01bd+5wxzABywBys3DKlE3fbO hm8UsvoaDXEvDIbj4vQJ1R9vnudY1CCBiBhQ8kzWT9e2j3ju/lafC/atbdY6hskvL7vMrTOzpB oUc= WDCIronportException: Internal Received: from unknown (HELO redsun52) ([10.149.66.28]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 07:42:27 -0800 Date: Mon, 11 Nov 2019 15:42:22 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: golang-dev@googlegroups.com Subject: [PATCH] libgo/test: Add flags to find libgcc_s in build-tree testing Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Add a setting for the dynamic loader to find the shared libgcc_s library in build-tree testing, fixing a catastrophic libgo testsuite failure in cross-compilation where the library cannot be found by the loader at run time and consequently no test case executes, producing output (here with the `x86_64-linux-gnu' host and the `riscv64-linux-gnu' target, with RISC-V QEMU in the Linux user emulation mode as the target board) like: spawn qemu-riscv64 -E LD_LIBRARY_PATH=.:.../riscv64-linux-gnu/lib64/lp64d/libgo/.libs ./a.exe ./a.exe: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory FAIL: archive/tar Use the `ld_library_path' TCL variable to propagate the setting obtained from where GCC finds the library at link time, making test output look like: spawn qemu-riscv64 -E LD_LIBRARY_PATH=.:..././gcc/lib64/lp64d:.../riscv64-linux-gnu/lib64/lp64d/libgo/.libs ./a.exe PASS PASS: archive/tar No summary comparison, because the libgo testsuite does not provide one in this configuration for some reason, however this change improves overall results from 0 PASSes and 159 FAILs to 133 PASSes and 26 FAILs. gcc/testsuite/ * lib/go.exp (go_link_flags): Add `ld_library_path' setting to find shared `libgcc_s' library at run time in build-tree testing. --- Hi, Regression-tested with `make check-go' with the `x86_64-linux-gnu' native system as well as the `x86_64-linux-gnu' host and the `riscv64-linux-gnu' target, with RISC-V QEMU in the Linux user emulation mode as the target board. NB as a heads-up numerous tests fail quietly (i.e. with no FAIL report and no name of the test case given either) to link due to unsatisfied symbol references, such as: .../bin/riscv64-linux-gnu-ld: _gotest_.o: in function `cmd..z2fgo..z2finternal..z2fcache.Cache.get': .../riscv64-linux-gnu/libgo/gotest24771/test/cache.go:182: undefined reference to `cmd..z2fgo..z2finternal..z2frenameio.ReadFile' which I take is due to a reference to `libgotool.a' -- which is where the required symbols are defined -- missing from the linker invocation. I don't know what's supposed to supply the library to the linker or whether this indeed the actual cause; I find the way libgo tests have been wired unusual and consequently hard to follow, so maybe someone more familiar with this stuff will be able to tell what is going on here. I'll be happy to push any patches through testing. OK to apply to GCC? Maciej --- gcc/testsuite/lib/go.exp | 8 ++++++++ 1 file changed, 8 insertions(+) gcc-test-libgo-libgcc-lib-path.diff Index: gcc/gcc/testsuite/lib/go.exp =================================================================== --- gcc.orig/gcc/testsuite/lib/go.exp +++ gcc/gcc/testsuite/lib/go.exp @@ -104,6 +104,14 @@ proc go_link_flags { paths } { verbose "shared lib extension: $shlib_ext" if { $gccpath != "" } { + set compiler [lindex $GOC_UNDER_TEST 0] + set compiler_opts [join [lrange $GOC_UNDER_TEST 1 end]] + set libgccs [remote_exec host "$compiler" \ + "$compiler_opts -print-file-name=libgcc_s.${shlib_ext}"] + if { [lindex $libgccs 0] == 0 \ + && [set libgccsdir [file dirname [lindex $libgccs 1]]] != "" } { + append ld_library_path ":${libgccsdir}" + } if [file exists "${gccpath}/libgo/libgobegin.a"] { append flags "-L${gccpath}/libgo " }