Index: third_party/crazy_linker/crazy_linker/README.TXT |
diff --git a/third_party/crazy_linker/crazy_linker/README.TXT b/third_party/crazy_linker/crazy_linker/README.TXT |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1ef51407e011c9f0b7fcd263409570b19a392fbe |
--- /dev/null |
+++ b/third_party/crazy_linker/crazy_linker/README.TXT |
@@ -0,0 +1,54 @@ |
+A custom dynamic linker for Android programs that adds a few interesting |
+features compared to /system/bin/linker: |
+ |
+ - Supports loading a library at an explicit (page-aligned) memory |
+ address. The system linker always randomizes the address. |
+ |
+ - Supports loading a library from an explicit (page-aligned) file |
+ offset. This can be useful to load a library directly from an .apk, |
+ provided that it is uncompressed and at a page-aligned offset. |
+ |
+ - Support changing the library search path. The system linker, when used |
+ inside Android applications, is limited to the value of LD_LIBRARY_PATH |
+ at boot time, that only looks into system directories, not application |
+ ones. |
+ |
+ This linker allows the client to add application paths before the |
+ default system ones, this has two benefits: |
+ |
+ - Library dependencies are loaded automatically in the right order. |
+ |
+ - Libraries from the application paths are favored over system ones. |
+ This avoids conflicts when one of your application's libraries |
+ has the same name than a system one (which happends randomly |
+ on certain devices due to system application bundling). |
+ |
+ - Support any number of shared libraries. On older Android platforms, |
+ the system linker will refuse to load more than 64 or 128 libraries |
+ in a single process (Note: Fixed in Android 4.3). |
+ |
+ - Support sharing of RELRO sections. When two processes load the same |
+ library at exactly the same address, the content of its RELRO section |
+ is identical. By default, each instance uses private RAM pages to host |
+ it, but it is possible to use a single ashmem region to share the same |
+ data instead. |
+ |
+See include/crazy_linker.h for the API and its documentation. |
+ |
+A few notes: |
+ |
+ - The crazy linker will always use the system linker to load NDK-exposed |
+ system libraries (e.g. liblog.so and others). This avoids having two |
+ instances of the same library in the same process, and correctly |
+ resolving any symbols from system libraries. |
+ |
+ - Any library loaded by the crazy linker, and which uses functions of |
+ libdl.so will continue to work. However, calls to dlopen(), dlsym(), |
+ et al will be redirected to the crazy linker's own wrappers. |
+ |
+ This ensures that if a library is loaded by the crazy linker, any of |
+ its dependencies will be loaded by it too. |
+ |
+BUGS & TODO: |
+ - Libraries loaded by the crazy linker are not automatically closed when |
+ the process exits. |