1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
Index: libgcc/config/i386/cygming-crtbegin.c
===================================================================
--- libgcc/config/i386/cygming-crtbegin.c (revision 212546)
+++ libgcc/config/i386/cygming-crtbegin.c (working copy)
@@ -99,12 +99,13 @@ static EH_FRAME_SECTION_CONST char __EH_
= { };
static struct object obj;
/* Handle of libgcc's DLL reference. */
HANDLE hmod_libgcc;
+static void * (*deregister_frame_fn) (const void *) = NULL;
#endif
#if TARGET_USE_JCR_SECTION
static void *__JCR_LIST__[]
__attribute__ ((used, section(JCR_SECTION_NAME), aligned(4)))
= { };
@@ -130,15 +131,20 @@ __gcc_register_frame (void)
if (h)
{
/* Increasing the load-count of LIBGCC_SONAME DLL. */
hmod_libgcc = LoadLibrary (LIBGCC_SONAME);
register_frame_fn = (void (*) (const void *, struct object *))
GetProcAddress (h, "__register_frame_info");
+ deregister_frame_fn = (void* (*) (const void *))
+ GetProcAddress (h, "__deregister_frame_info");
+ }
+ else
+ {
+ register_frame_fn = __register_frame_info;
+ deregister_frame_fn = __deregister_frame_info;
}
- else
- register_frame_fn = __register_frame_info;
if (register_frame_fn)
register_frame_fn (__EH_FRAME_BEGIN__, &obj);
#endif
#if TARGET_USE_JCR_SECTION
if (__JCR_LIST__[0])
@@ -158,19 +164,12 @@ __gcc_register_frame (void)
}
void
__gcc_deregister_frame (void)
{
#if DWARF2_UNWIND_INFO
- void * (*deregister_frame_fn) (const void *);
- HANDLE h = GetModuleHandle (LIBGCC_SONAME);
- if (h)
- deregister_frame_fn = (void* (*) (const void *))
- GetProcAddress (h, "__deregister_frame_info");
- else
- deregister_frame_fn = __deregister_frame_info;
if (deregister_frame_fn)
deregister_frame_fn (__EH_FRAME_BEGIN__);
if (hmod_libgcc)
FreeLibrary (hmod_libgcc);
#endif
}
|