Avoid depending on destructor order
In some scenarios (e.g., when mixing gcc and clang code), it can happen that frames are deregistered after the lookup structure has already been destroyed. That in itself would be fine, but it triggers an assert in __deregister_frame_info_bases that expects to find the frame. To avoid that, we now remember that the btree as already been destroyed and disable the assert in that case. libgcc/ChangeLog: * unwind-dw2-fde.c: (release_register_frames) Remember when the btree has been destroyed. (__deregister_frame_info_bases) Disable the assert when shutting down.
This commit is contained in:
parent
32524808fa
commit
94ccaf62c3
1 changed files with 3 additions and 1 deletions
|
@ -48,6 +48,7 @@ typedef __UINTPTR_TYPE__ uintptr_type;
|
|||
#include "unwind-dw2-btree.h"
|
||||
|
||||
static struct btree registered_frames;
|
||||
static bool in_shutdown;
|
||||
|
||||
static void
|
||||
release_registered_frames (void) __attribute__ ((destructor (110)));
|
||||
|
@ -57,6 +58,7 @@ release_registered_frames (void)
|
|||
/* Release the b-tree and all frames. Frame releases that happen later are
|
||||
* silently ignored */
|
||||
btree_destroy (®istered_frames);
|
||||
in_shutdown = true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -282,7 +284,7 @@ __deregister_frame_info_bases (const void *begin)
|
|||
__gthread_mutex_unlock (&object_mutex);
|
||||
#endif
|
||||
|
||||
gcc_assert (ob);
|
||||
gcc_assert (in_shutdown || ob);
|
||||
return (void *) ob;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue