This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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]

[Bug libc/214] sbrk() doesn't detect brk() failures. Malloc doesn't handle sbrk() failures


------- Additional Comments From rsa at us dot ibm dot com  2006-03-13 16:24 -------
Thanks to Alan Modra for the following explanation of how ld locates the data in
memory:

ld tries to optimize memory and disk usage for the executable.

Consider a small executable laid out like the following:

______________________
| text    |   data   |
~~~~~~~~~~~~~~~~~~~~~~
^               ^               ^
|- page boundaries

This will require two disk pages, and three memory pages,
one for text and two for data (demand paging requires that
vma and file offset are equal modulo page size, protection
requirements mean text and data must be on separate pages).


The same executable laid out like this:
____________________________
| text    | gap |   data   |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^               ^               ^
|- page boundaries

still requires two disk pages, but now only two memory pages.
Sometimes adjusting the data start as above doesn't gain us
anything in memory and increases disk image, so ld doesn't
adjust.

See ld info DATA_SEGMENT_ALIGN.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=214

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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