freebsd-dev/libexec/rtld-elf
Alan Cox ea8577c712 Before calling mmap() on a shared library's text and data sections, rtld
first calls mmap() with the arguments PROT_NONE and MAP_ANON to reserve a
single, contiguous range of virtual addresses for the entire shared library.
Later, rtld calls mmap() with the the shared library's file descriptor
and the argument MAP_FIXED to place the text and data sections within the
reserved range.  The rationale for mapping shared libraries in this way is
explained in the commit message for Revision 190885.  However, this approach
does have an unintended, negative consequence.  Since the first call to
mmap() specifies MAP_ANON and not the shared library's file descriptor, the
kernel has no idea what alignment the vm object backing the file prefers.
As a result, the reserved range's alignment is unlikely to be the same as
the vm object's, and so mapping with superpages becomes impossible.  To
address this problem, this revision adds the argument MAP_ALIGNED_SUPER to
the first call to mmap() if the text section is larger than the smallest
superpage size.

To determine if the text section is larger than the smallest superpage
size, rtld must always fetch the page size information.  As a result, the
private code for fetching the base page size in rtld's builtin malloc is
redundant.  Eliminate it.  Requested by: kib

Tested by:	zbb (on arm)
Reviewed by:	kib (an earlier version)
Discussed with:	jhb
2014-04-11 16:55:25 +00:00
..
amd64 Add GNU hash support for rtld. 2012-04-30 13:31:10 +00:00
arm Merging of projects/armv6, part 2 2012-08-15 03:07:41 +00:00
i386 Add GNU hash support for rtld. 2012-04-30 13:31:10 +00:00
ia64 Add GNU hash support for rtld. 2012-04-30 13:31:10 +00:00
mips Before jumping to application's entry point set ra == pc in order 2012-03-23 17:54:06 +00:00
powerpc Revert r253748,253749 2013-07-28 18:44:17 +00:00
powerpc64 Revert r253748,253749 2013-07-28 18:44:17 +00:00
sparc64 Add GNU hash support for rtld. 2012-04-30 13:31:10 +00:00
debug.c Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00
debug.h Use C99's varadic macro syntax instead of gcc's. 2006-03-28 18:26:47 +00:00
libmap.c Make the directory mapping functionality, which was previously only 2013-09-21 21:03:52 +00:00
libmap.h Make the directory mapping functionality, which was previously only 2013-09-21 21:03:52 +00:00
Makefile Replace LIBGCC by LIBCOMPILER_RT. 2014-01-18 14:22:56 +00:00
malloc.c Before calling mmap() on a shared library's text and data sections, rtld 2014-04-11 16:55:25 +00:00
map_object.c Before calling mmap() on a shared library's text and data sections, rtld 2014-04-11 16:55:25 +00:00
rtld_lock.c Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00
rtld_lock.h Implement support for ELF filters in rtld. Both normal and auxillary 2010-12-25 08:51:20 +00:00
rtld_printf.c Remove the use of toupper() from rtld_printf.c. Use of the libc function 2012-03-09 16:21:40 +00:00
rtld_printf.h Rtld links with the specially built pic static libc library to get some 2011-08-24 20:05:13 +00:00
rtld_tls.h
rtld.1 Import the DragonFly BSD commit 4f0bc915b65fcf5a23214f6d221d65c80be68ad4 2012-07-15 10:53:48 +00:00
rtld.c Before calling mmap() on a shared library's text and data sections, rtld 2014-04-11 16:55:25 +00:00
rtld.h Before calling mmap() on a shared library's text and data sections, rtld 2014-04-11 16:55:25 +00:00
Symbol.map Implement fdlopen(3), an rtld interface to load shared object by file 2012-01-07 10:33:01 +00:00
xmalloc.c Increase alignment to size of pointer if the alignment is too small. 2014-02-22 11:06:48 +00:00