This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Porting Gas


Jeff Webb writes:
 > Does anyone know where to find documentation on porting gas to a new
 > processor?  I would like to know how this is done.  What files need to
 > be created, and how should these be added to the source tree to create a
 > new target?  I am using the gas970915 package from egcs, but any
 > information will be helpful.

There are scraps of documentation supplied with the binutils
package... look at the texinfo files in bfd/doc and gas/doc.
As usual, it's probably easiest to copy a similar target.

Do you have much freedom with the object file format you want to use
or do you have to be compatible with some kludged COFF variation, for
example?  If it is the latter case you'll have to battle with the 
bfd :-(

Porting gas is reasonably straightforward, but it's a shame that it
doesn't use a standardised parser and machine description for
translating opcodes.  I'm not sure of the approach used by others, but
I found it easier to use a common opcode table for both gas and the
disassembler and to port them at the same time.

Here's a list of the important files you need to hack or write for a
new target using COFF...

bfd:
binutils/bfd/cpu-tgt.h         
binutils/bfd/coff-tgt.h         
binutils/bfd/coffswap.h         
binutils/bfd/coffcode.h         
binutils/include/coff/tgt.h
binutils/include/coff/internal.h

gas:
binutils/gas/config/tc-tgt.h
binutils/gas/config/tc-tgt.c
binutils/include/opcodes/tgt.h

objdump:
binutils/opcode/dis-tgt.h      
binutils/include/opcodes/tgt.h 
binutils/binutils/objdump.c

ld:
binutils/ld/emulparams/tgtcoff.c
binutils/ld/scripttempl/tgtcoff.sc