.\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk .\" .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2008 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2008-08-21, Akihiro MOTOKI , LDP v3.05 .\" .TH END 3 2020\-06\-09 GNU "Linux Programmer's Manual" .SH 名前 etext, edata, end \- プログラムセグメントの終わり .SH 書式 .nf \fBextern\fP\fI etext\fP\fB;\fP \fBextern\fP\fI edata\fP\fB;\fP \fBextern\fP\fI end\fP\fB;\fP .fi .SH 説明 これらのシンボルのアドレスは各種のプログラムセグメントの終わりを示す。 .TP \fIetext\fP テキストセグメント (プログラムのコード) の末尾の次のアドレス。 .TP \fIedata\fP 初期化されたデータのセグメントの末尾の次のアドレス。 .TP \fIend\fP 初期化されていないデータのセグメント (BSS セグメントとも言われる) の末尾の次のアドレス。 .SH 準拠 これらのシンボルは長年ほとんどの UNIX システムで提供されているが、 標準化されてはいない。注意して使うこと。 .SH 注意 プログラムではこれらのシンボルは明示的に宣言しなければならない。 これらはどのヘッダーファイルでも定義されていない。 .PP いくつかのシステムでは、これらのシンボルの名前は前にアンダースコアが 付いていて、 \fI_etext\fP, \fI_edata\fP, \fI_end\fP となっている。 Linux でコンパイルされたプログラムでは、 これらのシンボルでも定義される。 .PP プログラムの実行開始時に、プログラムブレークは \fI&end\fP の近くのどこか (おそらく次のページの先頭) になる。 しかしながら、 \fBbrk\fP(2) や \fBmalloc\fP(3) でメモリーが割り当てられるに連れて、プログラムブレークは変化していく。 引数に 0 を指定して \fBsbrk\fP(2) を呼び出すことで、プログラムブレークの現在値を知ることができる。 .SH 例 下記のプログラムを実行すると、次のような出力が得られる。 .PP .in +4n .EX $\fB ./a.out\fP First address past: program text (etext) 0x8048568 initialized data (edata) 0x804a01c uninitialized data (end) 0x804a024 .EE .in .SS プログラムのソース \& .EX #include #include extern char etext, edata, end; /* The symbols must have some type, or "gcc \-Wall" complains */ int main(int argc, char *argv[]) { printf("First address past:\en"); printf(" program text (etext) %10p\en", &etext); printf(" initialized data (edata) %10p\en", &edata); printf(" uninitialized data (end) %10p\en", &end); exit(EXIT_SUCCESS); } .EE .SH 関連項目 \fBobjdump\fP(1), \fBreadelf\fP(1), \fBsbrk\fP(2), \fBelf\fP(5) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。