head	1.1;
branch	1.1.1;
access;
symbols
	RELENG_8_4:1.1.1.1.0.80
	RELENG_9_1_0_RELEASE:1.1.1.1
	RELENG_9_1:1.1.1.1.0.78
	RELENG_9_1_BP:1.1.1.1
	RELENG_8_3_0_RELEASE:1.1.1.1
	RELENG_8_3:1.1.1.1.0.76
	RELENG_8_3_BP:1.1.1.1
	RELENG_9_0_0_RELEASE:1.1.1.1
	RELENG_9_0:1.1.1.1.0.74
	RELENG_9_0_BP:1.1.1.1
	RELENG_9:1.1.1.1.0.72
	RELENG_9_BP:1.1.1.1
	RELENG_7_4_0_RELEASE:1.1.1.1
	RELENG_8_2_0_RELEASE:1.1.1.1
	RELENG_7_4:1.1.1.1.0.70
	RELENG_7_4_BP:1.1.1.1
	RELENG_8_2:1.1.1.1.0.68
	RELENG_8_2_BP:1.1.1.1
	RELENG_8_1_0_RELEASE:1.1.1.1
	RELENG_8_1:1.1.1.1.0.66
	RELENG_8_1_BP:1.1.1.1
	RELENG_7_3_0_RELEASE:1.1.1.1
	RELENG_7_3:1.1.1.1.0.64
	RELENG_7_3_BP:1.1.1.1
	RELENG_8_0_0_RELEASE:1.1.1.1
	RELENG_8_0:1.1.1.1.0.62
	RELENG_8_0_BP:1.1.1.1
	RELENG_8:1.1.1.1.0.60
	RELENG_8_BP:1.1.1.1
	RELENG_7_2_0_RELEASE:1.1.1.1
	RELENG_7_2:1.1.1.1.0.58
	RELENG_7_2_BP:1.1.1.1
	RELENG_7_1_0_RELEASE:1.1.1.1
	RELENG_6_4_0_RELEASE:1.1.1.1
	RELENG_7_1:1.1.1.1.0.56
	RELENG_7_1_BP:1.1.1.1
	RELENG_6_4:1.1.1.1.0.54
	RELENG_6_4_BP:1.1.1.1
	RELENG_7_0_0_RELEASE:1.1.1.1
	RELENG_6_3_0_RELEASE:1.1.1.1
	RELENG_7_0:1.1.1.1.0.52
	RELENG_7_0_BP:1.1.1.1
	RELENG_6_3:1.1.1.1.0.50
	RELENG_6_3_BP:1.1.1.1
	RELENG_7:1.1.1.1.0.48
	RELENG_7_BP:1.1.1.1
	RELENG_6_2_0_RELEASE:1.1.1.1
	RELENG_6_2:1.1.1.1.0.46
	RELENG_6_2_BP:1.1.1.1
	RELENG_5_5_0_RELEASE:1.1.1.1
	RELENG_5_5:1.1.1.1.0.44
	RELENG_5_5_BP:1.1.1.1
	RELENG_6_1_0_RELEASE:1.1.1.1
	RELENG_6_1:1.1.1.1.0.42
	RELENG_6_1_BP:1.1.1.1
	RELENG_6_0_0_RELEASE:1.1.1.1
	RELENG_6_0:1.1.1.1.0.40
	RELENG_6_0_BP:1.1.1.1
	RELENG_6:1.1.1.1.0.38
	RELENG_6_BP:1.1.1.1
	RELENG_5_4_0_RELEASE:1.1.1.1
	RELENG_5_4:1.1.1.1.0.36
	RELENG_5_4_BP:1.1.1.1
	RELENG_4_11_0_RELEASE:1.1.1.1
	RELENG_4_11:1.1.1.1.0.34
	RELENG_4_11_BP:1.1.1.1
	RELENG_5_3_0_RELEASE:1.1.1.1
	RELENG_5_3:1.1.1.1.0.32
	RELENG_5_3_BP:1.1.1.1
	RELENG_5:1.1.1.1.0.30
	RELENG_5_BP:1.1.1.1
	binutils_2_15_20040523:1.1.1.1
	RELENG_4_10_0_RELEASE:1.1.1.1
	RELENG_4_10:1.1.1.1.0.28
	RELENG_4_10_BP:1.1.1.1
	RELENG_5_2_1_RELEASE:1.1.1.1
	RELENG_5_2_0_RELEASE:1.1.1.1
	RELENG_5_2:1.1.1.1.0.26
	RELENG_5_2_BP:1.1.1.1
	RELENG_4_9_0_RELEASE:1.1.1.1
	RELENG_4_9:1.1.1.1.0.24
	RELENG_4_9_BP:1.1.1.1
	RELENG_5_1_0_RELEASE:1.1.1.1
	RELENG_5_1:1.1.1.1.0.22
	RELENG_5_1_BP:1.1.1.1
	RELENG_4_8_0_RELEASE:1.1.1.1
	RELENG_4_8:1.1.1.1.0.20
	RELENG_4_8_BP:1.1.1.1
	RELENG_5_0_0_RELEASE:1.1.1.1
	RELENG_5_0:1.1.1.1.0.18
	RELENG_5_0_BP:1.1.1.1
	binutils_2_13_2_20021127:1.1.1.1
	binutils_2_13_20021011:1.1.1.1
	RELENG_4_7_0_RELEASE:1.1.1.1
	RELENG_4_7:1.1.1.1.0.16
	RELENG_4_7_BP:1.1.1.1
	BEFORE_BU_2121__RELENG4:1.1.1.1
	binutils_2_12_20020720:1.1.1.1
	RELENG_4_6_2_RELEASE:1.1.1.1
	RELENG_4_6_1_RELEASE:1.1.1.1
	binutils_2_12_20020622:1.1.1.1
	RELENG_4_6_0_RELEASE:1.1.1.1
	RELENG_4_6:1.1.1.1.0.14
	RELENG_4_6_BP:1.1.1.1
	binutils_2_12_20020410:1.1.1.1
	BEFORE_BU_2_12:1.1.1.1
	binutils_2_12_anoncvs_20020320:1.1.1.1
	binutils_2_12_anoncvs_20020221:1.1.1.1
	RELENG_4_5_0_RELEASE:1.1.1.1
	binutils_anoncvs_20020127:1.1.1.1
	RELENG_4_5:1.1.1.1.0.12
	RELENG_4_5_BP:1.1.1.1
	binutils_2_11_cvs_20011031:1.1.1.1
	RELENG_4_4_0_RELEASE:1.1.1.1
	RELENG_4_4:1.1.1.1.0.10
	RELENG_4_4_BP:1.1.1.1
	BEFORE_BU_2112__RELENG4:1.1.1.1
	binutils_2_11_cvs_20010719:1.1.1.1
	binutils_2_11_2:1.1.1.1
	binutils_2_11_0:1.1.1.1
	BEFORE_BU_2110:1.1.1.1
	RELENG_4_3_0_RELEASE:1.1.1.1
	RELENG_4_3:1.1.1.1.0.8
	RELENG_4_3_BP:1.1.1.1
	RELENG_4_2_0_RELEASE:1.1.1.1
	binutils_2_10_1:1.1.1.1
	RELENG_4_1_1_RELEASE:1.1.1.1
	PRE_SMPNG:1.1.1.1
	RELENG_4_1_0_RELEASE:1.1.1.1
	RELENG_3_5_0_RELEASE:1.1.1.1
	binutils_2_10_0:1.1.1.1
	BEFORE_UPGRADING_2_9_1:1.1.1.1
	sourceware_binutils-2_10-branch_anoncvs_20000512:1.1.1.1
	RELENG_4_0_0_RELEASE:1.1.1.1
	RELENG_4:1.1.1.1.0.6
	RELENG_4_BP:1.1.1.1
	RELENG_3_4_0_RELEASE:1.1.1.1
	RELENG_3_3_0_RELEASE:1.1.1.1
	RELENG_3_2_PAO:1.1.1.1.0.4
	RELENG_3_2_PAO_BP:1.1.1.1
	RELENG_3_2_0_RELEASE:1.1.1.1
	RELENG_3_1_0_RELEASE:1.1.1.1
	RELENG_3:1.1.1.1.0.2
	RELENG_3_BP:1.1.1.1
	RELENG_3_0_0_RELEASE:1.1.1.1
	gnu_2_9_1:1.1.1.1
	gnu_2_8_1:1.1.1.1
	FSF:1.1.1;
