From owner-freebsd-arch@FreeBSD.ORG Wed Nov 17 22:18:42 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48DCC106566B; Wed, 17 Nov 2010 22:18:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 16AF08FC17; Wed, 17 Nov 2010 22:18:42 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id B0FD246B52; Wed, 17 Nov 2010 17:18:41 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D7A4B8A009; Wed, 17 Nov 2010 17:18:40 -0500 (EST) From: John Baldwin To: freebsd-arch@freebsd.org Date: Wed, 17 Nov 2010 17:18:37 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20101102; KDE/4.4.5; amd64; ; ) References: <201007291718.12687.tijl@coosemans.org> <4CE417B3.3030102@bsdimp.com> <201011172058.05683.tijl@coosemans.org> In-Reply-To: <201011172058.05683.tijl@coosemans.org> MIME-Version: 1.0 Message-Id: <201011171718.37798.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Wed, 17 Nov 2010 17:18:40 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: Warner Losh , Tijl Coosemans , Dimitry Andric , Garrett Cooper Subject: Re: Support for cc -m32 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2010 22:18:42 -0000 On Wednesday, November 17, 2010 2:57:51 pm Tijl Coosemans wrote: > cc-m32-3.diff: > Modify amd64 headers to include i386 headers when compiling 32 bit code. > > All amd64 headers follow the following format: > > #ifndef _AMD64_HEADER_H_ > #define _AMD64_HEADER_H_ > > #ifdef __i386__ > #include > #else > > /* Amd64 declarations go here. */ > > #endif /* __i386__ */ > #endif /* !_AMD64_HEADER_H_ */ I find this to be really ugly, and error prone (since it is a manual process). I'd prefer something that autogenerated headers in /usr/include/machine that #include the appropriate version similar to what Warner suggested. However, one issue with that approach (and this one) are headers that only exist for one platform. The end result would be that that header would now exist for both platforms (in that if you do 'if [ -r /usr/include/machine/foo.h ]' it will be true). We can make it #error or otherwise fail (by including a non-existing file for example), but if there was some way to have cc -m32 "magically" substitute "i386/" for "machine", that is what I would most prefer. (This has problems too in that #include would work with -m32 even though /usr/include/machine/foo.h doesn't exist, but /usr/include/i386/foo.h does.) -- John Baldwin