diff mbox

Merging Luc's master branch.

Message ID c42ae01f-e5a0-5f14-fd5a-bef77752e869@ramsayjones.plus.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ramsay Jones March 3, 2018, 2:13 a.m. UTC
On 03/03/18 00:31, Luc Van Oostenryck wrote:
> On Fri, Mar 02, 2018 at 11:33:52PM +0000, Ramsay Jones wrote:
[snip]

>>
>> I think the exception-model is specific to the cygwin (Windows)
>> platform. I chanced upon that solution by noting the errors
> 
> I understood that 'sjlj' was ok for linux too while 'seh' was
> only for Windows but I may be wrong.

Yes, I didn't express myself very well there! :(

The SEH is 'native windows' exception handling (not explicitly
related to any specific language e.g. c++), which the llc tool
seems to be set up to generate by default.

However, cygwin attempts to be as close to Linux as it can, given
that it actually runs on the windows platform. So, the GNU binutils
on cygwin, uses the Linux like sjlj exception handling, which is what
the call to 'as' in sparsec is expecting. (or rather, it is _not_
expecting seh!)

If we were talking about a MinGW port - it would probably be different
again! ;-)

BTW, I quickly tried using an intermediate file in sparsei:

$ git diff -- sparsei
$ ./sparsei validation/backend/sum.c
LLVM ERROR: Program used external function 'printf' which could not be resolved!
$ 

... and it didn't work. :-D

Would this work on Linux?


ATB,
Ramsay Jones

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Luc Van Oostenryck March 3, 2018, 3:07 a.m. UTC | #1
On Sat, Mar 03, 2018 at 02:13:25AM +0000, Ramsay Jones wrote:
> 
> 
> On 03/03/18 00:31, Luc Van Oostenryck wrote:
> > On Fri, Mar 02, 2018 at 11:33:52PM +0000, Ramsay Jones wrote:
> [snip]
> 
> >>
> >> I think the exception-model is specific to the cygwin (Windows)
> >> platform. I chanced upon that solution by noting the errors
> > 
> > I understood that 'sjlj' was ok for linux too while 'seh' was
> > only for Windows but I may be wrong.
> 
> Yes, I didn't express myself very well there! :(
> 
> The SEH is 'native windows' exception handling (not explicitly
> related to any specific language e.g. c++), which the llc tool
> seems to be set up to generate by default.
> 
> However, cygwin attempts to be as close to Linux as it can, given
> that it actually runs on the windows platform. So, the GNU binutils
> on cygwin, uses the Linux like sjlj exception handling, which is what
> the call to 'as' in sparsec is expecting. (or rather, it is _not_
> expecting seh!)
> 
> If we were talking about a MinGW port - it would probably be different
> again! ;-)

OK, thanks for the info.
 
> BTW, I quickly tried using an intermediate file in sparsei:
> 
> $ git diff -- sparsei
> diff --git a/sparsei b/sparsei
> index 3431a9f..bc28ae2 100755
> --- a/sparsei
> +++ b/sparsei
> @@ -10,4 +10,12 @@ if [ $# -eq 0 ]; then
>    exit 1
>  fi
>  
> -$DIRNAME/sparse-llvm $@ | $LLI
> +TMPFILE=`mktemp -t tmp.XXXXXX.bc`
> +
> +$DIRNAME/sparse-llvm $@ >$TMPFILE
> +
> +$LLI $TMPFILE
> +
> +exit_code=$?
> +rm -f $TMPFILE
> +exit $exit_code
> $ ./sparsei validation/backend/sum.c
> LLVM ERROR: Program used external function 'printf' which could not be resolved!
> $ 
> 
> ... and it didn't work. :-D
> 
> Would this work on Linux?

It does here on an Ubuntu 17.10 with llvm-4.0
From what I vaguely understand, the LLVM error is related to dynamic linking
issues specific to Windows. I have no idea from where lli takes its runtime
standard library but this is coherent with your '-force-interpreter=true'.

What could be done is to add an option to sparsei, maybe '-no-jit' and
use this option for the tests using sparsei since for the tests it's
very fine to not use the JIT (and even better for reproductibility).

Best regards,
-- Luc
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/sparsei b/sparsei
index 3431a9f..bc28ae2 100755
--- a/sparsei
+++ b/sparsei
@@ -10,4 +10,12 @@  if [ $# -eq 0 ]; then
   exit 1
 fi
 
-$DIRNAME/sparse-llvm $@ | $LLI
+TMPFILE=`mktemp -t tmp.XXXXXX.bc`
+
+$DIRNAME/sparse-llvm $@ >$TMPFILE
+
+$LLI $TMPFILE
+
+exit_code=$?
+rm -f $TMPFILE
+exit $exit_code