document bfdsumm.texi
[deliverable/binutils-gdb.git] / bfd / PORTING
CommitLineData
5f9a2245
DM
1 Preliminary Notes on Porting BFD
2 --------------------------------
3
4The 'host' is the system a tool runs *on*.
5The 'target' is the system a tool runs *for*, i.e.
6a tool can read/write the binaries of the target.
7
8Porting to a new host
9---------------------
10Pick a name for your host. Call that <host>.
11(<host> might be sun4, ...)
12Create a file hosts/h-<host>.
13
14Porting to a new target
15-----------------------
16Pick a name for your target. Call that <target>.
17You need to create <target>.c and config/mt-<target>.
18
19config/mt-<target> is a Makefile fragment.
20The following is usually enough:
21DEFAULT_VECTOR=<target>_vec
22SELECT_ARCHITECTURES=bfd_<cpu>_arch
23
24See the list of cpu types in archures.c, or "ls cpu-*.c".
25
26The file <target>.c is the hard part. It implements the
27bfd_target <target>_vec, which includes pointers to
28functions that do the actual <target>-specific methods.
29
30Porting to a <target> that uses the a.out binary format
31-------------------------------------------------------
32
33In this case, the include file aout-target.h probaby does most
34of what you need. The program gen-aout generates <target>.c for
35you automatically for many a.out systems. Do:
36 make gen-aout
37 ./gen-aout <target> > <target>.c
38(This only works if you are building on the target ("native").
39If you must make a cross-port from scratch, copy the most
40similar existing file that includes aout-target.h, and fix what is wrong.)
41
42Check the parameters in <target>.c, and fix anything that is wrong.
43(Also let us know about it; perhaps we can improve gen-aout.c.)
44
45TARGET_IS_BIG_ENDIAN_P
46 Should be defined if <target> is big-endian.
47
48N_HEADER_IN_TEXT(x)
49 See discussion in ../include/aout/aout32.h.
50
51BYTES_IN_WORD
52 Number of bytes per word. (Usually 4 but can be 8.)
53
54ARCH
55 Number of bits per word. (Usually 32, but can be 64.)
56
57ENTRY_CAN_BE_ZERO
58 Define if the extry point (start address of an
59 executable program) can be 0x0.
60
61TEXT_START_ADDR
62 The address of the start of the text segemnt in
63 virtual memory. Normally, the same as the entry point.
64
65PAGE_SIZE
66
67SEGMENT_SIZE
68 Usually, the same as the PAGE_SIZE.
69 Alignment needed for the data segment.
70
71TARGETNAME
72 The name of the target, for run-time lookups.
73 Usually "a.out-<target>"
This page took 0.037512 seconds and 4 git commands to generate.