From owner-freebsd-arch@FreeBSD.ORG Mon Aug 30 20:10:10 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 C570410656AC for ; Mon, 30 Aug 2010 20:10:10 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay012.isp.belgacom.be (mailrelay012.isp.belgacom.be [195.238.6.179]) by mx1.freebsd.org (Postfix) with ESMTP id 5D2658FC1C for ; Mon, 30 Aug 2010 20:10:09 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEALqse0xbsRDL/2dsb2JhbACgaXK/DYU3BA Received: from 203.16-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.16.203]) by relay.skynet.be with ESMTP; 30 Aug 2010 22:10:08 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.4/8.14.4) with ESMTP id o7UKA7U4007452; Mon, 30 Aug 2010 22:10:07 +0200 (CEST) (envelope-from tijl@coosemans.org) From: Tijl Coosemans To: freebsd-arch@freebsd.org Date: Mon, 30 Aug 2010 22:09:51 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.1-PRERELEASE; KDE/4.4.5; i386; ; ) References: <201007291718.12687.tijl@coosemans.org> <201008301731.19074.tijl@coosemans.org> <20100830.123636.59640143160044949.imp@bsdimp.com> In-Reply-To: <20100830.123636.59640143160044949.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1636257.Aag2RgyL72"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201008302210.07110.tijl@coosemans.org> Cc: 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: Mon, 30 Aug 2010 20:10:10 -0000 --nextPart1636257.Aag2RgyL72 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Monday 30 August 2010 20:36:36 M. Warner Losh wrote: > In message: <201008301731.19074.tijl@coosemans.org> > Tijl Coosemans writes: > : On Thursday 29 July 2010 17:18:03 Tijl Coosemans wrote: > : > I've put the initial version of some patches online to support cross > : > compilation of 32 bit binaries on amd64. It's modelled after how NetB= SD > : > does this. > : >=20 > : > With these patches something like "cc -m32 -o test test.c -pthread -l= m" > : > generates a program that runs on FreeBSD/i386. > : >=20 > : > http://people.freebsd.org/~tijl/cc-m32-1.diff > : > http://people.freebsd.org/~tijl/cc-m32-2.diff > : > http://people.freebsd.org/~tijl/cc-m32-3.diff > : >=20 > : > *cc-m32-1.diff* : Let ld and cc find 32 bit libraries. > : >=20 > : > *cc-m32-2.diff* : Install i386 headers on amd64. > : >=20 > : > With this patch headers for a particular $arch are always installed > : > under /usr/include/$arch and /usr/include/machine becomes a symlink. > : >=20 > : > A question I have here is how best to clean up the old machine > : > directory. The patch currently uses 'rm -rf'. > : >=20 > : > Another problem I encountered was that during the build of > : > usr.bin/kdump all headers are searched for definitions of ioctl > : > requests and a C source code file is generated that includes all those > : > headers. This fails when both i386 and amd64 headers are installed > : > because they can't both be included at the same time. For now the pat= ch > : > simply blacklists /usr/include/i386, but actually all $arch should be > : > excluded. The ioctl requests can still be found through the machine > : > symlink. If someone has a better idea... > : >=20 > : > *cc-m32-3.diff* : Modify amd64 headers to include i386 headers when > : > __i386__ is defined. > : >=20 > : > This patch modifies the amd64 headers to follow this format: > : >=20 > : > #ifndef _AMD64_HEADER_H > : > #define _AMD64_HEADER_H > : >=20 > : > #ifdef __i386__ > : > #include > : > #else > : >=20 > : > ... > : >=20 > : > #endif /* __i386__ */ > : > #endif /* !_AMD64_HEADER_H */ > : >=20 > : > This way including works for -m32. There are a few > : > i386 headers which don't exist for amd64: > : >=20 > : > apm_segments.h > : > bootinfo.h > : > cserial.h > : > elan_mmcr.h > : > if_wl_wavelan.h > : > ioctl_bt848.h > : > ioctl_meteor.h > : > npx.h > : > pcaudioio.h > : > pcb_ext.h > : > perfmon.h > : > privatespace.h > : > smapi.h > : > speaker.h > : > vm86.h > : > xbox.h > : >=20 > : > Theoretically a dummy amd64 header should be created for each of them > : > that just includes the i386 header. The patch does this for npx.h. The > : > other headers seem to be really i386 specific or even outdated. If it > : > were ever necessary to cross-compile code that uses them, it would be > : > easy to modify that code to directly include . > : >=20 > : >=20 > : > Feel free to test the patches and to comment on any part of them. > :=20 > : I'd like to move forward with this now. I've rebased the patches above > : against today's CURRENT. If there are no further objections I'd like to > : commit them a few days from now, let's say Saturday. >=20 > I have been trying to get the tbemd patches into the tree and these > patches conflict with them. Can we hold off until I get them in? > I've had to rebase things myself a dozen times and each time I've only > been able to get part of the patches in... >=20 > I still have the objections from before, but I'll take a look at the > new patches to see if they are addressed or not. Ok, no problem. --nextPart1636257.Aag2RgyL72 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iF4EABEIAAYFAkx8EB4ACgkQfoCS2CCgtivCWwD/eVQcRyrAsE5Qf5naFC6KY6RR OgzH47yaD3E2Ckxf7PYA/3Y1Gntni1jztMBoOufC3v5G4td9W7MC1YH3a1QOT01w =/wnL -----END PGP SIGNATURE----- --nextPart1636257.Aag2RgyL72--