about summary refs log tree commit diff
path: root/sysdeps/generic/unwind-arch.h
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:58:01 +0100
commit9fc813e1a37d2e2d5e85a97d5ac4fc1c15d839fb (patch)
tree62e5002b97acab6f776476c2325a37097693b0ea /sysdeps/generic/unwind-arch.h
parent764e9a0334350f52ab6953bef1db97f9b2e89ca5 (diff)
downloadglibc-9fc813e1a37d2e2d5e85a97d5ac4fc1c15d839fb.tar.gz
glibc-9fc813e1a37d2e2d5e85a97d5ac4fc1c15d839fb.tar.xz
glibc-9fc813e1a37d2e2d5e85a97d5ac4fc1c15d839fb.zip
Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder
This will be used to consolidate the libgcc_s access for backtrace
and pthread_cancel.

Unlike the existing backtrace implementations, it provides some
hardening based on pointer mangling.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/generic/unwind-arch.h')
-rw-r--r--sysdeps/generic/unwind-arch.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/sysdeps/generic/unwind-arch.h b/sysdeps/generic/unwind-arch.h
index feda585e8d..ead6674279 100644
--- a/sysdeps/generic/unwind-arch.h
+++ b/sysdeps/generic/unwind-arch.h
@@ -1,5 +1,5 @@
-/* Return backtrace of current program state.  Arch-specific bits.
-   Copyright (C) 2020-2021 Free Software Foundation, Inc.
+/* Dynamic loading of the libgcc unwinder.  Generic version of parameters.
+   Copyright (C) 2021 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,15 +16,20 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#ifndef _UNWIND_ARCH_H
-#define _UNWIND_ARCH_H
+#ifndef _ARCH_UNWIND_LINK_H
+#define _ARCH_UNWIND_LINK_H
 
-#include <unwind.h>
+/* The _Unwind_GetIP function is supported.  */
+#define UNWIND_LINK_GETIP 1
 
-static inline void *
-unwind_arch_adjustment (void *prev, void *addr)
-{
-  return addr;
-}
+/* The __frame_state_for function is needed and re-exported from glibc.  */
+#define UNWIND_LINK_FRAME_STATE_FOR 0
 
-#endif
+/* No adjustment of the is needed.  */
+#define UNWIND_LINK_FRAME_ADJUSTMENT 0
+
+/* There are no extra fields in struct unwind_link in the generic version.  */
+#define UNWIND_LINK_EXTRA_FIELDS
+#define UNWIND_LINK_EXTRA_INIT
+
+#endif /* _ARCH_UNWIND_LINK_H */