locks; strict;
comment	@# @;


1.1
date	98.03.01.22.56.51;	author jdp;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	98.03.01.22.56.51;	author jdp;	state Exp;
branches
	1.1.1.1.80.1;
next	;

1.1.1.1.80.1
date	98.03.01.22.56.51;	author svnexp;	state dead;
branches;
next	1.1.1.1.80.2;

1.1.1.1.80.2
date	2013.03.28.13.00.28;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@	Preliminary Notes on Porting BFD
	--------------------------------

The 'host' is the system a tool runs *on*.
The 'target' is the system a tool runs *for*, i.e.
a tool can read/write the binaries of the target.

Porting to a new host
---------------------
Pick a name for your host. Call that <host>.
(<host> might be sun4, ...)
Create a file hosts/<host>.mh.

Porting to a new target
-----------------------
Pick a name for your target. Call that <target>.
Call the name for your CPU architecture <cpu>.
You need to create <target>.c and config/<target>.mt,
and add a case for it to a case statements in bfd/configure.host and
bfd/config.bfd, which associates each canonical host type with a BFD
host type (used as the base of the makefile fragment names), and to the
table in bfd/configure.in which associates each target vector with
the .o files it uses.

config/<target>.mt is a Makefile fragment.
The following is usually enough:
DEFAULT_VECTOR=<target>_vec
SELECT_ARCHITECTURES=bfd_<cpu>_arch

