diff options
author | Ramsay Jones <ramsay@ramsayjones.plus.com> | 2018-11-19 20:47:23 +0000 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-11-22 14:49:03 +0100 |
commit | cb777d34218842a12ebc3eac9baba3e6fbbd7e13 (patch) | |
tree | c3f09eefc354bed5d1009b15fcf7be4e58f1db3d | |
parent | 885d147cd27dd5e05cfbb8217414993e654a5b5a (diff) | |
download | sparse-cb777d34218842a12ebc3eac9baba3e6fbbd7e13.tar.gz |
sparsei: add the --[no-]jit options
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 <ramsay@ramsayjones.plus.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rwxr-xr-x | sparsei | 20 | ||||
-rw-r--r-- | validation/backend/sum.c | 2 |
2 files changed, 20 insertions, 2 deletions
@@ -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 06042999..fa51120e 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 |