cygming-crtbegin.c (__gcc_register_frame): Increment load-count on use of LIBGCC_SONAME DLL.

2013-11-10  Kai Tietz  <ktietz@redhat.com>

	* config/i386/cygming-crtbegin.c (__gcc_register_frame):
	Increment load-count on use of LIBGCC_SONAME DLL.
	(hmod_libgcc): New static variable to hold handle of
	LIBGCC_SONAME DLL.
	(__gcc_deregister_frame): Decrement load-count of
	LIBGCC_SONAME DLL.

From-SVN: r204635
This commit is contained in:
Kai Tietz 2013-11-10 12:47:18 +01:00 committed by Kai Tietz
parent 6fbf987777
commit cabeea52a7
2 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2013-11-10 Kai Tietz <ktietz@redhat.com>
* config/i386/cygming-crtbegin.c (__gcc_register_frame):
Increment load-count on use of LIBGCC_SONAME DLL.
(hmod_libgcc): New static variable to hold handle of
LIBGCC_SONAME DLL.
(__gcc_deregister_frame): Decrement load-count of
LIBGCC_SONAME DLL.
2013-11-08 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> 2013-11-08 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
* configure.ac (libgcc_cv_dfp): Extend check to probe fenv.h * configure.ac (libgcc_cv_dfp): Extend check to probe fenv.h

View File

@ -91,6 +91,9 @@ static EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
= { }; = { };
static struct object obj; static struct object obj;
/* Handle of libgcc's DLL reference. */
HANDLE hmod_libgcc;
#endif #endif
#if TARGET_USE_JCR_SECTION #if TARGET_USE_JCR_SECTION
@ -115,9 +118,14 @@ __gcc_register_frame (void)
void (*register_frame_fn) (const void *, struct object *); void (*register_frame_fn) (const void *, struct object *);
HANDLE h = GetModuleHandle (LIBGCC_SONAME); HANDLE h = GetModuleHandle (LIBGCC_SONAME);
if (h) if (h)
{
/* Increasing the load-count of LIBGCC_SONAME DLL. */
hmod_libgcc = LoadLibrary (LIBGCC_SONAME);
register_frame_fn = (void (*) (const void *, struct object *)) register_frame_fn = (void (*) (const void *, struct object *))
GetProcAddress (h, "__register_frame_info"); GetProcAddress (h, "__register_frame_info");
}
else else
register_frame_fn = __register_frame_info; register_frame_fn = __register_frame_info;
if (register_frame_fn) if (register_frame_fn)
@ -154,5 +162,7 @@ __gcc_deregister_frame (void)
deregister_frame_fn = __deregister_frame_info; deregister_frame_fn = __deregister_frame_info;
if (deregister_frame_fn) if (deregister_frame_fn)
deregister_frame_fn (__EH_FRAME_BEGIN__); deregister_frame_fn (__EH_FRAME_BEGIN__);
if (hmod_libgcc)
FreeLibrary (hmod_libgcc);
#endif #endif
} }