1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2025-01-08 18:33:42 +01:00

Invert tdep_init() flag logic

Invert the flag that signals that tdep_init() was called, to move the
symbol from data to BSS.
This commit is contained in:
Tommi Rantala 2012-09-21 09:47:41 +03:00
parent c2d6f85a0a
commit 5d0f376b08
33 changed files with 58 additions and 61 deletions

View file

@ -227,7 +227,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#endif /* !UNW_LOCAL_ONLY */ #endif /* !UNW_LOCAL_ONLY */
#define tdep_getcontext_trace unw_getcontext #define tdep_getcontext_trace unw_getcontext
#define tdep_needs_initialization UNW_OBJ(needs_initialization) #define tdep_init_done UNW_OBJ(init_done)
#define tdep_init UNW_OBJ(init) #define tdep_init UNW_OBJ(init)
#define arm_find_proc_info UNW_OBJ(find_proc_info) #define arm_find_proc_info UNW_OBJ(find_proc_info)
#define arm_put_unwind_info UNW_OBJ(put_unwind_info) #define arm_put_unwind_info UNW_OBJ(put_unwind_info)
@ -264,7 +264,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) ((as)->big_endian) #define tdep_big_endian(as) ((as)->big_endian)
extern int tdep_needs_initialization; extern int tdep_init_done;
extern void tdep_init (void); extern void tdep_init (void);
extern int arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, extern int arm_find_proc_info (unw_addr_space_t as, unw_word_t ip,

View file

@ -224,7 +224,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#endif /* !UNW_LOCAL_ONLY */ #endif /* !UNW_LOCAL_ONLY */
#define tdep_getcontext_trace unw_getcontext #define tdep_getcontext_trace unw_getcontext
#define tdep_needs_initialization UNW_OBJ(needs_initialization) #define tdep_init_done UNW_OBJ(init_done)
#define tdep_init UNW_OBJ(init) #define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define /* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */ tdep_search_unwind_table. */
@ -259,7 +259,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 1 #define tdep_big_endian(as) 1
extern int tdep_needs_initialization; extern int tdep_init_done;
extern void tdep_init (void); extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,

View file

@ -186,7 +186,7 @@ struct ia64_global_unwind_state
{ {
pthread_mutex_t lock; /* global data lock */ pthread_mutex_t lock; /* global data lock */
volatile char needs_initialization; volatile char init_done;
/* Table of registers that prologues can save (and order in which /* Table of registers that prologues can save (and order in which
they're saved). */ they're saved). */
@ -217,7 +217,7 @@ struct ia64_global_unwind_state
}; };
#define tdep_getcontext_trace unw_getcontext #define tdep_getcontext_trace unw_getcontext
#define tdep_needs_initialization unw.needs_initialization #define tdep_init_done unw.init_done
#define tdep_init UNW_OBJ(init) #define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define /* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */ tdep_search_unwind_table. */

View file

@ -277,7 +277,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#endif /* !UNW_LOCAL_ONLY */ #endif /* !UNW_LOCAL_ONLY */
#define tdep_getcontext_trace unw_getcontext #define tdep_getcontext_trace unw_getcontext
#define tdep_needs_initialization UNW_OBJ(needs_initialization) #define tdep_init_done UNW_OBJ(init_done)
#define tdep_init UNW_OBJ(init) #define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define /* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */ tdep_search_unwind_table. */
@ -311,7 +311,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) #define tdep_get_as_arg(c) ((c)->dwarf.as_arg)
#define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_get_ip(c) ((c)->dwarf.ip)
extern int tdep_needs_initialization; extern int tdep_init_done;
extern void tdep_init (void); extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,

View file

@ -252,7 +252,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
} }
#define tdep_getcontext_trace unw_getcontext #define tdep_getcontext_trace unw_getcontext
#define tdep_needs_initialization UNW_OBJ(needs_initialization) #define tdep_init_done UNW_OBJ(init_done)
#define tdep_init UNW_OBJ(init) #define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define /* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */ tdep_search_unwind_table. */
@ -291,7 +291,7 @@ extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip,
#define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 1 #define tdep_big_endian(as) 1
extern int tdep_needs_initialization; extern int tdep_init_done;
extern void tdep_init (void); extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,

View file

@ -252,7 +252,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
} }
#define tdep_getcontext_trace unw_getcontext #define tdep_getcontext_trace unw_getcontext
#define tdep_needs_initialization UNW_OBJ(needs_initialization) #define tdep_init_done UNW_OBJ(init_done)
#define tdep_init UNW_OBJ(init) #define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define /* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */ tdep_search_unwind_table. */
@ -291,7 +291,7 @@ extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip,
#define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 1 #define tdep_big_endian(as) 1
extern int tdep_needs_initialization; extern int tdep_init_done;
extern void tdep_init (void); extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,

