From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 12 23:39:44 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8A30106564A; Tue, 12 Jul 2011 23:39:44 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6B5488FC18; Tue, 12 Jul 2011 23:39:44 +0000 (UTC) Received: by vws18 with SMTP id 18so5314241vws.13 for ; Tue, 12 Jul 2011 16:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; bh=NbiITQ5co9SEIWYuO1m4aZZ11h6ydup2XvZiF3MLqR8=; b=eV/IveKmr7E5NyaZDMjCSjwQcyei3D0xBGImJ27BeWB+Cn/+9MEekIEMRSOPM92VKN U0tlv4IREnXWqndIpzwEJ5rKG007tGYMJhoUN13M53NqkH1FZ2cuBYlaFwEjR7DlGyrK CjwAQwnUIBZEAgsA4tZ+aJDYpOCBBk1rPM0A0= Received: by 10.220.92.9 with SMTP id p9mr38851vcm.68.1310513983414; Tue, 12 Jul 2011 16:39:43 -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 ej19sm1458156vcb.6.2011.07.12.16.39.41 (version=SSLv3 cipher=OTHER); Tue, 12 Jul 2011 16:39:42 -0700 (PDT) Date: Tue, 12 Jul 2011 19:39:35 -0400 From: Alexander Kabaev To: Robert Millan Message-ID: <20110712193935.507892a2@kan.dnsalias.net> In-Reply-To: References: <20110712164337.07e387eb@kan.dnsalias.net> <20110712173803.4979d741@kan.dnsalias.net> X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/fMebwPRXiZrlMCEm+9ZlMIq"; protocol="application/pgp-signature" Cc: freebsd-hackers@freebsd.org, Ed, Maste , Oliver Pinter Subject: Re: [PATCH] fake pre-processor macros when building on non-FreeBSD system X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2011 23:39:44 -0000 --Sig_/fMebwPRXiZrlMCEm+9ZlMIq Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 12 Jul 2011 23:59:05 +0200 Robert Millan wrote: > 2011/7/12 Alexander Kabaev : > > The fact that Linux compiler with manually undefined and re-defined > > platform macros can compile is a coincidence and is not guaranteed > > to work and certainly is not a goal of FreeBSD project so this can > > be broken at any moment. >=20 > There must be some missunderstanding, I never asked the FreeBSD > project to garantee this works, or that it won't break in the future. > I'm not holding anyone responsible in case it breaks, or anything > similar to that. >=20 > Once it works, however, it is not a coincidence: We've been working to > archieve this (most of my other patches sent to this list go in this > direction). >=20 But it is the coincidence. See the other email by Nathan, I could not have said it better. Just defining __FreeBSD__ in Linux compiler does not magically turn it into compiler for FreeBSD. > That aside, it seems there's some interest in FreeBSD community about > building the kernel on GNU/Linux. In particular, MIPS porters have it > in their TODO list: > http://wiki.freebsd.org/FreeBSD/mips/todo >=20 Not sure what they mean there. There is a general desire for FreeBSD to be able to build the first set of bootstrap tools on other OSes (Linux, MAC OS X) that has come up several times in recent years. Host tools were to be used to build cross-toolchain only in all discussions I've been part of so far. > > putting hacks into > > FreeBSD sources to legitimize the practice is not the move I would > > support as well. Traditionally, IMHO. >=20 > I try to take a neutral stance and merely follow on what the source > tree expects. If the source tree does things like: >=20 > #ifdef __FreeBSD__ > // code that expects to be built as part of the FreeBSD kernel tree > // (this chunk of code is invariably what we want, no matter the > compiler we're using) > #endif >=20 > #ifdef __linux__ > // code that expects to be built as part of the Linux tree > // (this chunk of code depends on out-of-tree headers and will never > build, no matter the compiler we're using) > #endif >=20 > I naively read this as "when building kernel code, we assume these > macros refer to *what* we're building rather than to what are we > building it *for*". >=20 See Nathan's email again. __FreeBSD__ also means that code can expect certain ABI or some other detail to match established FreeBSD practice, which are not necessarily adhered to by the Linux compiler. Take your own example and imagine using the same assumption with Mac OS X toolchain. *what* and *for* both apply here, if I understand your dilemma correctly. > My naive mind can't tell if this assumption is correct or not, it > merely tries to adapt to existing practice. If the assumption is not > correct, then I would propose a different kind of solution to the > problem. >=20 > So before we proceed, could you clarify whether the assumption is > correct or not? >=20 --=20 Alexander Kabaev --Sig_/fMebwPRXiZrlMCEm+9ZlMIq Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iD8DBQFOHNs8Q6z1jMm+XZYRAr5dAJ41p2l4Rly/MGiqZQNfNBGrIwEfLACg6VZz 7t1z/i/8z9t95SuEuX1iEms= =sUr5 -----END PGP SIGNATURE----- --Sig_/fMebwPRXiZrlMCEm+9ZlMIq--