1/* crtend object for windows32 targets.
2   Copyright (C) 2007-2022 Free Software Foundation, Inc.
3
4   Contributed by Danny Smith <dannysmith@users.sourceforge.net>
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16for more details.
17
18Under Section 7 of GPL version 3, you are granted additional
19permissions described in the GCC Runtime Library Exception, version
203.1, as published by the Free Software Foundation.
21
22You should have received a copy of the GNU General Public License and
23a copy of the GCC Runtime Library Exception along with this program;
24see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
25<http://www.gnu.org/licenses/>.  */
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"
37#include "libgcc_tm.h"
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
50static EH_FRAME_SECTION_CONST int __FRAME_END__[]
51  __attribute__ ((used,  section(__LIBGCC_EH_FRAME_SECTION_NAME__),
52		  aligned(4)))
53  = { 0 };
54#endif
55
56extern void __gcc_register_frame (void);
57extern void __gcc_deregister_frame (void);
58
59#pragma GCC diagnostic push
60#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
61static void register_frame_ctor (void) __attribute__ ((constructor (0)));
62#pragma GCC diagnostic pop
63
64static void
65register_frame_ctor (void)
66{
67  __gcc_register_frame ();
68}
69
70#if !DEFAULT_USE_CXA_ATEXIT
71#pragma GCC diagnostic push
72#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
73static void deregister_frame_dtor (void) __attribute__ ((destructor (0)));
74#pragma GCC diagnostic pop
75
76static void
77deregister_frame_dtor (void)
78{
79  __gcc_deregister_frame ();
80}
81#endif
82