168 lines
4.7 KiB
HTML
168 lines
4.7 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of END</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>END</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2019-03-06<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
etext, edata, end - end of program segments
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>extern</B><I> etext</I><B>;</B>
|
|
<B>extern</B><I> edata</I><B>;</B>
|
|
<B>extern</B><I> end</I><B>;</B>
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The addresses of these symbols indicate the end of various program
|
|
segments:
|
|
<DL COMPACT>
|
|
<DT id="1"><I>etext</I>
|
|
|
|
<DD>
|
|
This is the first address past the end of the text segment
|
|
(the program code).
|
|
<DT id="2"><I>edata</I>
|
|
|
|
<DD>
|
|
This is the first address past the end of the
|
|
initialized data segment.
|
|
<DT id="3"><I>end</I>
|
|
|
|
<DD>
|
|
This is the first address past the end of the
|
|
uninitialized data segment (also known as the BSS segment).
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
Although these symbols have long been provided on most UNIX systems,
|
|
they are not standardized; use with caution.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The program must explicitly declare these symbols;
|
|
they are not defined in any header file.
|
|
<P>
|
|
|
|
On some systems the names of these symbols are preceded by underscores,
|
|
thus:
|
|
<I>_etext</I>,
|
|
|
|
<I>_edata</I>,
|
|
|
|
and
|
|
<I>_end</I>.
|
|
|
|
These symbols are also defined for programs compiled on Linux.
|
|
<P>
|
|
|
|
At the start of program execution,
|
|
the program break will be somewhere near
|
|
<I>&end</I>
|
|
|
|
(perhaps at the start of the following page).
|
|
However, the break will change as memory is allocated via
|
|
<B><A HREF="/cgi-bin/man/man2html?2+brk">brk</A></B>(2)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?3+malloc">malloc</A></B>(3).
|
|
|
|
Use
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sbrk">sbrk</A></B>(2)
|
|
|
|
with an argument of zero to find the current value of the program break.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>EXAMPLE</H2>
|
|
|
|
When run, the program below produces output such as the following:
|
|
<P>
|
|
|
|
|
|
|
|
$<B> ./a.out</B>
|
|
|
|
First address past:
|
|
<BR> program text (etext) 0x8048568
|
|
<BR> initialized data (edata) 0x804a01c
|
|
<BR> uninitialized data (end) 0x804a024
|
|
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Program source</H3>
|
|
|
|
|
|
|
|
#include <<A HREF="file:///usr/include/stdio.h">stdio.h</A>>
|
|
#include <<A HREF="file:///usr/include/stdlib.h">stdlib.h</A>>
|
|
<P>
|
|
extern char etext, edata, end; /* The symbols must have some type,
|
|
<BR> or "gcc -Wall" complains */
|
|
<P>
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
<BR> printf("First address past:\n");
|
|
<BR> printf(" program text (etext) %10p\n", &etext);
|
|
<BR> printf(" initialized data (edata) %10p\n", &edata);
|
|
<BR> printf(" uninitialized data (end) %10p\n", &end);
|
|
<P>
|
|
<BR> exit(EXIT_SUCCESS);
|
|
}
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+objdump">objdump</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+readelf">readelf</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sbrk">sbrk</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+elf">elf</A></B>(5)
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="7"><A HREF="#lbAE">CONFORMING TO</A><DD>
|
|
<DT id="8"><A HREF="#lbAF">NOTES</A><DD>
|
|
<DT id="9"><A HREF="#lbAG">EXAMPLE</A><DD>
|
|
<DL>
|
|
<DT id="10"><A HREF="#lbAH">Program source</A><DD>
|
|
</DL>
|
|
<DT id="11"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="12"><A HREF="#lbAJ">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:39 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|