]>
Commit | Line | Data |
---|---|---|
76f5e200 | 1 | /* crtend object for windows32 targets. |
852b75ed | 2 | Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
76f5e200 DS |
3 | |
4 | Contributed by Danny Smith <dannysmith@users.sourceforge.net> | |
5 | ||
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it under | |
9 | the terms of the GNU General Public License as published by the Free | |
748086b7 | 10 | Software Foundation; either version 3, or (at your option) any later |
76f5e200 DS |
11 | version. |
12 | ||
76f5e200 DS |
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | for more details. | |
17 | ||
748086b7 JJ |
18 | Under Section 7 of GPL version 3, you are granted additional |
19 | permissions described in the GCC Runtime Library Exception, version | |
20 | 3.1, as published by the Free Software Foundation. | |
21 | ||
22 | You should have received a copy of the GNU General Public License and | |
23 | a copy of the GCC Runtime Library Exception along with this program; | |
24 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
25 | <http://www.gnu.org/licenses/>. */ | |
76f5e200 DS |
26 | |
27 | /* Target machine header files require this define. */ | |
28 | #define IN_LIBGCC2 | |
29 | ||
30 | /* auto-host.h is needed by cygming.h for HAVE_GAS_WEAK and here | |
31 | for HAVE_LD_RO_RW_SECTION_MIXING. */ | |
32 | #include "auto-host.h" | |
33 | #include "tconfig.h" | |
34 | #include "tsystem.h" | |
35 | #include "coretypes.h" | |
36 | #include "tm.h" | |
852b75ed | 37 | #include "libgcc_tm.h" |
76f5e200 DS |
38 | #include "unwind-dw2-fde.h" |
39 | ||
40 | #if defined(HAVE_LD_RO_RW_SECTION_MIXING) | |
41 | # define EH_FRAME_SECTION_CONST const | |
42 | #else | |
43 | # define EH_FRAME_SECTION_CONST | |
44 | #endif | |
45 | ||
46 | #if DWARF2_UNWIND_INFO | |
47 | /* Terminate the frame unwind info section with a 0 as a sentinel; | |
48 | this would be the 'length' field in a real FDE. */ | |
49 | ||
50 | static EH_FRAME_SECTION_CONST int __FRAME_END__[] | |
a9c5db80 | 51 | __attribute__ ((used, section(EH_FRAME_SECTION_NAME), |
76f5e200 DS |
52 | aligned(4))) |
53 | = { 0 }; | |
54 | #endif | |
55 | ||
56 | #if TARGET_USE_JCR_SECTION | |
57 | /* Null terminate the .jcr section array. */ | |
58 | static void *__JCR_END__[1] | |
a9c5db80 | 59 | __attribute__ ((used, section(JCR_SECTION_NAME), |
76f5e200 DS |
60 | aligned(sizeof(void *)))) |
61 | = { 0 }; | |
62 | #endif | |
63 | ||
76f5e200 DS |
64 | extern void __gcc_register_frame (void); |
65 | extern void __gcc_deregister_frame (void); | |
66 | ||
67 | static void register_frame_ctor (void) __attribute__ ((constructor (0))); | |
76f5e200 DS |
68 | |
69 | static void | |
70 | register_frame_ctor (void) | |
71 | { | |
72 | __gcc_register_frame (); | |
78a1f201 DS |
73 | #if DEFAULT_USE_CXA_ATEXIT |
74 | /* If we use the __cxa_atexit method to register C++ dtors | |
75 | at object construction, also use atexit to register eh frame | |
76 | info cleanup. */ | |
77 | atexit (__gcc_deregister_frame); | |
78 | #endif | |
d6b68fcc DS |
79 | } |
80 | ||
78a1f201 DS |
81 | #if !DEFAULT_USE_CXA_ATEXIT |
82 | static void deregister_frame_dtor (void) __attribute__ ((destructor (0))); | |
d6b68fcc DS |
83 | |
84 | static void | |
78a1f201 | 85 | deregister_frame_dtor (void) |
d6b68fcc DS |
86 | { |
87 | __gcc_deregister_frame (); | |
76f5e200 | 88 | } |
78a1f201 | 89 | #endif |