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