View file

@ -238,7 +238,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#endif /* !UNW_LOCAL_ONLY */ #endif /* !UNW_LOCAL_ONLY */
#define tdep_getcontext_trace unw_getcontext #define tdep_getcontext_trace unw_getcontext
#define tdep_needs_initialization UNW_OBJ(needs_initialization) #define tdep_init_done UNW_OBJ(init_done)
#define tdep_init UNW_OBJ(init) #define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define /* Platforms that support UNW_INFO_FORMAT_TABLE need to define
tdep_search_unwind_table. */ tdep_search_unwind_table. */
@ -273,7 +273,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 0 #define tdep_big_endian(as) 0
extern int tdep_needs_initialization; extern int tdep_init_done;
extern void tdep_init (void); extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,

View file

@ -178,7 +178,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
} }
#define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace) #define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace)
#define tdep_needs_initialization UNW_OBJ(needs_initialization) #define tdep_init_done UNW_OBJ(init_done)
#define tdep_init_mem_validate UNW_OBJ(init_mem_validate) #define tdep_init_mem_validate UNW_OBJ(init_mem_validate)
#define tdep_init UNW_OBJ(init) #define tdep_init UNW_OBJ(init)
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define /* Platforms that support UNW_INFO_FORMAT_TABLE need to define
@ -220,7 +220,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_get_ip(c) ((c)->dwarf.ip) #define tdep_get_ip(c) ((c)->dwarf.ip)
#define tdep_big_endian(as) 0 #define tdep_big_endian(as) 0
extern int tdep_needs_initialization; extern int tdep_init_done;
extern void tdep_init (void); extern void tdep_init (void);
extern void tdep_init_mem_validate (void); extern void tdep_init_mem_validate (void);

View file

@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h" #include "dwarf_i.h"
HIDDEN pthread_mutex_t arm_lock = PTHREAD_MUTEX_INITIALIZER; HIDDEN pthread_mutex_t arm_lock = PTHREAD_MUTEX_INITIALIZER;
HIDDEN int tdep_needs_initialization = 1; HIDDEN int tdep_init_done;
/* Unwinding methods to use. See UNW_METHOD_ enums */ /* Unwinding methods to use. See UNW_METHOD_ enums */
HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_ALL; HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_ALL;
@ -40,7 +40,7 @@ tdep_init (void)
lock_acquire (&arm_lock, saved_mask); lock_acquire (&arm_lock, saved_mask);
{ {
if (!tdep_needs_initialization) if (tdep_init_done)
/* another thread else beat us to it... */ /* another thread else beat us to it... */
goto out; goto out;
@ -58,7 +58,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY #ifndef UNW_REMOTE_ONLY
arm_local_addr_space_init (); arm_local_addr_space_init ();
#endif #endif
tdep_needs_initialization = 0; /* signal that we're initialized... */ tdep_init_done = 1; /* signal that we're initialized... */
} }
out: out:
lock_release (&arm_lock, saved_mask); lock_release (&arm_lock, saved_mask);

View file

