Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

segedit(1) [opendarwin man page]

SEGEDIT(1)						      General Commands Manual							SEGEDIT(1)

NAME
segedit - extract and replace sections from object files SYNOPSIS
segedit [ option ] name ... input_file [-extract segname sectname filename] ... [[-replace segname sectname filename] ... -output out- put_file] DESCRIPTION
Segedit extracts and or replaces the named sections from the input_file and creates an output_file (if replacing a section). The segment and section names are the same as specified to ld(1) with the -segcreate option. The segment and section names of an object file can be examined with the -l option to otool(1). Only sections in segments that have no relocation to or for them can be replaced (marked with the SG_NORELOC segment flag) but all sections can be extracted. The options to segedit(1): -extract segname sectname filename Extracts the section specified by the segment name section name pair and places the contents in the specified filename. -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 filename. The -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. -output output_file Specifies the output file to create when replacing sections. SEE ALSO
ld(1), otool(1) 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. Apple Computer, Inc. October 23, 1997 SEGEDIT(1)

Check Out this Related Man Page

GETSECTBYNAME(3)					     Library Functions Manual						  GETSECTBYNAME(3)

NAME
getsectbyname, getsectdata - get the section information for the named section SYNOPSIS
#include <mach-o/getsect.h> const struct section *getsectbynamefromheader( const struct mach_header *mhp, const char *segname, const char *sectname) const struct section *getsectbyname( const char *segname, const char *sectname) char *getsectdatafromheader( const struct mach_header *mhp, const char *segname, const char *sectname, unsigned long *size) char *getsectdata( const char *segname, const char *sectname, unsigned long *size) char *getsectdatafromFramework( const char *FrameworkName, const char *segname, const char *sectname, unsigned long *size) DESCRIPTION
Getsectbynamefromheader returns the section structure for the named section in the named segment if it exists in the specified Mach header otherwise it returns NULL. If the specified Mach header comes from a dynamic library as returned by _dyld_get_image_header(3) the addr field in the section structure will have to have _dyld_get_image_vmaddr_slide(3) added to it to make it a valid pointer. Getsectbyname is the same as getsectbynamefromheader with its first argument being the link editor defined symbol _mh_execute_header. Getsectdatafromheader returns the address to the data for the named section in the named segment if it exists in the specified Mach header. Also it returns the size of the section data indirectly through the pointer size. Otherwise it returns NULL for the pointer and zero for the size. If the specified Mach header comes from a dynamic library as returned by _dyld_get_image_header(3) the address to the data returned will have to have _dyld_get_image_vmaddr_slide(3) added to it to make it a valid pointer. Getsectdata is the same as getsectdatafromheader with its first argument being the link editor defined symbol _mh_execute_header. getsectdatafromFramework is used to get the named section data from the named Framework. For example, the framework name ``Appkit'' would be used for /System/Library/Frameworks/Appkit.framework/Versions/C/Appkit. If that Framework isn't being used by the program then it returns NULL for the pointer and zero for the size. SEE ALSO
dyld(3), getsegbyname(3) Apple Computer, Inc. April 10, 1998 GETSECTBYNAME(3)
Man Page