usage and breakage of dl-sbrk and dl-brk
Ulrich Drepper
drepper@redhat.com
Wed May 15 22:45:00 GMT 2002
On Sat, 2002-05-11 at 14:14, Roland McGrath wrote:
> I don't really see why those special brk and sbrk
> are linked into ld.so at all. Their only purpose seems to be that __curbrk
> not be exported from ld.so when the normal files get linked in.
That's correct.
> But the
> only reason brk/sbrk get linked in at all is because of frob_brk in
> sysdeps/unix/sysv/linux/dl-sysdep.c.
You miss the rest of dl-sysdep. There is a call to sbrk() which is
needed to deal with the case if ld.so is the program. The sbrk()
implementation uses brk() and so we end up with both, brk() and sbrk(),
in ld.so. The Hurd code is different and may not need sbrk.
> Since the malloc in dl-minimal.c only uses
> mmap and never brk/sbrk, ld.so never uses the break at all.
You miss the case where the brk address is used by the normal brk of the
application.
> So, if there is any purpose to dl-brk/dl-sbrk at all, it's only because of
> unix/sysv/linux/dl-sysdep.c and so those files ought to be linux-specific
> rather than generic.
Well, we can do that. No big problem.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20020515/9e75bfd4/attachment.sig>
More information about the Libc-alpha
mailing list