GETEND(3) GETEND(3)
NAME
getend, getetext, getedata - get values of UNIX link editor defined
symbols
SYNOPSIS
#include
unsigned long getend();
unsigned long getetext();
unsigned long getedata();
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 rou-
tines 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 vmallocate(2),
if you are trying to find out about your address space use vmregion(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 getetext, getedata, and getend
respectively. In a Mach-O file they have the following values:
getetext returns the first address after the (TEXT,text) section,
note this my or may not be the only section in the TEXT segment.
getedata 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. getend 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 GETEND(3)
|