This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: mapping shared libraries at fixed address...
- From: Jakub Jelinek <jakub at redhat dot com>
- To: fahree at gmail dot com
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 18 Jan 2006 11:01:19 +0100
- Subject: Re: mapping shared libraries at fixed address...
- References: <653bea160601172121k791c4a9dx@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Jan 18, 2006 at 12:21:47AM -0500, Far? wrote:
> So as to be able to mmap BIG data files on i386, I would like to get
> the shared libraries out of the way. With no userspace specification,
> ld.so and libc.so are mmap()ed by the kernel at one third of the
> address space (starting at 0x55555000), which means that I can't mmap
> contiguously a file larger than 1.6GB approximately (less than I
> need), at opposed to a maximum of 2.9GB or so if I could get the
> libraries loaded near the bottom of the memory.
With the flexible mmap memory layout in 2.6.9 and later this shouldn't be
an issue.
> There are three problems:
> (1) ld.so itself is defined as a shared library with no load address
> specification, and the kernel loads it at TASK_UNMAPPED_BASE. I don't
> understand how I need to edit the ld script so that it would do
> otherwise -- my attempts so far get me segfaults and/or link errors.
If for whatever reason 2.6.9+ doesn't DTRT for you, you can:
1) use prelink and tell it where to mmap the libraries (with --exec-shield
option it will by default put libraries below binaries if possible)
2) if you don't want to have libraries prelinked, you can just use
prelink -r 0x12345000 /lib/ld-2.3.*.so that will just relocate
ld.so (and similarly for other libraries you need)
Jakub