From patchwork Mon Aug 22 13:57:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 1085412 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7MDvakX020938 for ; Mon, 22 Aug 2011 13:58:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750915Ab1HVN5h (ORCPT ); Mon, 22 Aug 2011 09:57:37 -0400 Received: from filtteri2.pp.htv.fi ([213.243.153.185]:59166 "EHLO filtteri2.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305Ab1HVN5f (ORCPT ); Mon, 22 Aug 2011 09:57:35 -0400 Received: from localhost (localhost [127.0.0.1]) by filtteri2.pp.htv.fi (Postfix) with ESMTP id 9AFDA1DF122; Mon, 22 Aug 2011 16:57:34 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from smtp6.welho.com ([213.243.153.40]) by localhost (filtteri2.pp.htv.fi [213.243.153.185]) (amavisd-new, port 10024) with ESMTP id 6T5LPdgmedAn; Mon, 22 Aug 2011 16:57:34 +0300 (EEST) Received: from localhost.localdomain (cs181136138.pp.htv.fi [82.181.136.138]) by smtp6.welho.com (Postfix) with ESMTP id 6601E5BC004; Mon, 22 Aug 2011 16:57:34 +0300 (EEST) From: Pekka Enberg To: linux-sparse@vger.kernel.org Cc: Pekka Enberg , Christopher Li , Jeff Garzik , Linus Torvalds Subject: [PATCH 5/5] sparse: Add end-to-end compiler shell script Date: Mon, 22 Aug 2011 16:57:31 +0300 Message-Id: <1314021451-24808-5-git-send-email-penberg@kernel.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314021451-24808-1-git-send-email-penberg@kernel.org> References: <1314021451-24808-1-git-send-email-penberg@kernel.org> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 22 Aug 2011 13:58:07 +0000 (UTC) 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 Cc: Jeff Garzik Cc: Linus Torvalds Signed-off-by: Pekka Enberg --- 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