linker: allow using reserved space for multiple libraries.
Introduce a new flag ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE which
instructs the linker to use the reserved address space to load all of
the newly-loaded libraries required by a dlopen() call instead of only
the main library. They will be loaded consecutively into that region if
they fit. The RELRO sections of all the loaded libraries will also be
considered for reading/writing shared RELRO data.
This will allow the WebView implementation to potentially consist of
more than one .so file while still benefiting from the RELRO sharing
optimisation, which would otherwise only apply to the "root" .so file.
Test: bionic-unit-tests (existing and newly added)
Bug: 110790153
Change-Id: I61da775c29fd5017d9a1e2b6b3757c3d20a355b3
diff --git a/linker/linker.h b/linker/linker.h
index 964c266..4c89ceb 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -188,3 +188,9 @@
void decrement_dso_handle_reference_counter(void* dso_handle);
void purge_unused_memory();
+
+struct address_space_params {
+ void* start_addr = nullptr;
+ size_t reserved_size = 0;
+ bool must_use_address = false;
+};