OSDN Git Service

A special linker for ASan executables.
authorEvgenii Stepanov <eugenis@google.com>
Sat, 11 Jul 2015 00:54:01 +0000 (17:54 -0700)
committerEvgenii Stepanov <eugenis@google.com>
Tue, 14 Jul 2015 23:12:27 +0000 (16:12 -0700)
commitd640b225ecdd6d2fb74076e9b80ce8afb42e31a0
tree3c84d89a588a465e7ba3b6f0fcb7ac5be8700861
parent60a11dcb44992f610e696fc246c70731012080dd
A special linker for ASan executables.

Setup a /system/bin/linker_asan as a symlink to "linker".
Read the linker name from PT_INTERP, and if it is linker_asan,
switch default library lookup paths to the ASan set, which
starts with the path to the instrumented libraries
(/data/lib), followed by /system/lib as a fallback.

This ensures that ASan binaries prefer ASan libraries, when
available. This approach is way better then RPATH/RUNPATH and even
better than LD_LIBRARY_PATH:
- RUNPATH is per-DSO, while default paths are global.
- LD_LIBRARY_PATH is overwritten by android_update_LD_LIBRARY_PATH.
- neither RUNPATH nor LD_LIBRARY_PATH appear in
  android_get_LD_LIBRARY_PATH which is used to build java.lang.path.
  Having ASan libraries in java.lang.path is a good thing.

Bug: 22355945
Change-Id: I1d2791fbf5740618f18f71a3ae3d873714669d3f
linker/Android.mk
linker/linker.cpp
linker/linker_phdr.cpp
linker/linker_phdr.h