See the list of cpu types in archures.c, or "ls cpu-*.c".
If your architecture is new, you need to add it to the tables
in bfd/archures.c, opcodes/configure.in, and binutils/objdump.c.

For more information about .mt and .mh files, see config/README.

The file <target>.c is the hard part.  It implements the
bfd_target <target>_vec, which includes pointers to
functions that do the actual <target>-specific methods.

Porting to a <target> that uses the a.out binary format
-------------------------------------------------------

In this case, the include file aout-target.h probaby does most
of what you need. The program gen-aout generates <target>.c for
you automatically for many a.out systems.  Do:
	make gen-aout
	./gen-aout <target> > <target>.c
(This only works if you are building on the target ("native").
If you must make a cross-port from scratch, copy the most
similar existing file that includes aout-target.h, and fix what is wrong.)

Check the parameters in <target>.c, and fix anything that is wrong.
(Also let us know about it; perhaps we can improve gen-aout.c.)

TARGET_IS_BIG_ENDIAN_P
	Should be defined if <target> is big-endian.

N_HEADER_IN_TEXT(x)
	See discussion in ../include/aout/aout64.h.

BYTES_IN_WORD
	Number of bytes per word. (Usually 4 but can be 8.)

ARCH
	Number of bits per word.  (Usually 32, but can be 64.)

ENTRY_CAN_BE_ZERO
	Define if the extry point (start address of an
	executable program) can be 0x0.

TEXT_START_ADDR
	The address of the start of the text segemnt in
	virtual memory.  Normally, the same as the entry point.

TARGET_PAGE_SIZE

SEGMENT_SIZE
        Usually, the same as the TARGET_PAGE_SIZE.
        Alignment needed for the data segment.

TARGETNAME
	The name of the target, for run-time lookups.
	Usually "a.out-<target>"
@


1.1.1.1
log
@Initial import of GNU binutils version 2.8.1.  Believe it or not,
this is heavily stripped down.
@
text
@@


1.1.1.1.80.1
log
@file PORTING was added on branch RELENG_8_4 on 2013-03-28 13:00:28 +0000
@
text
@d1 83
@


1.1.1.1.80.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 83
	Preliminary Notes on Porting BFD
	--------------------------------

The 'host' is the system a tool runs *on*.
The 'target' is the system a tool runs *for*, i.e.
a tool can read/write the binaries of the target.

Porting to a new host
---------------------
Pick a name for your host. Call that <host>.
(<host> might be sun4, ...)
Create a file hosts/<host>.mh.

Porting to a new target
-----------------------
Pick a name for your target. Call that <target>.
Call the name for your CPU architecture <cpu>.
You need to create <target>.c and config/<target>.mt,
and add a case for it to a case statements in bfd/configure.host and
bfd/config.bfd, which associates each canonical host type with a BFD
host type (used as the base of the makefile fragment names), and to the
table in bfd/configure.in which associates each target vector with
the .o files it uses.

config/<target>.mt is a Makefile fragment.
The following is usually enough:
DEFAULT_VECTOR=<target>_vec
SELECT_ARCHITECTURES=bfd_<cpu>_arch

See the list of cpu types in archures.c, or "ls cpu-*.c".
If your architecture is new, you need to add it to the tables
in bfd/archures.c, opcodes/configure.in, and binutils/objdump.c.

For more information about .mt and .mh files, see config/README.

The file <target>.c is the hard part.  It implements the
bfd_target <target>_vec, which includes pointers to
functions that do the actual <target>-specific methods.

Porting to a <target> that uses the a.out binary format
-------------------------------------------------------

In this case, the include file aout-target.h probaby does most
of what you need. The program gen-aout generates <target>.c for
you automatically for many a.out systems.  Do:
	make gen-aout
	./gen-aout <target> > <target>.c
(This only works if you are building on the target ("native").
If you must make a cross-port from scratch, copy the most
similar existing file that includes aout-target.h, and fix what is wrong.)

Check the parameters in <target>.c, and fix anything that is wrong.
(Also let us know about it; perhaps we can improve gen-aout.c.)

TARGET_IS_BIG_ENDIAN_P
	Should be defined if <target> is big-endian.

N_HEADER_IN_TEXT(x)
	See discussion in ../include/aout/aout64.h.

BYTES_IN_WORD
	Number of bytes per word. (Usually 4 but can be 8.)

ARCH
	Number of bits per word.  (Usually 32, but can be 64.)

ENTRY_CAN_BE_ZERO
	Define if the extry point (start address of an
	executable program) can be 0x0.

TEXT_START_ADDR
	The address of the start of the text segemnt in
	virtual memory.  Normally, the same as the entry point.

TARGET_PAGE_SIZE

SEGMENT_SIZE
        Usually, the same as the TARGET_PAGE_SIZE.
        Alignment needed for the data segment.

TARGETNAME
	The name of the target, for run-time lookups.
	Usually "a.out-<target>"
@


