From: Dimitry Ivanov Date: Tue, 28 Mar 2017 18:08:58 +0000 (-0700) Subject: linker: log only real dlerrors X-Git-Tag: android-x86-8.1-r1~52^2^2~28 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e7cdb2953aa8846826082ee11d571e67a4c1246b;p=android-x86%2Fbionic.git linker: log only real dlerrors Currently linker reports all potential dlerrors for example if library was not found in 'this' namespace - it initializes linker error buffer with not found message but when consequent search in linked namespace succeeds this message is droped because dlopen was successful. This commit avoids logging false positive error messages when debug.ld.* set to dlerror. Test: manual Change-Id: I480694a1b1bbacd6bd1d8505cd2ee491710964cc (cherry picked from commit 11968b80af5be601b820f261e2e102e5b8ed48c4) --- diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp index 5ccd65612..96dd4777e 100644 --- a/linker/dlfcn.cpp +++ b/linker/dlfcn.cpp @@ -48,6 +48,7 @@ static char* __bionic_set_dlerror(char* new_value) { char* old_value = *dlerror_slot; *dlerror_slot = new_value; + LD_LOG(kLogErrors, "%s\n", new_value); return old_value; } diff --git a/linker/linker_globals.h b/linker/linker_globals.h index b6f8a041c..e4e3d972e 100644 --- a/linker/linker_globals.h +++ b/linker/linker_globals.h @@ -38,7 +38,6 @@ do { \ __libc_format_buffer(linker_get_error_buffer(), linker_get_error_buffer_size(), fmt, ##x); \ /* If LD_DEBUG is set high enough, log every dlerror(3) message. */ \ - LD_LOG(kLogErrors, "%s\n", linker_get_error_buffer()); \ } while (false) #define DL_WARN(fmt, x...) \