Adding better 68040 support to gcc ---------------------------------- The 68040 has new opcodes, some of which - like move16, should be quite useful. The 040 also has a different FPU, so some 68881/2 opcodes run much slower. Gcc-2.3.x understands the 68040, but needs to know you want 040 specific code. Worse, the most wide spread version of gas, gas-1.38, does not understand 040 opcodes. Obviously the first thing to do is to get a gas that knows about 040s, such as gas-2.0. Build this version and slip it into place of your existing gas binary. The next trick is to get gcc to generate 040 specific code. This is quite simple. Generate a specs file for your gcc if don't have one already. This is done by going into the directory where your copies of cc1, cc1plus, etc. live and running: gcc_for_68k -dumpspecs > specs Now you can edit the specs file to add 040 support. At our site the installed base is a mix of 020s, 030s and 040s. To make it easy to maintain the 020/030 makefiles until the day they all pass away, we changed the asm & cpp lines to default to 020 mode unless specified: *asm: %{m68000:-mc68010}%{mc68000:-mc68010}%{m68040:-mc68040}%{mc68040:-mc68040} %{!mc68000:%{!m68000:%{!mc68040:%{!m68040:-mc68020}}}} %{fpic:-k} %{fPIC:-k} *cpp: %{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}%{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68020__ }}%{m68040:-D__mc68040__}%{mc68040:-D__mc68040__} %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:%{!mc68040:%{!m68040:-Dmc68020}}}}} Now a user can compile for an 040 by adding -m68040 or -mc68040 to the compilation line. When the day comes that most of our cpus are 040 based instead we might change this to: *asm: %{m68000:-mc68010}%{mc68000:-mc68010}%{m68020:-mc68020}%{mc68020:-mc68020} %{!mc68000:%{!m68000:%{!mc68020:%{!m68020:-mc68040}}}} %{fpic:-k} %{fPIC:-k} *cpp: %{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}%{m68000:-D__mc68010__}%{mc68000:-D__mc68010__}%{!mc68000:%{!m68000:-D__mc68040__ }}%{m68020:-D__mc68020__}%{mc68020:-D__mc68020__} %{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:%{!mc68020:%{!m68020:-Dmc68040}}}}} *cc1: %{sun3:} %{target:} %{m68000:-m68010}%{mc68000:-m68010}%{m68020:-m68020}%{mc68020:-mc68020} %{!mc68000:%{!m68000:%{!mc68020:%{!m68020:-m68040}}}} Now gcc generates 040 code by default, unless given a -m68020 option.