From owner-freebsd-current@FreeBSD.ORG Tue Aug 17 13:37:36 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88CCC1065693 for ; Tue, 17 Aug 2010 13:37:36 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2212C8FC1D for ; Tue, 17 Aug 2010 13:37:35 +0000 (UTC) Received: by qwg5 with SMTP id 5so6986771qwg.13 for ; Tue, 17 Aug 2010 06:37:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=FxyNJXRWeWzGxp37+DSa5osLwi0gwCfup26MV0DMhlw=; b=X3zuyrsWzOIX+g5/QpvS4F9iclraQn2z/6aL5wMvZIYY2tpsE5CmUz1zcCHJ6AMTzd qbLnasIt/QiXDG3MhHAfUcZF4S/tFfdekFlAUJlpRWs7u/CfL/xHwUqoyGmMHxNHLz/s 8dl/KIbz6TLZ50kMP7iiVsvrwcU6PbWxuVqXo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=VJi2FxFZIMUcux/2Niazw5jwnvLR/Slqmn4GwjcT3GaXclZoqFqM0l7EWLbvkZUHB2 NP5NwW7kdMVxJCSkSC8YCeYFrSUAbae32BB8iwxM6rYU/4xaz75MFIChth2UARcDLiCt 0+thrrTQQSYkkXrH1RO9ab04fUc8CuNx7/+Oc= Received: by 10.224.69.169 with SMTP id z41mr4336260qai.160.1282050922835; Tue, 17 Aug 2010 06:15:22 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id e6sm8759714qcr.17.2010.08.17.06.15.20 (version=SSLv3 cipher=RC4-MD5); Tue, 17 Aug 2010 06:15:21 -0700 (PDT) Date: Tue, 17 Aug 2010 09:15:15 -0400 From: Alexander Kabaev To: Dimitry Andric Message-ID: <20100817091515.4510ebfd@kan.dnsalias.net> In-Reply-To: <4C6A7357.8000606@andric.com> References: <4C6A7357.8000606@andric.com> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/Qa04UvAjLX6S1lYdVwlBcTy"; protocol="application/pgp-signature" Cc: current@freebsd.org Subject: Re: Building world with clang X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2010 13:37:36 -0000 --Sig_/Qa04UvAjLX6S1lYdVwlBcTy Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 17 Aug 2010 13:32:39 +0200 Dimitry Andric wrote: > Hi, >=20 > Since clang has gone into the tree, there has been an effort to get > head in a state where world can optionally be built with it. A > number of changes required for this have already been committed, > mainly thanks to Ed Schouten, Roman Divacky and Rui Paulo. Most of > these changes were adapted from the clangbsd project branch. >=20 > There are several other changes in the queue, pending review and/or > further enhancement, but I would like to solicit your comments about > one particular set: the changes required to let buildworld use clang > as the compiler. >=20 > Probably the most logical way to specify that you want world built > with clang, is to put CC=3Dclang and CXX=3Dclang++ in /etc/src.conf. Any > necessary modifications to Makefile.inc1 or bsd.*.mk can then be put > between conditionals like: >=20 > .if ${CC:T:Mclang} =3D=3D "clang" > [...stuff specific to clang...] > .endif >=20 > so nothing will change for non-clang builds. >=20 > Now, for building clang as the bootstrap compiler, there are basically > two methods to make it use the correct headers, C startup objects, and > libraries from the object tree (${WORLDTMP}): >=20 > 1) The "isysroot" method: build a regular version of clang, and make > sure WMAKEENV contains something like: >=20 > CC=3D"${CC} -isysroot ${WORLDTMP} -B${WORLDTMP}/usr/lib/ \ > -L${WORLDTMP}/usr/lib/" >=20 > 2) The "tools-prefix" method: build a special version of clang, that > has its default search paths for headers, startup objects and > libraries modified, to look for everything under ${WORLDTMP}. >=20 > Method 1) is used in the clangbsd project branch. >=20 > Method 2) is similar to what is used for building the in-tree gcc as > the bootstrap compiler. During the cross-tools stage, TOOLS_PREFIX is > defined to point at ${WORLDTMP}, and the bootstrap gcc's built-in > search paths get prefixed with it. >=20 > An advantage of method 1) is that it does not require any > modifications to the compiler, and basically just a few extra command > line arguments. The same method could probably even be made to work > for gcc. >=20 > However, a disadvantage is that the built-in search paths of the > bootstrap compiler are not entirely disabled by using the -isysroot, > -B and -L flags, so there is still a chance that headers, objects or > libraries outside of ${WORLDTMP} will be picked up during the world > stage. >=20 > An advantage of method 2) is that you can be 100% sure all built-in > search paths of the bootstrap compiler point to directories under > ${WORLDTMP}. Of course, a disadvantage is that you have to make some > modifications to the compiler source itself. >=20 > I would like to hear your opinions about which method is preferred, or > if there may be another good way to solve the bootstrap compiler > issue. >=20 > I have also attached two patches to this mail, which can be applied to > head, to show the exact set of changes required for each method. >=20 Does method 1) work fine with 'make buildenv'? I doubt that. I would strongly suggest we should not lose this feature. I do not like the idea of having to depend on -isystem in CFLAGS in such an environment.=20 --=20 Alexander Kabaev --Sig_/Qa04UvAjLX6S1lYdVwlBcTy Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iD8DBQFMaotnQ6z1jMm+XZYRAorwAKDGCp/1zDFBgl31vpyS2Pl+19cXRgCgzV8O r8Niu/tZM/0ie1jZzEuB1/0= =y/ij -----END PGP SIGNATURE----- --Sig_/Qa04UvAjLX6S1lYdVwlBcTy--