You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ww...@apache.org on 2023/01/09 08:23:09 UTC

[incubator-brpc] branch master updated: Rollback #2049 chang (#2076)

This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 509b6feb Rollback #2049 chang (#2076)
509b6feb is described below

commit 509b6feb0e0fbaee0ff0d91a83232e9b8d11a465
Author: co0l1ce <77...@users.noreply.github.com>
AuthorDate: Mon Jan 9 16:23:00 2023 +0800

    Rollback #2049 chang (#2076)
    
    * fix rpc maybe error: " libbrpc.so: undefined symbol: pthread_mutex_lock "
    
    * fix rpc maybe error: " libbrpc.so: undefined symbol: pthread_mutex_lock "
    
    * rollback #2049
    
    Co-authored-by: root <ya...@baidu.com>
---
 src/bthread/mutex.cpp | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/src/bthread/mutex.cpp b/src/bthread/mutex.cpp
index 4dc6598d..639da259 100644
--- a/src/bthread/mutex.cpp
+++ b/src/bthread/mutex.cpp
@@ -405,26 +405,13 @@ static pthread_once_t init_sys_mutex_lock_once = PTHREAD_ONCE_INIT;
 // Call _dl_sym which is a private function in glibc to workaround the malloc
 // causing deadlock temporarily. This fix is hardly portable.
 
-/* refer dlsym implement
- * https://codebrowser.dev/glibc/glibc/dlfcn/dlsym.c.html#78
- * void *
- * ___dlsym (void *handle, const char *name)
- * {
- *   return __dlsym (handle, name, RETURN_ADDRESS (0));
- *   }
- *
- */
-
-#define RETURN_ADDRESS(nr) \
-    __builtin_extract_return_addr (__builtin_return_address (nr) )
-
 static void init_sys_mutex_lock() {
 #if defined(OS_LINUX)
     // TODO: may need dlvsym when GLIBC has multiple versions of a same symbol.
     // http://blog.fesnel.com/blog/2009/08/25/preloading-with-multiple-symbol-versions
     if (_dl_sym) {
-        sys_pthread_mutex_lock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_lock", RETURN_ADDRESS (0));
-        sys_pthread_mutex_unlock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_unlock", RETURN_ADDRESS (0));
+        sys_pthread_mutex_lock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_lock", (void*)init_sys_mutex_lock);
+        sys_pthread_mutex_unlock = (MutexOp)_dl_sym(RTLD_NEXT, "pthread_mutex_unlock", (void*)init_sys_mutex_lock);
     } else {
         // _dl_sym may be undefined reference in some system, fallback to dlsym
         sys_pthread_mutex_lock = (MutexOp)dlsym(RTLD_NEXT, "pthread_mutex_lock");


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org