From owner-freebsd-toolchain@FreeBSD.ORG Tue Jun 21 09:12:31 2011 Return-Path: Delivered-To: toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 297D8106566B for ; Tue, 21 Jun 2011 09:12:31 +0000 (UTC) (envelope-from damjan.marion@gmail.com) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx1.freebsd.org (Postfix) with ESMTP id A874F8FC08 for ; Tue, 21 Jun 2011 09:12:30 +0000 (UTC) Received: by wwg11 with SMTP id 11so41979wwg.1 for ; Tue, 21 Jun 2011 02:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=W7pTZPGK4UzeNNmlo7VS4KV6ZLZFmYUQ3EA4OH244EU=; b=wOb5YAm2sxrO4H5AMmNxJL42S2Z4oYuDQRgXZi2YUL/9WVNyptEc5Ki4F9jQCxT7uM 8CAM4aLLv2FGOKS1ZaJX5RvXED0FrBmuPzTQPkrSwQeDISEP+3cY48YBkCugwycbnHv/ MUG1ObQjF/s5kc98FXpJbEkYao3CidsFXAGuY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=YzgSnOLhs0Oc1QYkBaNmtiMkN54pFYPLZ9zxCXJRJMetKXSZpiqCQmokwbe8XcHPdI q9k4/0WXA640t5XHDgakRpA2Gvct6CfI86bubb05AFowDe/A9P38X4Q+FHj7n8IEdWJw 8o2sS8lc6b0FBgz3Hm73RIOjYKe40T0+WPykY= Received: by 10.216.61.9 with SMTP id v9mr4567803wec.2.1308647549365; Tue, 21 Jun 2011 02:12:29 -0700 (PDT) Received: from [192.168.123.4] (cpe-109-60-79-155.zg3.cable.xnet.hr [109.60.79.155]) by mx.google.com with ESMTPS id u64sm3349479weq.4.2011.06.21.02.12.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2011 02:12:28 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Damjan Marion In-Reply-To: Date: Tue, 21 Jun 2011 11:12:26 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <8E65FA9C-330B-4055-8959-75EE06E557E8@gmail.com> References: <15B76B64-D26E-420D-AE37-B52A694CDF98@gmail.com> To: Warner Losh X-Mailer: Apple Mail (2.1084) Cc: toolchain@FreeBSD.org Subject: Re: cross-compiling for arm with clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2011 09:12:31 -0000 On Jun 17, 2011, at 9:16 PM, Warner Losh wrote: >=20 > On Jun 17, 2011, at 12:38 PM, Damjan Marion wrote: >=20 >> Now, I'm back on my original problem, clang invokes /usr/bin/as which = is i386 AS instead of ARM version in obj tree. >=20 > That's a bogus assumption on the part of clang. At the very least, it = should be adding the magic gas flags to use the correct triple for the = platform. But if you did that, your next complaint would be that we = only build as for the native architecture and not anything else. >=20 >> How this works on other platforms (i.e. cross-compiling for amd64)? >=20 > How it normally works is that we build a compiler that invokes the = right as, ld, etc for the architecture in question. Clang is clearly = broken here in assuming that as can cope with anything other than native = assembler :) We normally either build gcc that knows where to find = these files. In the buildworld case, this is communicate with weird = paths and shell variables. With the whole 'xdev' series of targets = (which are instructive to look at), we build into a specific location = /usr/freebsd-xdev-arm/bin, etc). >=20 > It works by accident for i386 on amd64, I think. as treats the more = or less as the same. I submitted a patch[1] to clang mailer which invokes xxx-yyy-zzz-as/ld = based on -ccc-host-triple. Patch is copy of netbsd code which is already = in clang. For me it works well, even when I use clang on Darwin host, it calls = proper as/ld. # /opt/llvm/bin/clang -ccc-host-triple arm-unknown-freebsd = -mfloat-abi=3Dsoft test.c -o test -v -c clang version 3.0 (http://llvm.org/git/clang.git = 98138cdfdee05c0afbab2b209ce8cfe4a52474e1) Target: arm-unknown-freebsd Thread model: posix [snip] End of search list. "/opt/llvm/bin/arm-unknown-freebsd-as" -o test = /var/folders/kb/kbDaYaFqFQaCg3mXbTLH5U+16gE/-Tmp-/cc-RMHOwf.s Is this what we need to support cross-compiling freebsd with clang? Is there any other comment to this patch[1]? [1] = http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110620/043072= .html