This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: a question about pageable a.out


jemarch at gnu dot org writes:

> I read in the Linker Book, about the ZMAGIC (pageable a.out) format:
> 
> "On systems with 4K pages, the a.out header is expanded to 4K, and the
> text segment's size is rounded up to the next 4K boundar. There's no
> need to round up the size of the data segment, since the BSS segment
> logically follows the data segment, and is zeroed by the program
> loader anyway."
> 
> I dont understand the last phrase. Why there is no need to align the
> data segment? It is because it is aligned at load-time, taking care
> the BSS size?

Hmmm.  It doesn't say that there is no need to align the data segment
(to me, those words imply ensuring that the data segment starts on an
aligned boundary).  It says that there is no need to round up the size
of the data segment.

The reason to round up the size of the text segment is so that the
data segment, which in a.out immediately follows the text segment,
starts on a page boundary.  This permits the data segment and the text
segment to be paged differently, permitting the text segment to
read-only, and, in some cases, to be shared between processes.

There is no need to round up the size of the data segment because it
is not important for the BSS segment and the data segment to be paged
differently.  The BSS segment is simply allocated and zeroed out by
the loader.

Note that the a.out object file format is totally obsolete.  In ELF,
unlike a.out, the data segment has an explicit load address, so none
of this alignment folderol is required.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]