Re: [PATCH] Sparse v0.6.1-rc2 is now out.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 09, 2019 at 05:56:18PM +0100, Ramsay Jones wrote:
> On 09/10/2019 12:22, Luc Van Oostenryck wrote:
> > Before the release, I would like to add the patch for the problem
> > you had with Cygwin. Would you be fine with the:
> > 	LLC_ARCH_OPTS="$LLC_ARCH_OPTS -mtriple=$(llvm-config --host-target)"
> > we had discussed before, with a note saying it's needed for recent
> > cygwin64 but may be inadequate for cygwin32?
> 
> Ha, yes, I should have mentioned that, on cygwin, I actually
> tested:
> 
>  $ sparse --version
>  v0.6.1-rc2-dirty
>  $ 
> 
> ... where the 'dirty' was:
> 
>  $ git diff
>  diff --git a/sparsec b/sparsec
>  index bafe2da..8a056e7 100755
>  --- a/sparsec
>  +++ b/sparsec
>  @@ -39,6 +39,7 @@ case "$(uname -s)" in
>   *CYGWIN*)
>          # cygwin uses the sjlj (setjmp-longjmp) exception model
>          LLC_ARCH_OPTS="-exception-model=sjlj"
>  +       LLC_ARCH_OPTS="$LLC_ARCH_OPTS -mtriple=x86_64-unknown-windows-cygnus"
>          ;;
>   *)
>          ;;
>  $ 
> 
> Given that:
> 
>  $ llvm-config --host-target
>  x86_64-unknown-windows-cygnus
>  $ 
> 
> ... the above should be just fine. (Do you want me to send
> a tested patch?).

No, thank you, it's not needed, I consider it as tested :)
I'll send the patch later.
 
> Note that I have been messing around with 'sparsec' and, in
> particular the invocation of llc, which can also output the
> object file directly. ie there is no need to generate assembler
> output and then assemble with the platform assembler. (which
> allows us to sidestep the incorrect assembler directives used
> for the wineh exception model!).
> 
> However, 'sparsec' seems to have several problems (not just
> on cygwin). For example, on Linux, we see:
> 
>  $ ./sparsec -o hello hello.c
>  /usr/bin/ld: /tmp/tmp.F57wOC: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
>  /usr/bin/ld: final link failed: Nonrepresentable section on output
>  collect2: error: ld returned 1 exit status
>  $ 

Yes, I'm aware of this. As far as I understand it, this is because
sparse-llvm.c doesn't yet correctly handle literal strings (and, in
general, top-level objects). If you try instead something like:
	#include <stdio.h>
	int main(int argc, char *argv[])
	{
		puts(argv[1]);
		return 0;
	}

then sparsec produces a functioning executable. It should also work
if you use simple global variables.

> whereas, on cygwin:
> 
>  $ ./sparsec -o hello hello.c
>  $ ./hello.exe 
>  hello world
>  $ 
> 
> ... which was somewhat surprising! ;-)

That is indeed very surprising.

> Note that the testsuite is happy if 'sparcec' produces an
> object file without error - it never tests the creation of
> an executable (let alone that it actually runs and produces
> correct output).
> 
> So, I don't know if we want to bust a gut to fix this up.

Yes ... Saying that sparse-llvm is not much used would not be
an overstatement. Having a good, multi-arch support for it
would need more time that I can afford and willing to spend on.
OTOH, it's not very far from being functional.

Cheers,
-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux