OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man3 / end.3
1 .\" Copyright (c) 2008, Linux Foundation, written by by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" License.
24 .\"
25 .\" Japanese Version Copyright (c) 2008  Akihiro MOTOKI
26 .\"         all rights reserved.
27 .\" Translated 2008-08-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
28 .\" 
29 .TH END 3 2008-07-17 "GNU" "Linux Programmer's Manual"
30 .\"O .SH NAME
31 .SH Ì¾Á°
32 .\"O etext, edata, end \- end of program segments
33 etext, edata, end \- ¥×¥í¥°¥é¥à¥»¥°¥á¥ó¥È¤Î½ª¤ï¤ê
34 .\"O .SH SYNOPSIS
35 .SH ½ñ¼°
36 .nf
37 .BI extern " etext" ;
38 .BI extern " edata" ;
39 .BI extern " end" ;
40 .fi
41 .\"O .SH DESCRIPTION
42 .SH ÀâÌÀ
43 .\"O The addresses of these symbols indicate the end of various program
44 .\"O segments:
45 ¤³¤ì¤é¤Î¥·¥ó¥Ü¥ë¤Î¥¢¥É¥ì¥¹¤Ï³Æ¼ï¤Î¥×¥í¥°¥é¥à¥»¥°¥á¥ó¥È¤Î½ª¤ï¤ê¤ò¼¨¤¹¡£
46 .TP
47 .I etext
48 .\"O This is the first address past the end of the text segment
49 .\"O (the program code).
50 ¥Æ¥­¥¹¥È¥»¥°¥á¥ó¥È (¥×¥í¥°¥é¥à¤Î¥³¡¼¥É) ¤ÎËöÈø¤Î¼¡¤Î¥¢¥É¥ì¥¹¡£
51 .TP
52 .I edata
53 .\"O This is the first address past the end of the
54 .\"O initialized data segment.
55 ½é´ü²½¤µ¤ì¤¿¥Ç¡¼¥¿¤Î¥»¥°¥á¥ó¥È¤ÎËöÈø¤Î¼¡¤Î¥¢¥É¥ì¥¹¡£
56 .TP
57 .I end
58 .\"O This is the first address past the end of the
59 .\"O uninitialized data segment (also known as the BSS segment).
60 ½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤¤¥Ç¡¼¥¿¤Î¥»¥°¥á¥ó¥È (BSS ¥»¥°¥á¥ó¥È¤È¤â¸À¤ï¤ì¤ë)
61 ¤ÎËöÈø¤Î¼¡¤Î¥¢¥É¥ì¥¹¡£
62 .\"O .SH CONFORMING TO
63 .SH ½àµò
64 .\"O Although these symbols have long been provided on most UNIX systems,
65 .\"O they are not standardized; use with caution.
66 ¤³¤ì¤é¤Î¥·¥ó¥Ü¥ë¤ÏĹǯ¤Û¤È¤ó¤É¤Î UNIX ¥·¥¹¥Æ¥à¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ë¤¬¡¢
67 ɸ½à²½¤µ¤ì¤Æ¤Ï¤¤¤Ê¤¤¡£Ãí°Õ¤·¤Æ»È¤¦¤³¤È¡£
68 .\"O .SH NOTES
69 .SH Ãí°Õ
70 .\"O The program must explicitly declare these symbols;
71 .\"O they are not defined in any header file.
72 ¥×¥í¥°¥é¥à¤Ç¤Ï¤³¤ì¤é¤Î¥·¥ó¥Ü¥ë¤ÏÌÀ¼¨Åª¤ËÀë¸À¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
73 ¤³¤ì¤é¤Ï¤É¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤Ç¤âÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
74
75 .\"O On some systems the names of these symbols are preceded by underscores,
76 .\"O thus:
77 .\"O .IR _etext ,
78 .\"O .IR _edata ,
79 .\"O and
80 .\"O .IR _end .
81 .\"O These symbols are also defined for programs compiled on Linux.
82 ¤¤¤¯¤Ä¤«¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢¤³¤ì¤é¤Î¥·¥ó¥Ü¥ë¤Î̾Á°¤ÏÁ°¤Ë¥¢¥ó¥À¡¼¥¹¥³¥¢¤¬
83 ÉÕ¤¤¤Æ¤¤¤Æ¡¢
84 .IR _etext ,
85 .IR _edata ,
86 .I _end
87 ¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
88 Linux ¤Ç¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¥×¥í¥°¥é¥à¤Ç¤Ï¡¢
89 ¤³¤ì¤é¤Î¥·¥ó¥Ü¥ë¤Ç¤âÄêµÁ¤µ¤ì¤ë¡£
90
91 .\"O At the start of program execution,
92 .\"O the program break will be somewhere near
93 .\"O .IR &end
94 .\"O (perhaps at the start of the following page).
95 .\"O However, the break will change as memory is allocated via
96 .\"O .BR brk (2)
97 .\"O or
98 .\"O .BR malloc (3).
99 .\"O Use
100 .\"O .BR sbrk (2)
101 .\"O with an argument of zero to find the current value of the program break.
102 ¥×¥í¥°¥é¥à¤Î¼Â¹Ô³«»Ï»þ¤Ë¡¢¥×¥í¥°¥é¥à¡¦¥Ö¥ì¡¼¥¯¤Ï
103 .I &end
104 ¤Î¶á¤¯¤Î¤É¤³¤« (¤ª¤½¤é¤¯¼¡¤Î¥Ú¡¼¥¸¤ÎÀèƬ) ¤Ë¤Ê¤ë¡£
105 ¤·¤«¤·¤Ê¤¬¤é¡¢
106 .BR brk (2)
107 ¤ä
108 .BR malloc (3)
109 ¤Ç¥á¥â¥ê¤¬³ä¤êÅö¤Æ¤é¤ì¤ë¤ËÏ¢¤ì¤Æ¡¢¥×¥í¥°¥é¥à¡¦¥Ö¥ì¡¼¥¯¤ÏÊѲ½¤·¤Æ¤¤¤¯¡£
110 °ú¤­¿ô¤Ë 0 ¤ò»ØÄꤷ¤Æ
111 .BR sbrk (2)
112 ¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ç¡¢¥×¥í¥°¥é¥à¡¦¥Ö¥ì¡¼¥¯¤Î¸½ºßÃͤòÃΤ뤳¤È¤¬¤Ç¤­¤ë¡£
113 .\"O .SH EXAMPLE
114 .SH Îã
115 .\"O When run, the program below produces output such as the following:
116 ²¼µ­¤Î¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤¹¤ë¤È¡¢¼¡¤Î¤è¤¦¤Ê½ÐÎϤ¬ÆÀ¤é¤ì¤ë¡£
117 .in +4n
118 .nf
119
120 .RB "$" " ./a.out"
121 First address past:
122     program text (etext)       0x8048568
123     initialized data (edata)   0x804a01c
124     uninitialized data (end)   0x804a024
125 .fi
126 .\"O .SS Program source
127 .SS ¥×¥í¥°¥é¥à¤Î¥½¡¼¥¹
128 \&
129 .in
130 .nf
131 #include <stdio.h>
132 #include <stdlib.h>
133
134 extern char etext, edata, end; /* The symbols must have some type,
135                                    or "gcc -Wall" complains */
136
137 int
138 main(int argc, char *argv[])
139 {
140     printf("First address past:\\n");
141     printf("    program text (etext)      %10p\\n", &etext);
142     printf("    initialized data (edata)  %10p\\n", &edata);
143     printf("    uninitialized data (end)  %10p\\n", &end);
144
145     exit(EXIT_SUCCESS);
146 }
147 .fi
148 .\"O .SH "SEE ALSO"
149 .SH ´ØÏ¢¹àÌÜ
150 .BR objdump (1),
151 .BR readelf (1),
152 .BR sbrk (2),
153 .BR elf (5)