Skip to content

Commit

Permalink
Fix samplecode compiler error with newer GCC.
Browse files Browse the repository at this point in the history
Introduce changes from upstream to fix multiple definition of
'_U_dyn_info_list'. Tested on Debian bullseye/sid and Ubuntu 18.04.

Upstream link: libunwind/libunwind@29e17d.
  • Loading branch information
yuguorui authored and longtomjr committed Mar 28, 2021
1 parent 13bbd49 commit 5424f5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion sgx_unwind/libunwind/include/libunwind_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions sgx_unwind/libunwind/src/x86_64/Ginit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}

Expand Down

0 comments on commit 5424f5b

Please sign in to comment.