@ -41,7 +41,7 @@ unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
{ {
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -33,7 +33,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */ #else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "unwind_i.h" #include "unwind_i.h"
HIDDEN pthread_mutex_t hppa_lock = PTHREAD_MUTEX_INITIALIZER; HIDDEN pthread_mutex_t hppa_lock = PTHREAD_MUTEX_INITIALIZER;
HIDDEN int tdep_needs_initialization = 1; HIDDEN int tdep_init_done;
HIDDEN void HIDDEN void
tdep_init (void) tdep_init (void)
@ -37,7 +37,7 @@ tdep_init (void)
lock_acquire (&hppa_lock, saved_mask); lock_acquire (&hppa_lock, saved_mask);
{ {
if (!tdep_needs_initialization) if (tdep_init_done)
/* another thread else beat us to it... */ /* another thread else beat us to it... */
goto out; goto out;
@ -48,7 +48,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY #ifndef UNW_REMOTE_ONLY
hppa_local_addr_space_init (); hppa_local_addr_space_init ();
#endif #endif
tdep_needs_initialization = 0; /* signal that we're initialized... */ tdep_init_done = 1; /* signal that we're initialized... */
} }
out: out:
lock_release (&hppa_lock, saved_mask); lock_release (&hppa_lock, saved_mask);

View file

@ -41,7 +41,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
{ {
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -34,7 +34,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */ #else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -28,10 +28,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
PROTECTED unw_accessors_t * PROTECTED unw_accessors_t *
unw_get_accessors (unw_addr_space_t as) unw_get_accessors (unw_addr_space_t as)
{ {
if (hppa_needs_initialization) if (!tdep_init_done)
{ tdep_init ();
hppa_needs_initialization = 0;
hppa_init ();
}
return &as->acc; return &as->acc;
} }

View file

@ -29,7 +29,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
HIDDEN struct ia64_global_unwind_state unw = HIDDEN struct ia64_global_unwind_state unw =
{ {
.needs_initialization = 1,
.lock = PTHREAD_MUTEX_INITIALIZER, .lock = PTHREAD_MUTEX_INITIALIZER,
.save_order = { .save_order = {
IA64_REG_IP, IA64_REG_PFS, IA64_REG_PSP, IA64_REG_PR, IA64_REG_IP, IA64_REG_PFS, IA64_REG_PSP, IA64_REG_PR,
@ -73,7 +72,7 @@ tdep_init (void)
lock_acquire (&unw.lock, saved_mask); lock_acquire (&unw.lock, saved_mask);
{ {
if (!tdep_needs_initialization) if (tdep_init_done)
/* another thread else beat us to it... */ /* another thread else beat us to it... */
goto out; goto out;
@ -116,7 +115,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY #ifndef UNW_REMOTE_ONLY
ia64_local_addr_space_init (); ia64_local_addr_space_init ();
#endif #endif
tdep_needs_initialization = 0; /* signal that we're initialized... */ tdep_init_done = 1; /* signal that we're initialized... */
} }
out: out:
lock_release (&unw.lock, saved_mask); lock_release (&unw.lock, saved_mask);

View file

@ -83,7 +83,7 @@ unw_init_local (unw_cursor_t *cursor, unw_context_t *uc)
unw_word_t sp, bsp; unw_word_t sp, bsp;
int ret; int ret;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -36,7 +36,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
unw_word_t sp, bsp; unw_word_t sp, bsp;
int ret; int ret;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
PROTECTED unw_accessors_t * PROTECTED unw_accessors_t *
unw_get_accessors (unw_addr_space_t as) unw_get_accessors (unw_addr_space_t as)
{ {
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
return &as->acc; return &as->acc;
} }

View file

@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
PROTECTED int PROTECTED int
unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy) unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy)
{ {
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
#ifndef HAVE___THREAD #ifndef HAVE___THREAD

View file

@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h" #include "dwarf_i.h"
HIDDEN pthread_mutex_t mips_lock = PTHREAD_MUTEX_INITIALIZER; HIDDEN pthread_mutex_t mips_lock = PTHREAD_MUTEX_INITIALIZER;
HIDDEN int tdep_needs_initialization = 1; HIDDEN int tdep_init_done;
HIDDEN void HIDDEN void
tdep_init (void) tdep_init (void)
@ -37,7 +37,7 @@ tdep_init (void)
lock_acquire (&mips_lock, saved_mask); lock_acquire (&mips_lock, saved_mask);
{ {
if (!tdep_needs_initialization) if (tdep_init_done)
/* another thread else beat us to it... */ /* another thread else beat us to it... */
goto out; goto out;
@ -48,7 +48,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY #ifndef UNW_REMOTE_ONLY
mips_local_addr_space_init (); mips_local_addr_space_init ();
#endif #endif
tdep_needs_initialization = 0; /* signal that we're initialized... */ tdep_init_done = 1; /* signal that we're initialized... */
} }
out: out:
lock_release (&mips_lock, saved_mask); lock_release (&mips_lock, saved_mask);

View file

@ -40,7 +40,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
{ {
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -33,7 +33,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */ #else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -48,7 +48,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
{ {
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -41,7 +41,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */ #else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h" #include "dwarf_i.h"
HIDDEN pthread_mutex_t ppc32_lock = PTHREAD_MUTEX_INITIALIZER; HIDDEN pthread_mutex_t ppc32_lock = PTHREAD_MUTEX_INITIALIZER;
HIDDEN int tdep_needs_initialization = 1; HIDDEN int tdep_init_done;
/* The API register numbers are exactly the same as the .eh_frame /* The API register numbers are exactly the same as the .eh_frame
registers, for now at least. */ registers, for now at least. */
@ -117,7 +117,7 @@ tdep_init (void)
lock_acquire (&ppc32_lock, saved_mask); lock_acquire (&ppc32_lock, saved_mask);
{ {
if (!tdep_needs_initialization) if (tdep_init_done)
/* another thread else beat us to it... */ /* another thread else beat us to it... */
goto out; goto out;
@ -128,7 +128,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY #ifndef UNW_REMOTE_ONLY
ppc32_local_addr_space_init (); ppc32_local_addr_space_init ();
#endif #endif
tdep_needs_initialization = 0; /* signal that we're initialized... */ tdep_init_done = 1; /* signal that we're initialized... */
} }
out: out:
lock_release (&ppc32_lock, saved_mask); lock_release (&ppc32_lock, saved_mask);

View file

@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h" #include "dwarf_i.h"
HIDDEN pthread_mutex_t ppc64_lock = PTHREAD_MUTEX_INITIALIZER; HIDDEN pthread_mutex_t ppc64_lock = PTHREAD_MUTEX_INITIALIZER;
HIDDEN int tdep_needs_initialization = 1; HIDDEN int tdep_init_done;
/* The API register numbers are exactly the same as the .eh_frame /* The API register numbers are exactly the same as the .eh_frame
registers, for now at least. */ registers, for now at least. */
@ -164,7 +164,7 @@ tdep_init (void)
lock_acquire (&ppc64_lock, saved_mask); lock_acquire (&ppc64_lock, saved_mask);
{ {
if (!tdep_needs_initialization) if (tdep_init_done)
/* another thread else beat us to it... */ /* another thread else beat us to it... */
goto out; goto out;
@ -175,7 +175,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY #ifndef UNW_REMOTE_ONLY
ppc64_local_addr_space_init (); ppc64_local_addr_space_init ();
#endif #endif
tdep_needs_initialization = 0; /* signal that we're initialized... */ tdep_init_done = 1; /* signal that we're initialized... */
} }
out: out:
lock_release (&ppc64_lock, saved_mask); lock_release (&ppc64_lock, saved_mask);

View file

@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h" #include "dwarf_i.h"
HIDDEN pthread_mutex_t x86_lock = PTHREAD_MUTEX_INITIALIZER; HIDDEN pthread_mutex_t x86_lock = PTHREAD_MUTEX_INITIALIZER;
HIDDEN int tdep_needs_initialization = 1; HIDDEN int tdep_init_done;
/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */ /* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */
@ -49,7 +49,7 @@ tdep_init (void)
lock_acquire (&x86_lock, saved_mask); lock_acquire (&x86_lock, saved_mask);
{ {
if (!tdep_needs_initialization) if (tdep_init_done)
/* another thread else beat us to it... */ /* another thread else beat us to it... */
goto out; goto out;
@ -60,7 +60,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY #ifndef UNW_REMOTE_ONLY
x86_local_addr_space_init (); x86_local_addr_space_init ();
#endif #endif
tdep_needs_initialization = 0; /* signal that we're initialized... */ tdep_init_done = 1; /* signal that we're initialized... */
} }
out: out:
lock_release (&x86_lock, saved_mask); lock_release (&x86_lock, saved_mask);

View file

@ -41,7 +41,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
{ {
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -34,7 +34,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */ #else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -30,7 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h" #include "dwarf_i.h"
HIDDEN pthread_mutex_t x86_64_lock = PTHREAD_MUTEX_INITIALIZER; HIDDEN pthread_mutex_t x86_64_lock = PTHREAD_MUTEX_INITIALIZER;
HIDDEN int tdep_needs_initialization = 1; HIDDEN int tdep_init_done;
/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */ /* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */
@ -82,7 +82,7 @@ tdep_init (void)
lock_acquire (&x86_64_lock, saved_mask); lock_acquire (&x86_64_lock, saved_mask);
{ {
if (!tdep_needs_initialization) if (tdep_init_done)
/* another thread else beat us to it... */ /* another thread else beat us to it... */
goto out; goto out;
@ -95,7 +95,7 @@ tdep_init (void)
#ifndef UNW_REMOTE_ONLY #ifndef UNW_REMOTE_ONLY
x86_64_local_addr_space_init (); x86_64_local_addr_space_init ();
#endif #endif
tdep_needs_initialization = 0; /* signal that we're initialized... */ tdep_init_done = 1; /* signal that we're initialized... */
} }
out: out:
lock_release (&x86_64_lock, saved_mask); lock_release (&x86_64_lock, saved_mask);

View file

@ -43,7 +43,7 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
{ {
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (unlikely (tdep_needs_initialization)) if (unlikely (!tdep_init_done))
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);

View file

@ -36,7 +36,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
#else /* !UNW_LOCAL_ONLY */ #else /* !UNW_LOCAL_ONLY */
struct cursor *c = (struct cursor *) cursor; struct cursor *c = (struct cursor *) cursor;
if (tdep_needs_initialization) if (!tdep_init_done)
tdep_init (); tdep_init ();
Debug (1, "(cursor=%p)\n", c); Debug (1, "(cursor=%p)\n", c);