]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-soinit-EH_FRAME.patch
- oops
[packages/glibc.git] / glibc-soinit-EH_FRAME.patch
1 diff -durN glibc-2.3.2.orig/elf/soinit.c glibc-2.3.2/elf/soinit.c
2 --- glibc-2.3.2.orig/elf/soinit.c       2001-11-16 00:09:20.000000000 +0100
3 +++ glibc-2.3.2/elf/soinit.c    2004-12-18 11:21:59.521615024 +0100
4 @@ -25,7 +25,7 @@
5  }
6  
7  #ifdef HAVE_DWARF2_UNWIND_INFO
8 -static char __EH_FRAME_BEGIN__[]
9 +const static char __EH_FRAME_BEGIN__[]
10       __attribute__ ((section (".eh_frame")))
11       = { };
12  # ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
13 diff -durN glibc-2.3.2.orig/elf/soinit.c~ glibc-2.3.2/elf/soinit.c~
14 --- glibc-2.3.2.orig/elf/soinit.c~      1970-01-01 01:00:00.000000000 +0100
15 +++ glibc-2.3.2/elf/soinit.c~   2001-11-16 00:09:20.000000000 +0100
16 @@ -0,0 +1,98 @@
17 +/* Initializer module for building the ELF shared C library.  This file and
18 +   sofini.c do the work normally done by crtbeginS.o and crtendS.o, to wrap
19 +   the `.ctors' and `.dtors' sections so the lists are terminated, and
20 +   calling those lists of functions.  */
21 +
22 +#include <libc-internal.h>
23 +#include <stdlib.h>
24 +
25 +#ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
26 +# include <gccframe.h>
27 +#endif
28 +
29 +static void (*const __CTOR_LIST__[1]) (void)
30 +     __attribute__ ((section (".ctors")))
31 +     = { (void (*) (void)) -1 };
32 +static void (*const __DTOR_LIST__[1]) (void)
33 +     __attribute__ ((section (".dtors")))
34 +     = { (void (*) (void)) -1 };
35 +
36 +static inline void
37 +run_hooks (void (*const list[]) (void))
38 +{
39 +  while (*++list)
40 +    (**list) ();
41 +}
42 +
43 +#ifdef HAVE_DWARF2_UNWIND_INFO
44 +static char __EH_FRAME_BEGIN__[]
45 +     __attribute__ ((section (".eh_frame")))
46 +     = { };
47 +# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
48 +extern void __register_frame_info (const void *, struct object *);
49 +extern void __register_frame_info_bases (const void *, struct object *,
50 +                                        void *, void *);
51 +extern void __deregister_frame_info (const void *);
52 +extern void __deregister_frame_info_bases (const void *);
53 +# else
54 +extern void __register_frame (const void *);
55 +extern void __deregister_frame (const void *);
56 +# endif
57 +#endif
58 +
59 +/* This function will be called from _init in init-first.c.  */
60 +void
61 +__libc_global_ctors (void)
62 +{
63 +  /* Call constructor functions.  */
64 +  run_hooks (__CTOR_LIST__);
65 +
66 +#ifdef HAVE_DWARF2_UNWIND_INFO
67 +# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
68 +  {
69 +    static struct object ob;
70 +#  if defined CRT_GET_RFIB_TEXT || defined CRT_GET_RFIB_DATA
71 +    void *tbase, *dbase;
72 +
73 +#   ifdef CRT_GET_RFIB_TEXT
74 +    CRT_GET_RFIB_TEXT (tbase);
75 +#   else
76 +    tbase = NULL;
77 +#   endif
78 +#   ifdef CRT_GET_RFIB_DATA
79 +    CRT_GET_RFIB_DATA (dbase);
80 +#   else
81 +    dbase = NULL;
82 +#   endif
83 +    __register_frame_info_bases (__EH_FRAME_BEGIN__, &ob, tbase, dbase);
84 +#  else
85 +    __register_frame_info (__EH_FRAME_BEGIN__, &ob);
86 +#  endif
87 +  }
88 +# else
89 +  __register_frame (__EH_FRAME_BEGIN__);
90 +# endif
91 +#endif
92 +}
93 +
94 +
95 +/* This function becomes the DT_FINI termination function
96 +   for the C library.  */
97 +void _fini (void) __attribute__ ((section (".fini"))); /* Just for kicks.  */
98 +void
99 +_fini (void)
100 +{
101 +  /* Call destructor functions.  */
102 +  run_hooks (__DTOR_LIST__);
103 +#ifdef HAVE_DWARF2_UNWIND_INFO
104 +# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
105 +#  if defined CRT_GET_RFIB_TEXT || defined CRT_GET_RFIB_DATA
106 +  __deregister_frame_info_bases (__EH_FRAME_BEGIN__);
107 +#  else
108 +  __deregister_frame_info (__EH_FRAME_BEGIN__);
109 +#  endif
110 +# else
111 +  __deregister_frame (__EH_FRAME_BEGIN__);
112 +# endif
113 +#endif
114 +}
This page took 0.110878 seconds and 3 git commands to generate.