seg_addr_table.1   [plain text]


.TH SEG_ADDR_TABLE l "May 24, 2002" "Apple Computer, Inc."
.SH NAME
seg_addr_table \- re-layout, update or check a segment address table
.SH SYNOPSIS
.B seg_addr_table [operation] [options] [\-o output_file]
.sp .5
.SH DESCRIPTION
.I seg_addr_table
re-lays out, updates or checks a segment address table.  If it can do its
operation with out problems
.IR seg_addr_table (l)
exits with zero status.  Else it exits with a non-zero status and prints an
error message about the problem.
.PP
The Apple Build and Integration team uses the segment address table in 
/AppleInternal/Developer/seg_addr_table to set the preferred addresses of
dynamic libraries.  See the
.IR ld (1)
man page under the
.B \-seg_addr_table
option and its environment variable
.SM LD_SEG_ADDR_TABLE.
.PP
The format of segment address table are lines of three forms.
The entries in the table are lines containing either a single hex address and an
install name or two hex addresses and an install name.  In the first form the
single hex address is used for ``flat'' libraries and is the
.B "\-seg1addr".
In the second form is used for ``split'' libraries and the first address is
the
.B "\-segs_read_only_addr"
address and the second is the
.B "\-segs_read_write_addr"
address.
The third form is used for fixed regions that are not to be allocated.  They
have a hex addresses and a hex size and the literal string
.B "<<< Fixed address and size not to assign >>>".
Lines starting with the # character are treated as comments.
.PP
The output table of
.IR seg_addr_table (l)
also contains two special entries.  One for the next addresses to assign
``flat'' libraries and one for the next addresses to assign to ``split''
libraries.  Comments are generated before these entries stating they must not
be removed.
.PP
The following option must be specified when using the
.B \-relayout
or
.B \-update
options:
.TP
.BI \-o " output_file"
Write the new segment address table to
.I output_file.
.PP
One of the following operations must be specified:
.TP
.B \-relayout
This causes the entire table to be re-laied out and all dynamic libraries to
be assigned addresses.  The address are assigned in the order specified and
the space given to each is based on the libraries virtual address sizes.
.TP
.B \-update
Only entries with zero address values are assigned addresses.  The address
assignment is based on the special entries in the table for the next addresses
to assign.
.TP
.B \-update_overlaps
Detects overlaps in the table and reassigns the lower of the two addresses.  The address 
assignment is based on the special entries in the table for the next addresses
to assign.  This action is similar to detecting overlaps with -checkonly, setting
the overlapping library to 0x00000000 and running with -update. 
.TP
.B \-relayout_nonsplit
Similar to relayout except it only causes all the non split libraries to
re-laied out and all non-split dynamic libraries to be assigned addresses.  The 
addresses are assigned in order specified and the space given to each is based
on the libraries virtual address sizes.
.TP
.B \-checkonly
This option only checks the entries in the table for overlaps.
.PP
The following options may be specified with any of the operations:
.TP
.BI \-seg_addr_table " filename"
This is the input segment address table.  If not specified the default is
/AppleInternal/Developer/seg_addr_table.
.TP
.BI \-release " release_name"
For each ``flat'' entry in the table try finding and using the dynamic library
from the
.SM $(SYMROOT)
from the specified
.I release_name
to base the size of the library on.
If the file in not found in the
.SM $(SYMROOT)
or it is a ``split'' entry then use the dynamic library in the
.SM $(DSTROOT)
from the specified
.I release_name
to base the size of the library on.
Without this option the library with the install name on the machine running
is used.  With this option the library with the install name on the machine
running is never used.
.PP
The following options may be specified with the
.B \-relayout
operation:
.TP
.BI "\-seg1addr" " addr"
Specifies the starting address to layout ``flat'' libraries.
.I addr
is a hexadecimal number and should be a multiple of the target pagesize.
The default if not specified is 0x41300000 when the environment variable
.SM MACOSX_DEPLOYMENT_TARGET
is 10.1 or not set and allocations are into increasing addresses.  When
.SM MACOSX_DEPLOYMENT_TARGET
is 10.2 or greater the default is 0x7ffc0000 and allocations are into
decreasing addresses.
.TP
.BI \-allocate_flat " direction"
Specifies which
.I direction
to allocate flat addresses into.  The argument
.I direction
can be either
.I increasing
or
.I decreasing.
The default if not specified is increasing when the environment variable
.SM MACOSX_DEPLOYMENT_TARGET
is 10.1 or not set and when
.SM MACOSX_DEPLOYMENT_TARGET
is 10.2 or greater the default is decreasing.
.TP
.BI "\-segs_read_only_addr" " addr"
Specifies the starting address to layout the read-only segments of ``split''
libraries.
.I addr
is a hexadecimal number and should be a multiple of the target pagesize.
The default if not specified is 0x70000000 when the environment variable
.SM MACOSX_DEPLOYMENT_TARGET
is 10.1 or not set and when
.SM MACOSX_DEPLOYMENT_TARGET
is 10.2 or greater the default is 0x90000000.
.TP
.BI "\-segs_read_write_addr" " addr"
Specifies the starting address to layout the read-write segments of ``split''
libraries.
.I addr
is a hexadecimal number and should be a multiple of the target pagesize.
The default if not specified is 0x80000000 when the environment variable
.SM MACOSX_DEPLOYMENT_TARGET
is 10.1 or not set and when
.SM MACOSX_DEPLOYMENT_TARGET
is 10.2 or greater the default is 0xa0000000.
.PP
The following options may be specified with any operation:
.TP
.B \-disablewarnings
This option disables a small number of warnings which is useful for B&I when
running the
.B \-update
operation and there are entries in the table that have problems.  These entries
are then removed from the table when creating the output.
.TP
.BI \-arch " arch_type"
Specifies the architecture,
.I arch_type,
in the files to use for the sizes.  More than one
.BI \-arch " arch_type"
can be specified.  The default is 
.BI \-arch " all"
which uses all architectures in the file.  See
.IR arch (3)
for the currently known
.IR arch_type s.
.SH "SEE ALSO"
ld(1)