[wellylug]The top 10 dead (or dying) computer skills
Cliff Pratt
enkidu at cliffp.com
Thu Jul 12 09:27:42 NZST 2007
Phillip Hutchings wrote:
> On 7/11/07, Cliff Pratt <enkidu at cliffp.com> wrote:
>> nic wrote:
>> > And then there's DSP code, where _sometimes_ you want to get every last
>> > bit of performance out of a platform, and recoding an algorithm in
>> > assembler is the only practical option
>> >
>> > And porting a system to a new platform: you have to write the boot code
>> > in assembler, and you have to write the code create a C runtime
>> > environment in assembler.
>> >
>> You do not have to write in assembler to create either boot code or to
>> create a C runtime environment. You can do it in almost any language.
>
> When you're creating the first compiler for an entirely new platform
> you have to write _something_ in assembler. GCC won't magically output
> valid code for an unknown platform.
>
No. The way it is done is by cross-compiling. You write the code to
generate the new compiler on a convenient platform in a convenient
language and include the stuff to make it executable on the new system
and to allow it to create new executables on the new system. The
compiler is then transferred to the new platform. You don't *need* to go
to the assembler level, though for some routines it may be more
efficient at run time if you do so. And you need to know how to
interface with the system routines on the new platform.
But you were talking about 'gcc'. The way to get 'gcc' to work on the
new platform is to amend the code of 'gcc' on a convenient platform, so
that it will create a valid executable for the new platform and create
correct binaries for the new code that it will generate and then compile
it (using the current version of the compiler for the compile platform).
The new version of the compiler will have the support for the new
platform. The binary of 'gcc' created is then transferred to the new
platform. Since you have compiled it as an executable for that system it
will run on that system and create valid executables for that system.
So far as I am aware, gcc is written in C, isn't it?
Cheers,
Cliff
More information about the wellylug
mailing list