segedit.1   [plain text]


.TH SEGEDIT 1 "October 23, 1997" "Apple Computer, Inc."
.SH NAME
segedit \- extract and replace sections from object files
.SH SYNOPSIS
.B segedit
[ option ] name ...
.I input_file
[\-extract
.IR "segname sectname filename" "] ..."
[[\-replace
.IR "segname sectname filename" "] ..."
\-output
.IR output_file ]
.SH DESCRIPTION
.I Segedit
extracts and or replaces the named sections from the
.I input_file
and creates an
.I output_file
(if replacing a section).  The segment and section names are
the same as specified to
.IR ld (1)
with the
.B \-segcreate
option.  The segment and section names of an object file can be examined with
the
.B \-l
option to 
.IR otool (1).
Only sections in segments that have no relocation to or for them can be
replaced (marked with the
.SM SG_NORELOC
segment flag) but all sections can be
extracted.
.PP
The options to
.IR segedit (1):
.TP
.BI \-extract " segname sectname filename"
Extracts the section specified by the segment name section name pair and places
the contents in the specified
.I filename.
.TP
.BI \-replace " segname sectname filename"
Will replace the section specified by the segment name section name pair and
places and take the new contents for the section from the specified
.I filename.
The
.BI \-output " filename"
option must also be specified.
The resulting size of the section will be rounded to a multiple of 4 bytes and
padded with zero bytes if necessary.
.TP
.BI \-output " output_file"
Specifies the output file to create when replacing sections.
.SH "SEE ALSO"
ld(1), otool(1)
.SH "LIMITATIONS"
Only mach-O format files that are laid out in a contiguous address space
and with their contents ordered in the order of increasing address can have
their segments replaced by this program.  This layout is what the link editor
produces by default.