Merge "Make the __stack_chk_fail message more searchable on the internets."
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/include/sys/types.h b/libc/include/sys/types.h
index 8188f89..637ef02 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#ifndef _SYS_TYPES_H_
#define _SYS_TYPES_H_
@@ -105,20 +106,6 @@
typedef loff_t off64_t;
#endif
-/* while POSIX wants these in <sys/types.h>, we
- * declare then in <pthread.h> instead */
-#if 0
-typedef .... pthread_attr_t;
-typedef .... pthread_cond_t;
-typedef .... pthread_condattr_t;
-typedef .... pthread_key_t;
-typedef .... pthread_mutex_t;
-typedef .... pthread_once_t;
-typedef .... pthread_rwlock_t;
-typedef .... pthread_rwlock_attr_t;
-typedef .... pthread_t;
-#endif
-
#if !defined(__LP64__)
/* This historical accident means that we had a signed socklen_t on 32-bit architectures. */
typedef int32_t __socklen_t;
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());
}