[PATCH 5/5] sparse: Add end-to-end compiler shell script

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

 



This patch adds a 'kcc' shell script that combines the sparse's i386 backend
with GCC and GNU assembler to make it easier for people to find bugs in sparse.
You can, for example, attempt to build sparse with itself and see it crash and
burn:

  make && find . -name "*.o" | xargs rm
  make CC=./kcc
       CC       test-lexing.o
  FIXME! no value for symbol preprocess_only.  creating pseudo 1 (stack offset 4)
  {standard input}: Assembler messages:
  {standard input}:79: Error: operand type mismatch for `mov'
  make: *** [test-lexing.o] Error 1

Cc: Christopher Li <sparse@xxxxxxxxxxx>
Cc: Jeff Garzik <jgarzik@xxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 kcc |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100755 kcc

diff --git a/kcc b/kcc
new file mode 100755
index 0000000..7f275a9
--- /dev/null
+++ b/kcc
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# GCC compatible C compiler based on Sparse
+
+SPARSEOPTS=""
+ASOPTS=""
+DIRNAME=`dirname $0`
+
+use_gcc=1
+
+while [ $# -gt 0 ]; do
+	case $1 in
+	'-o')
+		ASOPTS=$ASOPTS"-o "$2" "
+		shift
+		;;
+	'-c')
+		use_gcc=0
+		;;
+	*)
+		SPARSEOPTS="$SPARSEOPTS $1 " ;;
+	esac
+	shift
+done
+
+if [ $use_gcc -eq 1 ]; then
+	gcc $ASOPTS $SPARSEOPTS
+
+else
+	$DIRNAME/compile $SPARSEOPTS | as $ASOPTS
+fi
-- 
1.7.4.1

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


[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