aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-03-01 15:56:36 +0100
committerFlorian Weimer <fweimer@redhat.com>2021-03-01 15:59:36 +0100
commit7cf18db4820baf29b6d150fd124cf83675451161 (patch)
tree37f940680f83870826a5db6abcfdba46f4a01dc4
parent600fe89cb1a2b18d3509582b85bd4d16d8603fb5 (diff)
downloadglibc-7cf18db4820baf29b6d150fd124cf83675451161.zip
glibc-7cf18db4820baf29b6d150fd124cf83675451161.tar.gz
glibc-7cf18db4820baf29b6d150fd124cf83675451161.tar.bz2
__frame_state_for: Use <unwind-link.h> for unwinder access
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-rw-r--r--sysdeps/generic/framestate.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c
index c1b364d..54c4817 100644
--- a/sysdeps/generic/framestate.c
+++ b/sysdeps/generic/framestate.c
@@ -17,7 +17,6 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <dlfcn.h>
#include <stdlib.h>
#define STATIC static
#define __frame_state_for fallback_frame_state_for
@@ -25,6 +24,8 @@
#undef __frame_state_for
#include <gnu/lib-names.h>
+#include <unwind-link.h>
+
typedef struct frame_state * (*framesf)(void *pc, struct frame_state *);
struct frame_state *__frame_state_for (void *pc,
struct frame_state *frame_state);
@@ -32,21 +33,15 @@ struct frame_state *__frame_state_for (void *pc,
struct frame_state *
__frame_state_for (void *pc, struct frame_state *frame_state)
{
- static framesf frame_state_for;
-
- if (frame_state_for == NULL)
+ struct unwind_link *unwind_link = __libc_unwind_link_get ();
+ if (unwind_link != NULL)
+ return UNWIND_LINK_PTR (unwind_link, __frame_state_for) (pc, frame_state);
+ else
{
- void *handle = __libc_dlopen (LIBGCC_S_SO);
-
- if (handle == NULL
- || (frame_state_for
- = (framesf) __libc_dlsym (handle, "__frame_state_for")) == NULL)
#ifndef __USING_SJLJ_EXCEPTIONS__
- frame_state_for = fallback_frame_state_for;
+ return fallback_frame_state_for (pc, frame_state);
#else
- frame_state_for = abort;
+ abort ();
#endif
}
-
- return frame_state_for (pc, frame_state);
}