From patchwork Mon Nov 19 20:47:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramsay Jones X-Patchwork-Id: 10689419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 491CD14BD for ; Mon, 19 Nov 2018 20:47:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 372A72A1A4 for ; Mon, 19 Nov 2018 20:47:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AA322A42E; Mon, 19 Nov 2018 20:47:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC5302A1A4 for ; Mon, 19 Nov 2018 20:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730795AbeKTHMu (ORCPT ); Tue, 20 Nov 2018 02:12:50 -0500 Received: from avasout04.plus.net ([212.159.14.19]:52356 "EHLO avasout04.plus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730830AbeKTHMu (ORCPT ); Tue, 20 Nov 2018 02:12:50 -0500 Received: from [10.0.2.15] ([146.198.133.33]) by smtp with ESMTPA id OqS5g9pGNYyh2OqS6gYlu5; Mon, 19 Nov 2018 20:47:26 +0000 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.3 cv=MoN8FVSe c=1 sm=1 tr=0 a=VCDsReDbrwk4B7AcQzWGLw==:117 a=VCDsReDbrwk4B7AcQzWGLw==:17 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=dddas0_YW2fZw5whDPgA:9 a=m0i2RIxt19PloQar:21 a=mKL-qY9IGN-VznFl:21 a=QEXdDO2ut3YA:10 a=yJM6EZoI5SlJf8ks9Ge_:22 X-AUTH: ramsayjones@:2500 To: Luc Van Oostenryck Cc: Sparse Mailing-list From: Ramsay Jones Subject: [PATCH 2/9] sparsei: add the --[no-]jit options Message-ID: Date: Mon, 19 Nov 2018 20:47:23 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-GB X-CMAE-Envelope: MS4wfGb3oI9ZXJA4p/n7VbwUlkX8LnsZNCWlc9QjcVc5mmHUzGOZ1lMmS0EtOh+/qijfYk6lW4rUspQHfluD8xqSPgBaXy9pyolG3L00NMnriWIH17s0mDD9 kvDKSA/ucTpFTPp4TDjK00Oee2hQZTM6z5HmCj9MiHAt25Cerd8u0whw2eeWVB1cELv2nCEifqpVfg== Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On the cygwin platform, a 'sparsei' backend test, which uses the llvm 'lli' tool, fails due to a dynamic linking error: $ make check ... TEST sum from 1 to n (backend/sum.c) error: actual output text does not match expected output text. error: see backend/sum.c.output.* for further investigation. --- backend/sum.c.output.expected 2018-06-03 18:27:11.502760500 +0100 +++ backend/sum.c.output.got 2018-06-03 18:27:11.307670000 +0100 @@ -1,2 +0,0 @@ -15 -5050 error: actual error text does not match expected error text. error: see backend/sum.c.error.* for further investigation. --- backend/sum.c.error.expected 2018-06-03 18:27:11.562997400 +0100 +++ backend/sum.c.error.got 2018-06-03 18:27:11.481038800 +0100 @@ -0,0 +1 @@ +LLVM ERROR: Program used external function 'printf' which could not be resolved! error: Actual exit value does not match the expected one. error: expected 0, got 1. ... Out of 288 tests, 277 passed, 11 failed (10 of them are known to fail) make: *** [Makefile:236: check] Error 1 $ Note the 'LLVM ERROR' about the 'printf' external function which could not be resolved (linked). On Linux, it seems that the 'lli' tool (JIT compiler) can resolve the 'printf' symbol, with the help of the dynamic linker, since the tool itself is linked to the (dynamic) C library. On windows (hence also on cygwin), the 'lli' tool fails to resolve the external symbol, since it is not exported from the '.exe'. The 'lli' tool can be used as an interpreter, so that the JIT compiler is disabled, which also side-steps this external symbol linking problem. Add the --[no-]jit options to the 'sparsei' tool, which in turn uses (or not) the '-force-interpreter' option to 'lli'. In order to fix the failing test-case, simply pass the '--no-jit' option to 'sparsei'. Signed-off-by: Ramsay Jones --- sparsei | 20 +++++++++++++++++++- validation/backend/sum.c | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sparsei b/sparsei index 3431a9f..3232200 100755 --- a/sparsei +++ b/sparsei @@ -2,6 +2,9 @@ set +e +SPARSEOPTS= +JIT_OPT= + DIRNAME=`dirname $0` LLI=`"${LLVM_CONFIG:-llvm-config}" --bindir`/lli @@ -10,4 +13,19 @@ if [ $# -eq 0 ]; then exit 1 fi -$DIRNAME/sparse-llvm $@ | $LLI +while [ $# -gt 0 ]; do + case $1 in + --jit) + JIT_OPT= + ;; + --no-jit) + JIT_OPT="-force-interpreter" + ;; + *) + SPARSEOPTS="$SPARSEOPTS $1 " + ;; + esac + shift +done + +$DIRNAME/sparse-llvm ${SPARSEOPTS} | $LLI ${JIT_OPT} diff --git a/validation/backend/sum.c b/validation/backend/sum.c index 0604299..fa51120 100644 --- a/validation/backend/sum.c +++ b/validation/backend/sum.c @@ -19,7 +19,7 @@ int main(int argc, char **argv) /* * check-name: sum from 1 to n - * check-command: sparsei $file + * check-command: sparsei --no-jit $file * * check-output-start 15