From mboxrd@z Thu Jan 1 00:00:00 1970 From: forsyth@caldo.demon.co.uk To: 9fans@cse.psu.edu Subject: Re: [9fans] Plan9 16bit C compilers MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20020215122234.D163219A2A@mail.cse.psu.edu> Date: Fri, 15 Feb 2002 12:30:30 +0000 Topicbox-Message-UUID: 51718a30-eaca-11e9-9e20-41e7f4b1d025 we aim to avoid Plan 9 C extensions (indeed any C extensions at all) when writing code that's intended to work in hosted mode for Inferno (ie, emu). // as comments tends to slip through from time to time because so many compilers accept it, but i sort it out when i notice (at least one of the target platforms won't accept it). the problem with using Plan 9 (or Inferno) compilers to generate code for other architectures is that the object code runtime conventions of the target machines's native compilers are often unattractive. for instance, on the SPARC, the plan 9 suite doesn't use register windows; on the powerpc, i avoided using any of the ABIs because there are several and they all involve some mess. sometimes the Inferno/Plan9 suites can do things the other compilers don't. for instance, again on the powerpc, i found it effective to set R0 to 0, given that the hardware makes it less than general purpose 1/3 of the time, and i saved a few percent in code size as a result. i also avoided having all that `module linkage' crud in procedure calls. as another example, the Plan 9/Inferno suite assumes caller-saves for all volatile registers on all architectures. this makes it hard -- not impossible, but requiring care -- to interact with native compiled code in libraries in some cases. on the 386, though, where there are precious few sensible registers and fewer options for interesting use of the instructions, there probably is enough compatibility between the object code models that it would be feasible to generate code for Linux and others. shared libraries are a potential complication, i suppose (hello, geoff and boyd). i thought someone had got the Plan 9 or Inferno compilers cross-compiling for Linux, though.