Merge "Add test for empty symbol lookup"
diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md
index 5b0fe38..ec48870 100644
--- a/android-changes-for-ndk-developers.md
+++ b/android-changes-for-ndk-developers.md
@@ -321,3 +321,22 @@
*Resolution*: don't use tools that produce invalid/malformed
ELF files. Note that using them puts application under high risk of
being incompatible with future versions of Android.
+
+## Enable logging of dlopen/dlsym and library loading errors for apps (Available in Android O)
+
+Starting with Android O it is possible to enable logging of all dlsym/dlopen calls
+for debuggable apps. Here is short instruction on how to do that:
+```
+adb shell setprop debug.ld.app.com.example.myapp dlsym,dlopen,dlerror
+adb logcat
+```
+
+Any subset of (dlsym,dlopen,dlerror) can be used.
+
+On userdebug and eng builds it is possible to enable tracing for the whole system
+by using debug.ld.all system property instead of app-specific one:
+```
+adb shell setprop debug.ld.all dlerror,dlopen
+```
+
+enables logging of all errors and dlopen calls
diff --git a/libc/bionic/__stack_chk_fail.cpp b/libc/bionic/__stack_chk_fail.cpp
index 6e052e3..cb039cf 100644
--- a/libc/bionic/__stack_chk_fail.cpp
+++ b/libc/bionic/__stack_chk_fail.cpp
@@ -32,5 +32,5 @@
#include "private/libc_logging.h"
void __stack_chk_fail() {
- __libc_fatal("stack corruption detected");
+ __libc_fatal("stack corruption detected (-fstack-protector)");
}
diff --git a/linker/linker_logger.cpp b/linker/linker_logger.cpp
index a9d358a..8190cc9 100644
--- a/linker/linker_logger.cpp
+++ b/linker/linker_logger.cpp
@@ -45,6 +45,7 @@
static const char* kOptionErrors = "dlerror";
static const char* kOptionDlopen = "dlopen";
+static const char* kOptionDlsym = "dlsym";
static std::string property_get(const char* name) {
char value[PROP_VALUE_MAX] = {};
@@ -66,6 +67,8 @@
flags |= kLogErrors;
} else if (o == kOptionDlopen){
flags |= kLogDlopen;
+ } else if (o == kOptionDlsym){
+ flags |= kLogDlsym;
} else {
__libc_format_log(ANDROID_LOG_WARN, "linker", "Unknown debug.ld option \"%s\", will ignore.", o.c_str());
}