about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile5
-rw-r--r--elf/Versions9
-rw-r--r--elf/soinit.c24
3 files changed, 38 insertions, 0 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 91d7e3a508..b39034c7bf 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -66,6 +66,11 @@ distribute	:= $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
 
 include ../Makeconfig
 
+ifeq ($(unwind-find-fde),yes)
+routines += unwind-dw2-fde
+shared-only-routines = unwind-dw2-fde
+endif
+
 before-compile  = $(objpfx)trusted-dirs.h
 generated	:= trusted-dirs.h trusted-dirs.st for-renamed/renamed.so
 generated-dirs	:= for-renamed
diff --git a/elf/Versions b/elf/Versions
index 2506d100a6..a0e691c0ac 100644
--- a/elf/Versions
+++ b/elf/Versions
@@ -2,6 +2,9 @@ libc {
   GLIBC_2.0 {
     # functions used in other libraries
     _dl_open; _dl_close; _dl_addr;
+%ifdef EXPORT_UNWIND_FIND_FDE
+    __register_frame_info; __deregister_frame_info;
+%endif
   }
   GLIBC_2.1 {
     # functions used in other libraries
@@ -17,6 +20,12 @@ libc {
   GLIBC_2.2.4 {
     dl_iterate_phdr;
   }
+%ifdef EXPORT_UNWIND_FIND_FDE
+  GLIBC_2.2.5 {
+    __register_frame_info_bases; __deregister_frame_info_bases;
+    __register_frame_info_table_bases; _Unwind_Find_FDE;
+  }
+%endif
 }
 
 ld {
diff --git a/elf/soinit.c b/elf/soinit.c
index ff65af4a36..32ed4454b5 100644
--- a/elf/soinit.c
+++ b/elf/soinit.c
@@ -4,6 +4,7 @@
    calling those lists of functions.  */
 
 #include <libc-internal.h>
+#include <stdlib.h>
 
 #ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
 # include <gccframe.h>
@@ -29,7 +30,10 @@ static char __EH_FRAME_BEGIN__[]
      = { };
 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
 extern void __register_frame_info (const void *, struct object *);
+extern void __register_frame_info_bases (const void *, struct object *,
+					 void *, void *);
 extern void __deregister_frame_info (const void *);
+extern void __deregister_frame_info_bases (const void *);
 # else
 extern void __register_frame (const void *);
 extern void __deregister_frame (const void *);
@@ -47,7 +51,23 @@ __libc_global_ctors (void)
 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
   {
     static struct object ob;
+#  if defined CRT_GET_RFIB_TEXT || defined CRT_GET_RFIB_DATA
+    void *tbase, *dbase;
+
+#   ifdef CRT_GET_RFIB_TEXT
+    CRT_GET_RFIB_TEXT (tbase);
+#   else
+    tbase = NULL;
+#   endif
+#   ifdef CRT_GET_RFIB_DATA
+    CRT_GET_RFIB_DATA (dbase);
+#   else
+    dbase = NULL;
+#   endif
+    __register_frame_info_bases (__EH_FRAME_BEGIN__, &ob, tbase, dbase);
+#  else
     __register_frame_info (__EH_FRAME_BEGIN__, &ob);
+#  endif
   }
 # else
   __register_frame (__EH_FRAME_BEGIN__);
@@ -66,7 +86,11 @@ _fini (void)
   run_hooks (__DTOR_LIST__);
 #ifdef HAVE_DWARF2_UNWIND_INFO
 # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
+#  if defined CRT_GET_RFIB_TEXT || defined CRT_GET_RFIB_DATA
+  __deregister_frame_info_bases (__EH_FRAME_BEGIN__);
+#  else
   __deregister_frame_info (__EH_FRAME_BEGIN__);
+#  endif
 # else
   __deregister_frame (__EH_FRAME_BEGIN__);
 # endif