From patchwork Sat Sep 6 00:21:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 36926 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E813C202A1 for ; Sat, 6 Sep 2014 00:22:03 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id c9sf37132309qcz.4 for ; Fri, 05 Sep 2014 17:22:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=TKi1i9QFZexr2RkA8OsLEgDgRAMSe9ZxNQaRohP5Iyk=; b=PsG8QhVL+Qx+ISfvkylHJBlAD7WCQjBnXFK6Ch+2cMGhYRuEALuklQdsSbkLq7OWes OL8L8nn5EbQNTmn2WU2VSgZH6pmEvqKOR/+HGSadVeNfAfZNKoXLUNoTrnVaSGJm7GiZ Ce+468ThWqLIO3qB1ET64AF/Im+wIdi6DS2ZoD+i3j2p4dtzDjgbwmYZH1sAmMVt56lK So7rGHI/vywufgY/QPMya0ME7rTljrtOyEh/AVR/JtGQBjVXFMNduwy6K/C4Z+D7APYl ugmv+/g6EIEx0I+Bg35lCoeNySfKC2XqsgTeb01UOQP5NkIu3UfgLjLQFuvNL6F03f72 VG0w== X-Gm-Message-State: ALoCoQnAFY/19yCOy09TVh2a4oSerf5gSuUSQlOoPHLYiUvtZ3AedKYQPyuvPaLjJcAjeLNDoB3s X-Received: by 10.236.41.102 with SMTP id g66mr8879674yhb.15.1409962923773; Fri, 05 Sep 2014 17:22:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.41 with SMTP id p38ls813095qga.55.gmail; Fri, 05 Sep 2014 17:22:03 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr13262382vcn.16.1409962923677; Fri, 05 Sep 2014 17:22:03 -0700 (PDT) Received: from mail-vc0-x230.google.com (mail-vc0-x230.google.com [2607:f8b0:400c:c03::230]) by mx.google.com with ESMTPS id ir4si1608628vcb.19.2014.09.05.17.22.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 17:22:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::230 as permitted sender) client-ip=2607:f8b0:400c:c03::230; Received: by mail-vc0-f176.google.com with SMTP id ik5so13014588vcb.21 for ; Fri, 05 Sep 2014 17:22:03 -0700 (PDT) X-Received: by 10.52.146.17 with SMTP id sy17mr10916875vdb.29.1409962923558; Fri, 05 Sep 2014 17:22:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp154659vcb; Fri, 5 Sep 2014 17:22:03 -0700 (PDT) X-Received: by 10.66.251.40 with SMTP id zh8mr20186584pac.6.1409962922667; Fri, 05 Sep 2014 17:22:02 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id iw1si6422236pbc.127.2014.09.05.17.22.01 for ; Fri, 05 Sep 2014 17:22:02 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751481AbaIFAWA (ORCPT + 26 others); Fri, 5 Sep 2014 20:22:00 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:43305 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbaIFAV5 (ORCPT ); Fri, 5 Sep 2014 20:21:57 -0400 Received: by mail-pd0-f176.google.com with SMTP id w10so7298475pde.7 for ; Fri, 05 Sep 2014 17:21:56 -0700 (PDT) X-Received: by 10.66.227.71 with SMTP id ry7mr27035035pac.32.1409962916832; Fri, 05 Sep 2014 17:21:56 -0700 (PDT) Received: from galdor.websterwood.com (S0106dc9fdb80cffd.gv.shawcable.net. [96.50.97.138]) by mx.google.com with ESMTPSA id w8sm2703238pbs.7.2014.09.05.17.21.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Sep 2014 17:21:55 -0700 (PDT) From: behanw@converseincode.com To: mmarek@suse.cz Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Behan Webster Subject: [PATCH] kbuild, LLVMLinux: Add better clang cross build support Date: Fri, 5 Sep 2014 17:21:49 -0700 Message-Id: <1409962909-14660-1-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: behanw@converseincode.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::230 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Behan Webster Add cross target to CC if using clang. Also add custom gcc toolchain path for fallback gcc tools. COMPILER is previously set to "clang" if CC=clang was set from the make command line. So -target and -gcc-toolchain can be added to CC, since we already know that it is set. Clang will fallback to using things like ld, as, and libgcc if (respectively) one of the llvm linkers isn't available, the integrated assembler is turned off, or an appropriately cross-compiled version of compiler-rt isn't available. To this end, you can specify the path to this fallback gcc toolchain with GCC_TOOLCHAIN. Signed-off-by: Behan Webster --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 2893d7f..c772619 100644 --- a/Makefile +++ b/Makefile @@ -360,7 +360,16 @@ include $(srctree)/scripts/Kbuild.include # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld +ifeq ($(COMPILER),clang) +ifneq ($(CROSS_COMPILE),) +CC += -target $(CROSS_COMPILE:%-=%) +endif +ifneq ($(GCC_TOOLCHAIN),) +CC += -gcc-toolchain $(GCC_TOOLCHAIN) +endif +else CC = $(CROSS_COMPILE)gcc +endif CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm