OSDN Git Service

linker: avoid mapping the whole library before load.
authorDavid 'Digit' Turner <digit@google.com>
Mon, 18 Jun 2012 16:13:49 +0000 (18:13 +0200)
committerDavid 'Digit' Turner <digit@google.com>
Mon, 25 Jun 2012 09:52:40 +0000 (11:52 +0200)
commit23363ed7503c25ef4024ce0d517f7415c096645d
tree2892f3246f211cf3c5a4d17ecec3194d00294bda
parenta6545f46784e67edd5dbcd2bb714c60549f9192d
linker: avoid mapping the whole library before load.

This patch changes the load_library() function in the
dynamic linker to avoid reserving a huge read-only
address-space range just to read the ELF header and
program header (which are typically very small and easily
fit in the first page).

Instead, we use the functions in linker_phdr.c to only
load the data that we need in a temporary mmap-allocated
page of memory, which we release when the function exits.

This avoids issues when loading very large libraries, or
simply debug versions that only need to load a tiny percentage
of their overall file content in RAM.

Change-Id: Id3a189fad2119a870a1b3d43dd81380c54ea6044
linker/linker.c