9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <forsyth@terzarima.net>
To: 9fans@cse.psu.edu
Subject: [9fans] cross-compilation.
Date: Mon,  4 Feb 2008 14:32:30 +0000	[thread overview]
Message-ID: <d23b63cb750e4c99edb6a23aefb2d57c@terzarima.net> (raw)
In-Reply-To: <fo2bi9$sv1$1@panix2.panix.com>

> because
> something had to be used to compile Plan 9 itself, etc and I figure it's
> not being done as a cross-compiler).
> --

ken thompson wrote a nice little C compiler.

cross-compilation is trivial: if 8c is the x86 compiler and qc is the power pc compiler, you get a cross
compiler from x86 to powerpc by compiling qc with 8c.  unchanged. that's it.
no nest of peculiar configuration files just to make a given compiler into a cross-compiler.
to cross-compile the whole system for (say) PowerPC on any architecture, including itself, use
	objtype=power mk install
on an x86, sparc, amd64, powerpc, ... .  you can also build all of them in the same tree:
	objtype=power mk install
	objtype=386 mk install
	objtype=arm mk install
and simultaneously.  no peculiar `buildroot' environments. and so on.

the mkfiles are essentially configured for a target platform by /$objtype/mkfile.

here's /386/mkfile:
	</sys/src/mkfile.proto

	CC=8c
	LD=8l
	O=8
	AS=8a

here's /power/mkfile:
	</sys/src/mkfile.proto

	CC=qc
	LD=ql
	O=q
	AS=qa
and so on.

there are similarly a few lines of machine-specific includes in /$objtype/include and that's it: all of the system's
includes in /sys/include are completely portable.

 wc -l /386/include/*.h
     65 /386/include/u.h
     25 /386/include/ureg.h
     90 total

it's not just system source.  if i include /sys/src/cmd/mkone in my own mkfile, and follow the
appropriate pattern, my own C software will build the same way.  {mk installall} will build and install it
in my own bin directories, for all supported architectures.

it's complete cross-compilation not completely cross compilation


  parent reply	other threads:[~2008-02-04 14:32 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-01  0:22 [9fans] A newbie question Michael Andronov
2008-02-01  0:25 ` erik quanstrom
2008-02-01  0:31   ` john
2008-02-01  0:30 ` Pietro Gagliardi
2008-02-04  0:59   ` Enrico Weigelt
2008-02-01  2:16 ` Pietro Gagliardi
2008-02-01  8:50 ` John Stalker
2008-02-01 17:15   ` Michael Andronov
2008-02-02  4:43     ` Michael Andronov
2008-02-02  4:57       ` Pietro Gagliardi
2008-02-02 13:02         ` Steve Simon
2008-02-04 10:21           ` Greg Comeau
2008-02-04 10:52             ` mattmobile
2008-02-04 11:12               ` Uriel
2008-02-04 11:47                 ` Filipp Andronov
2008-02-04 15:42                   ` Alf
2008-02-04 16:06                     ` Filipp Andronov
2008-02-04 16:53                       ` Steve Simon
2008-02-04 19:51                       ` Pietro Gagliardi
2008-02-06  9:53                   ` Greg Comeau
2008-02-06 19:11                     ` Joel C. Salomon
2008-02-07  1:32                       ` Uriel
2008-02-07  1:44                         ` Pietro Gagliardi
2008-02-07  9:54                       ` Greg Comeau
2008-02-06  9:45               ` Greg Comeau
2008-02-04 11:09             ` Uriel
2008-02-06  9:53               ` Greg Comeau
2008-02-04 14:32             ` Charles Forsyth [this message]
2008-02-02  4:57       ` Pietro Gagliardi
2008-02-02  7:12         ` Filipp Andronov
2008-02-02 14:57           ` Pietro Gagliardi
2008-02-02 15:30             ` Filipp Andronov
2008-02-02 15:33               ` Pietro Gagliardi
2008-02-02 15:48                 ` Filipp Andronov
2008-02-02 16:04                   ` Pietro Gagliardi
2008-02-02 16:34                     ` Filipp Andronov
2008-02-02 16:10                   ` Charles Forsyth
2008-02-02 17:41                     ` Uriel
2008-02-02 18:27                       ` Martin Neubauer
2008-02-02 19:22                         ` Juan M. Mendez
2008-02-02 19:42                           ` Anthony Sorace
2008-02-02 20:10                           ` erik quanstrom
2008-02-04  1:49                             ` Enrico Weigelt
2008-02-02 22:25                           ` ron minnich
2008-02-03  0:17                           ` Robert William Fuller
2008-02-03  0:30                             ` Rob Pike
2008-02-03  7:51                               ` Eris Discordia
2008-02-03  8:44                                 ` Filipp Andronov
2008-02-03  9:30                                   ` lucio
2008-02-03 11:39                                     ` Filipp Andronov
2008-02-03 12:49                                       ` lucio
2008-02-03 13:25                                         ` Filipp Andronov
2008-02-03 14:10                                         ` Pietro Gagliardi
2008-02-04  2:05                                     ` Enrico Weigelt
2008-02-08 16:40                                     ` plan9
2008-02-03 14:07                                   ` Pietro Gagliardi
2008-02-03  0:33                             ` Uriel
2008-02-03  1:42                             ` erik quanstrom
2008-02-03  1:55                               ` Pietro Gagliardi
2008-02-03 14:47                                 ` Paweł Lasek
2008-02-04  2:03                                   ` Enrico Weigelt
     [not found]                                   ` <b11249e00802030713x2e08a3d4g4d395c53e1bf658c@mail.gmail.com>
     [not found]                                     ` <F9E7B91B-B3DD-4F5F-92F2-9556311B559D@mac.com>
     [not found]                                       ` <b11249e00802030728p6475625kd19bdf54666272df@mail.gmail.com>
     [not found]                                         ` <6018296E-43A8-43D5-94C1-6EE4B7CE36B6@mac.com>
     [not found]                                           ` <b11249e00802030756k6d11a110g76c2be92fc88d058@mail.gmail.com>
2008-02-04  2:57                                             ` Enrico Weigelt
2008-02-04  8:00                                               ` Filipp Andronov
2008-02-03  7:31                               ` john
2008-02-03 15:01                             ` dave.l
2008-02-03 15:10                               ` Pietro Gagliardi
2008-02-02 21:16                         ` Pietro Gagliardi
2008-02-02 22:01                           ` Martin Neubauer
2008-02-04  1:02                       ` Enrico Weigelt
2008-02-04  1:11                         ` Pietro Gagliardi
2008-02-04  1:19           ` Enrico Weigelt
2008-02-04  1:29             ` Lyndon Nerenberg
2008-02-05  2:23               ` David Arnold
2008-02-05  2:26                 ` Pietro Gagliardi
2008-02-05  2:38                   ` erik quanstrom
2008-02-05  2:51                     ` Pietro Gagliardi
2008-02-05  3:00                       ` Roman V. Shaposhnik
2008-02-06  9:53                         ` Greg Comeau
2008-02-05  3:35                   ` Federico G. Benavento
2008-02-05  2:31                 ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d23b63cb750e4c99edb6a23aefb2d57c@terzarima.net \
    --to=forsyth@terzarima.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).