Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

end(3) [osx man page]

GET_END(3)						     Library Functions Manual							GET_END(3)

NAME
get_end, get_etext, get_edata - get values of UNIX link editor defined symbols SYNOPSIS
#include <mach-o/getsect.h> unsigned long get_end(); unsigned long get_etext(); unsigned long get_edata(); DESCRIPTION
These routines provide a stopgap measure to programs that use the UNIX link-editor defined symbols. Use of these routines is very strongly discouraged. The problem is that any program that is using UNIX link editor defined symbols (_end, _etext or _edata) is making assumptions that the program has the memory layout of a UNIX program. This is an incorrect assumption for a program built by the Mach-O link editor. The reason that these routines are provided is that if very minimal assumptions about the layout are used and the default format and memory layout of the Mach-O link editor is used to build the pro- gram, some things may work by using the values returned by these routines in place of the addresses of their UNIX link-editor defined sym- bols. So use at your own risk, and only if you know what your doing. Or better yet, convert the program to use the appropriate Mach or Mach-O functions. If you are trying to allocate memory use vm_allocate(2), if you are trying to find out about your address space use vm_region(2) and if you are trying to find out where your program is loaded use the dyld(3) functions. The values of the UNIX link-editor defined symbols _etext, _edata and _end are returned by the routines get_etext, get_edata, and get_end respectively. In a Mach-O file they have the following values: get_etext returns the first address after the (__TEXT,__text) section, note this my or may not be the only section in the __TEXT segment. get_edata returns the first address after the (__DATA,__data) section, note this my or may not be the last non-zero fill section in the __DATA segment. get_end returns the first address after the last segment in the executable, note a shared library may be loaded at this address. SEE ALSO
ld(1), dyld(3) Apple Computer, Inc. April 10, 1998 GET_END(3)

Check Out this Related Man Page

MACH-O(5)							File Formats Manual							 MACH-O(5)

NAME
Mach-O - Mach-O assembler and link editor output SYNOPSIS
#include <mach-o/loader.h> #include <mach-o/nlist.h> #include <mach-o/stab.h> #include <mach-o/reloc.h> DESCRIPTION
The object files produced by the assembler and link editor are in Mach-O (Mach object) file format. The file name a.out is the default output file name of the assembler as(1) and the link editor ld(1) The format of the object file however is not 4.3BSD a.out format as the name suggests, but rather Mach-O format. The link editor will make a.out executable if the resulting format is an executable type and there were no errors and no unresolved external references. The complete description of a Mach-O file is given in a number of include files. The file <mach-o/loader.h> describes the headers, <mach- o/nlist.h> describes the symbol table entries with <mach-o/stab.h> supplementing it, and <mach-o/reloc.h> describes the relocation entries. The actual instructions and data used by the program represented by a Mach-O file are the contents of its sections. Sections are grouped together in segments. Each section carries with it, in its header, the information as to which segment it belongs in. When a file type that is executable is created the sections are placed in their proper segment and all the segment headers are created and the segments themselves are padded out to the segment alignment (typically the target pagesize). For the object file type produced by an assembler (or by the link editor for further linking) all the sections are placed in one segment for compactness. When the kernel executes a Mach-O file it maps in the object file's segments, the dynamic link editor (if used) and creates the thread(s) for execution. Any part of the object file that is not part of a segment is not mapped in for execution. For executable using the dynamic link editor the headers and other link edit information is needed to execute the file. These parts include the relocation entries, the symbol table and the string table. These parts are mapped in with the use of the link editor's -seglinkedit option which creates a segment that contains these parts. These parts can be stripped down with the -S option to ld(1) or various options to strip(1). SEE ALSO
as(1), ld(1), nm(1), gdb(1), stab(5), strip(1) Apple Computer, Inc. October 22, 2001 MACH-O(5)
Man Page