OSDN Git Service

* config/i386/cygming-crtend.c (register_frame_ctor): If
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / cygming-crtend.c
1 /* crtend object for windows32 targets.
2    Copyright (C) 2007  Free Software Foundation, Inc.
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
10 Software Foundation; either version 2, or (at your option) any later
11 version.
12
13 In addition to the permissions in the GNU General Public License, the
14 Free Software Foundation gives you unlimited permission to link the
15 compiled version of this file into combinations with other programs,
16 and to distribute those combinations without any restriction coming
17 from the use of this file.  (The General Public License restrictions
18 do apply in other respects; for example, they cover modification of
19 the file, and distribution when not linked into a combine
20 executable.)
21
22 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
23 WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25 for more details.
26
27 You should have received a copy of the GNU General Public License
28 along with GCC; see the file COPYING.  If not, write to the Free
29 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
30 02111-1307, USA.  */
31
32 /* Target machine header files require this define. */
33 #define IN_LIBGCC2
34
35 /* auto-host.h is needed by cygming.h for HAVE_GAS_WEAK and here
36    for HAVE_LD_RO_RW_SECTION_MIXING.  */  
37 #include "auto-host.h"
38 #include "tconfig.h"
39 #include "tsystem.h"
40 #include "coretypes.h"
41 #include "tm.h"
42 #include "unwind-dw2-fde.h"
43
44 #if defined(HAVE_LD_RO_RW_SECTION_MIXING)
45 # define EH_FRAME_SECTION_CONST const
46 #else
47 # define EH_FRAME_SECTION_CONST
48 #endif
49
50 #if DWARF2_UNWIND_INFO
51 /* Terminate the frame unwind info section with a 0 as a sentinel;
52    this would be the 'length' field in a real FDE.  */
53
54 static EH_FRAME_SECTION_CONST int __FRAME_END__[]
55   __attribute__ ((unused,  section(EH_FRAME_SECTION_NAME),
56                   aligned(4)))
57   = { 0 };
58 #endif
59
60 #if TARGET_USE_JCR_SECTION
61 /* Null terminate the .jcr section array.  */
62 static void *__JCR_END__[1] 
63    __attribute__ ((unused, section(JCR_SECTION_NAME),
64                    aligned(sizeof(void *))))
65    = { 0 };
66 #endif
67
68 extern void __gcc_register_frame (void); 
69 extern void __gcc_deregister_frame (void);
70
71 static void register_frame_ctor (void) __attribute__ ((constructor (0)));
72
73 static void
74 register_frame_ctor (void)
75 {
76   __gcc_register_frame ();
77 #if DEFAULT_USE_CXA_ATEXIT
78   /* If we use the __cxa_atexit method to register C++ dtors
79      at object construction,  also use atexit to register eh frame
80      info cleanup.  */
81   atexit (__gcc_deregister_frame);
82 #endif
83 }
84
85 #if !DEFAULT_USE_CXA_ATEXIT
86 static void deregister_frame_dtor (void) __attribute__ ((destructor (0)));
87
88 static void
89 deregister_frame_dtor (void)
90 {
91   __gcc_deregister_frame ();
92 }
93 #endif