1END(3)                     Linux Programmer's Manual                    END(3)
2
3
4

NAME

6       etext, edata, end - end of program segments
7

SYNOPSIS

9       extern etext;
10       extern edata;
11       extern end;
12

DESCRIPTION

14       The addresses of these symbols indicate the end of various program seg‐
15       ments:
16
17       etext  This is the first address past the end of the text segment  (the
18              program code).
19
20       edata  This  is  the first address past the end of the initialized data
21              segment.
22
23       end    This is the first address past the end of the uninitialized data
24              segment (also known as the BSS segment).
25

CONFORMING TO

27       Although  these  symbols  have long been provided on most UNIX systems,
28       they are not standardized; use with caution.
29

NOTES

31       The program must explicitly declare these symbols; they are not defined
32       in any header file.
33
34       On some systems the names of these symbols are preceded by underscores,
35       thus: _etext, _edata, and _end.  These symbols  are  also  defined  for
36       programs compiled on Linux.
37
38       At  the start of program execution, the program break will be somewhere
39       near &end (perhaps at the start of the following page).   However,  the
40       break  will change as memory is allocated via brk(2) or malloc(3).  Use
41       sbrk(2) with an argument of zero to find the current value of the  pro‐
42       gram break.
43

EXAMPLES

45       When run, the program below produces output such as the following:
46
47           $ ./a.out
48           First address past:
49               program text (etext)       0x8048568
50               initialized data (edata)   0x804a01c
51               uninitialized data (end)   0x804a024
52
53   Program source
54
55       #include <stdio.h>
56       #include <stdlib.h>
57
58       extern char etext, edata, end; /* The symbols must have some type,
59                                          or "gcc -Wall" complains */
60
61       int
62       main(int argc, char *argv[])
63       {
64           printf("First address past:\n");
65           printf("    program text (etext)      %10p\n", &etext);
66           printf("    initialized data (edata)  %10p\n", &edata);
67           printf("    uninitialized data (end)  %10p\n", &end);
68
69           exit(EXIT_SUCCESS);
70       }
71

SEE ALSO

73       objdump(1), readelf(1), sbrk(2), elf(5)
74

COLOPHON

76       This  page  is  part of release 5.10 of the Linux man-pages project.  A
77       description of the project, information about reporting bugs,  and  the
78       latest     version     of     this    page,    can    be    found    at
79       https://www.kernel.org/doc/man-pages/.
80
81
82
83GNU                               2020-06-09                            END(3)
Impressum