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

dingyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git


The following commit(s) were added to refs/heads/master by this push:
     new a37ffb9  Fix samplecode compiler error with newer GCC.
     new 4826a26  Merge pull request #329 from yuguorui/master
a37ffb9 is described below

commit a37ffb9449ba6d5b6e4a9d586bbab864ae732269
Author: yuguorui <[email protected]>
AuthorDate: Tue Mar 23 22:40:36 2021 +0800

    Fix samplecode compiler error with newer GCC.
    
    Introduce changes from upstream to fix multiple definition of
    '_U_dyn_info_list'. Tested on Debian bullseye/sid and Ubuntu 18.04.
    
    Upstream link: https://github.com/libunwind/libunwind/commit/29e17d.
---
 sgx_unwind/libunwind/include/libunwind_i.h |  1 -
 sgx_unwind/libunwind/src/x86_64/Ginit.c    | 15 +++++++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/sgx_unwind/libunwind/include/libunwind_i.h 
b/sgx_unwind/libunwind/include/libunwind_i.h
index 5977fc8..3b4e7d8 100644
--- a/sgx_unwind/libunwind/include/libunwind_i.h
+++ b/sgx_unwind/libunwind/include/libunwind_i.h
@@ -272,7 +272,6 @@ extern void unwi_dyn_remote_put_unwind_info 
(unw_addr_space_t as,
         void *arg);
 extern int unwi_dyn_validate_cache (unw_addr_space_t as, void *arg);
 
-extern unw_dyn_info_list_t _U_dyn_info_list;
 extern pthread_mutex_t _U_dyn_info_list_lock;
 
 #if UNW_DEBUG && !HAVE_SGX
diff --git a/sgx_unwind/libunwind/src/x86_64/Ginit.c 
b/sgx_unwind/libunwind/src/x86_64/Ginit.c
index 3eebe01..47b14a8 100644
--- a/sgx_unwind/libunwind/src/x86_64/Ginit.c
+++ b/sgx_unwind/libunwind/src/x86_64/Ginit.c
@@ -47,13 +47,6 @@ static struct unw_addr_space local_addr_space;
 
 PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space;
 
-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
-
-/* XXX fix me: there is currently no way to locate the dyn-info list
-       by a remote unwinder.  On ia64, this is done via a special
-       unwind-table entry.  Perhaps something similar can be done with
-       DWARF2 unwind info.  */
-
 static void
 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
 {
@@ -64,7 +57,13 @@ static int
 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
                         void *arg)
 {
-    *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+#ifndef UNW_LOCAL_ONLY
+# pragma weak _U_dyn_info_list_addr
+    if (!_U_dyn_info_list_addr)
+        return -UNW_ENOINFO;
+#endif
+    // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. 
libunwind.so.
+    *dyn_info_list_addr = _U_dyn_info_list_addr ();
     return 0;
 }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to