This is the mail archive of the libc-alpha@sources.redhat.com 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]

Re: usage and breakage of dl-sbrk and dl-brk


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   `------------------------

Attachment: signature.asc
Description: This is a digitally signed message part


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