OSDN Git Service

adc857c3666d74c5b751478ca0679a19d1255cf8
[pf3gnuchains/gcc-fork.git] / gcc / crtstuff.c
1 /* Specialized bits of code needed to support construction and
2    destruction of file-scope objects in C++ code.
3    Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998,
4    1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5    Contributed by Ron Guilmette (rfg@monkeys.com).
6
7 This file is part of GCC.
8
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2, or (at your option) any later
12 version.
13
14 In addition to the permissions in the GNU General Public License, the
15 Free Software Foundation gives you unlimited permission to link the
16 compiled version of this file into combinations with other programs,
17 and to distribute those combinations without any restriction coming
18 from the use of this file.  (The General Public License restrictions
19 do apply in other respects; for example, they cover modification of
20 the file, and distribution when not linked into a combine
21 executable.)
22
23 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
24 WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26 for more details.
27
28 You should have received a copy of the GNU General Public License
29 along with GCC; see the file COPYING.  If not, write to the Free
30 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
31 02111-1307, USA.  */
32
33 /* This file is a bit like libgcc2.c in that it is compiled
34    multiple times and yields multiple .o files.
35
36    This file is useful on target machines where the object file format
37    supports multiple "user-defined" sections (e.g. COFF, ELF, ROSE).  On
38    such systems, this file allows us to avoid running collect (or any
39    other such slow and painful kludge).  Additionally, if the target
40    system supports a .init section, this file allows us to support the
41    linking of C++ code with a non-C++ main program.
42
43    Note that if INIT_SECTION_ASM_OP is defined in the tm.h file, then
44    this file *will* make use of the .init section.  If that symbol is
45    not defined however, then the .init section will not be used.
46
47    Currently, only ELF and COFF are supported.  It is likely however that
48    ROSE could also be supported, if someone was willing to do the work to
49    make whatever (small?) adaptations are needed.  (Some work may be
50    needed on the ROSE assembler and linker also.)
51
52    This file must be compiled with gcc.  */
53
54 /* Target machine header files require this define. */
55 #define IN_LIBGCC2
56
57 #include "tconfig.h"
58 #include "tsystem.h"
59 #include "coretypes.h"
60 #include "tm.h"
61 #include "unwind-dw2-fde.h"
62
63 #ifndef FORCE_CODE_SECTION_ALIGN
64 # define FORCE_CODE_SECTION_ALIGN
65 #endif
66
67 #ifndef CRT_CALL_STATIC_FUNCTION
68 # define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)     \
69 static void __attribute__((__used__))                   \
70 call_ ## FUNC (void)                                    \
71 {                                                       \
72   asm (SECTION_OP);                                     \
73   FUNC ();                                              \
74   FORCE_CODE_SECTION_ALIGN                              \
75   asm (TEXT_SECTION_ASM_OP);                            \
76 }
77 #endif
78
79 #if defined(OBJECT_FORMAT_ELF) && defined(HAVE_LD_EH_FRAME_HDR) \
80     && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
81     && defined(__GLIBC__) && __GLIBC__ >= 2
82 #include <link.h>
83 # if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
84      || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
85 #  define USE_PT_GNU_EH_FRAME
86 # endif
87 #endif
88 #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
89 # define USE_EH_FRAME_REGISTRY
90 #endif
91 #if defined(EH_FRAME_SECTION_NAME) && EH_TABLES_CAN_BE_READ_ONLY
92 # define EH_FRAME_SECTION_CONST const
93 #else
94 # define EH_FRAME_SECTION_CONST
95 #endif
96
97 /* We do not want to add the weak attribute to the declarations of these
98    routines in unwind-dw2-fde.h because that will cause the definition of
99    these symbols to be weak as well.
100
101    This exposes a core issue, how to handle creating weak references vs
102    how to create weak definitions.  Either we have to have the definition
103    of TARGET_WEAK_ATTRIBUTE be conditional in the shared header files or
104    have a second declaration if we want a function's references to be weak,
105    but not its definition.
106
107    Making TARGET_WEAK_ATTRIBUTE conditional seems like a good solution until
108    one thinks about scaling to larger problems -- i.e., the condition under
109    which TARGET_WEAK_ATTRIBUTE is active will eventually get far too
110    complicated.
111
112    So, we take an approach similar to #pragma weak -- we have a second
113    declaration for functions that we want to have weak references.
114
115    Neither way is particularly good.  */
116    
117 /* References to __register_frame_info and __deregister_frame_info should
118    be weak in this file if at all possible.  */
119 extern void __register_frame_info (const void *, struct object *)
120                                   TARGET_ATTRIBUTE_WEAK;
121 extern void __register_frame_info_bases (const void *, struct object *,
122                                          void *, void *)
123                                   TARGET_ATTRIBUTE_WEAK;
124 extern void *__deregister_frame_info (const void *)
125                                      TARGET_ATTRIBUTE_WEAK;
126 extern void *__deregister_frame_info_bases (const void *)
127                                      TARGET_ATTRIBUTE_WEAK;
128 extern void __do_global_ctors_1 (void);
129
130 /* Likewise for _Jv_RegisterClasses.  */
131 extern void _Jv_RegisterClasses (void *) TARGET_ATTRIBUTE_WEAK;
132
133 #ifdef OBJECT_FORMAT_ELF
134
135 /*  Declare a pointer to void function type.  */
136 typedef void (*func_ptr) (void);
137 #define STATIC static
138
139 #else  /* OBJECT_FORMAT_ELF */
140
141 #include "gbl-ctors.h"
142
143 #define STATIC
144
145 #endif /* OBJECT_FORMAT_ELF */
146
147 #ifdef CRT_BEGIN
148
149 /* NOTE:  In order to be able to support SVR4 shared libraries, we arrange
150    to have one set of symbols { __CTOR_LIST__, __DTOR_LIST__, __CTOR_END__,
151    __DTOR_END__ } per root executable and also one set of these symbols
152    per shared library.  So in any given whole process image, we may have
153    multiple definitions of each of these symbols.  In order to prevent
154    these definitions from conflicting with one another, and in order to
155    ensure that the proper lists are used for the initialization/finalization
156    of each individual shared library (respectively), we give these symbols
157    only internal (i.e. `static') linkage, and we also make it a point to
158    refer to only the __CTOR_END__ symbol in crtend.o and the __DTOR_LIST__
159    symbol in crtbegin.o, where they are defined.  */
160
161 /* The -1 is a flag to __do_global_[cd]tors indicating that this table
162    does not start with a count of elements.  */
163 #ifdef CTOR_LIST_BEGIN
164 CTOR_LIST_BEGIN;
165 #elif defined(CTORS_SECTION_ASM_OP)
166 /* Hack: force cc1 to switch to .data section early, so that assembling
167    __CTOR_LIST__ does not undo our behind-the-back change to .ctors.  */
168 static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
169 asm (CTORS_SECTION_ASM_OP);
170 STATIC func_ptr __CTOR_LIST__[1]
171   __attribute__ ((__unused__, aligned(sizeof(func_ptr))))
172   = { (func_ptr) (-1) };
173 #else
174 STATIC func_ptr __CTOR_LIST__[1]
175   __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr))))
176   = { (func_ptr) (-1) };
177 #endif /* __CTOR_LIST__ alternatives */
178
179 #ifdef DTOR_LIST_BEGIN
180 DTOR_LIST_BEGIN;
181 #elif defined(DTORS_SECTION_ASM_OP)
182 asm (DTORS_SECTION_ASM_OP);
183 STATIC func_ptr __DTOR_LIST__[1]
184   __attribute__ ((aligned(sizeof(func_ptr))))
185   = { (func_ptr) (-1) };
186 #else
187 STATIC func_ptr __DTOR_LIST__[1]
188   __attribute__((section(".dtors"), aligned(sizeof(func_ptr))))
189   = { (func_ptr) (-1) };
190 #endif /* __DTOR_LIST__ alternatives */
191
192 #ifdef USE_EH_FRAME_REGISTRY
193 /* Stick a label at the beginning of the frame unwind info so we can register
194    and deregister it with the exception handling library code.  */
195 STATIC EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
196      __attribute__((section(EH_FRAME_SECTION_NAME), aligned(4)))
197      = { };
198 #endif /* USE_EH_FRAME_REGISTRY */
199
200 #ifdef JCR_SECTION_NAME
201 /* Stick a label at the beginning of the java class registration info
202    so we can register them properly.  */
203 STATIC void *__JCR_LIST__[]
204   __attribute__ ((unused, section(JCR_SECTION_NAME), aligned(sizeof(void*))))
205   = { };
206 #endif /* JCR_SECTION_NAME */
207
208 #if defined(INIT_SECTION_ASM_OP) || defined(INIT_ARRAY_SECTION_ASM_OP)
209
210 #ifdef OBJECT_FORMAT_ELF
211
212 /* Declare the __dso_handle variable.  It should have a unique value
213    in every shared-object; in a main program its value is zero.  The
214    object should in any case be protected.  This means the instance
215    in one DSO or the main program is not used in another object.  The
216    dynamic linker takes care of this.  */
217
218 #ifdef HAVE_GAS_HIDDEN
219 extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
220 #endif
221 #ifdef CRTSTUFFS_O
222 void *__dso_handle = &__dso_handle;
223 #else
224 void *__dso_handle = 0;
225 #endif
226
227 /* The __cxa_finalize function may not be available so we use only a
228    weak declaration.  */
229 extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK;
230
231 /* Run all the global destructors on exit from the program.  */
232  
233 /* Some systems place the number of pointers in the first word of the
234    table.  On SVR4 however, that word is -1.  In all cases, the table is
235    null-terminated.  On SVR4, we start from the beginning of the list and
236    invoke each per-compilation-unit destructor routine in order
237    until we find that null.
238
239    Note that this function MUST be static.  There will be one of these
240    functions in each root executable and one in each shared library, but
241    although they all have the same code, each one is unique in that it
242    refers to one particular associated `__DTOR_LIST__' which belongs to the
243    same particular root executable or shared library file.
244
245    On some systems, this routine is run more than once from the .fini,
246    when exit is called recursively, so we arrange to remember where in
247    the list we left off processing, and we resume at that point,
248    should we be re-invoked.  */
249
250 static void __attribute__((used))
251 __do_global_dtors_aux (void)
252 {
253 #ifndef FINI_ARRAY_SECTION_ASM_OP
254   static func_ptr *p = __DTOR_LIST__ + 1;
255   func_ptr f;
256 #endif /* !defined(FINI_ARRAY_SECTION_ASM_OP)  */
257   static _Bool completed;
258
259   if (__builtin_expect (completed, 0))
260     return;
261
262 #ifdef CRTSTUFFS_O
263   if (__cxa_finalize)
264     __cxa_finalize (__dso_handle);
265 #endif
266
267 #ifdef FINI_ARRAY_SECTION_ASM_OP
268   /* If we are using .fini_array then destructors will be run via that
269      mechanism.  */
270 #else /* !defined (FINI_ARRAY_SECTION_ASM_OP) */
271   while ((f = *p))
272     {
273       p++;
274       f ();
275     }
276 #endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
277
278 #ifdef USE_EH_FRAME_REGISTRY
279 #ifdef CRT_GET_RFIB_DATA
280   /* If we used the new __register_frame_info_bases interface,
281      make sure that we deregister from the same place.  */
282   if (__deregister_frame_info_bases)
283     __deregister_frame_info_bases (__EH_FRAME_BEGIN__);
284 #else
285   if (__deregister_frame_info)
286     __deregister_frame_info (__EH_FRAME_BEGIN__);
287 #endif
288 #endif
289
290   completed = 1;
291 }
292
293 /* Stick a call to __do_global_dtors_aux into the .fini section.  */
294 #ifdef FINI_SECTION_ASM_OP
295 CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
296 #else /* !defined(FINI_SECTION_ASM_OP) */
297 static func_ptr __do_global_dtors_aux_fini_array_entry[]
298   __attribute__ ((__unused__, section(".fini_array")))
299   = { __do_global_dtors_aux };
300 #endif /* !defined(FINI_SECTION_ASM_OP) */
301
302 #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
303 /* Stick a call to __register_frame_info into the .init section.  For some
304    reason calls with no arguments work more reliably in .init, so stick the
305    call in another function.  */
306
307 static void __attribute__((used))
308 frame_dummy (void)
309 {
310 #ifdef USE_EH_FRAME_REGISTRY
311   static struct object object;
312 #ifdef CRT_GET_RFIB_DATA
313   void *tbase, *dbase;
314   tbase = 0;
315   CRT_GET_RFIB_DATA (dbase);
316   if (__register_frame_info_bases)
317     __register_frame_info_bases (__EH_FRAME_BEGIN__, &object, tbase, dbase);
318 #else
319   if (__register_frame_info)
320     __register_frame_info (__EH_FRAME_BEGIN__, &object);
321 #endif /* CRT_GET_RFIB_DATA */
322 #endif /* USE_EH_FRAME_REGISTRY */
323 #ifdef JCR_SECTION_NAME
324   if (__JCR_LIST__[0])
325     {
326       void (*register_classes) (void *) = _Jv_RegisterClasses;
327       __asm ("" : "+r" (register_classes));
328       if (register_classes)
329         register_classes (__JCR_LIST__);
330     }
331 #endif /* JCR_SECTION_NAME */
332 }
333
334 #ifdef INIT_SECTION_ASM_OP
335 CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, frame_dummy)
336 #else /* defined(INIT_SECTION_ASM_OP) */
337 static func_ptr __frame_dummy_init_array_entry[]
338   __attribute__ ((__unused__, section(".init_array")))
339   = { frame_dummy };
340 #endif /* !defined(INIT_SECTION_ASM_OP) */
341 #endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME */
342
343 #else  /* OBJECT_FORMAT_ELF */
344
345 /* The function __do_global_ctors_aux is compiled twice (once in crtbegin.o
346    and once in crtend.o).  It must be declared static to avoid a link
347    error.  Here, we define __do_global_ctors as an externally callable
348    function.  It is externally callable so that __main can invoke it when
349    INVOKE__main is defined.  This has the additional effect of forcing cc1
350    to switch to the .text section.  */
351
352 static void __do_global_ctors_aux (void);
353 void
354 __do_global_ctors (void)
355 {
356 #ifdef INVOKE__main
357   /* If __main won't actually call __do_global_ctors then it doesn't matter
358      what's inside the function.  The inside of __do_global_ctors_aux is
359      called automatically in that case.  And the Alliant fx2800 linker
360      crashes on this reference.  So prevent the crash.  */
361   __do_global_ctors_aux ();
362 #endif
363 }
364
365 asm (INIT_SECTION_ASM_OP);      /* cc1 doesn't know that we are switching! */
366
367 /* A routine to invoke all of the global constructors upon entry to the
368    program.  We put this into the .init section (for systems that have
369    such a thing) so that we can properly perform the construction of
370    file-scope static-storage C++ objects within shared libraries.  */
371
372 static void __attribute__((used))
373 __do_global_ctors_aux (void)    /* prologue goes in .init section */
374 {
375   FORCE_CODE_SECTION_ALIGN      /* explicit align before switch to .text */
376   asm (TEXT_SECTION_ASM_OP);    /* don't put epilogue and body in .init */
377   DO_GLOBAL_CTORS_BODY;
378   atexit (__do_global_dtors);
379 }
380
381 #endif /* OBJECT_FORMAT_ELF */
382
383 #elif defined(HAS_INIT_SECTION) /* ! INIT_SECTION_ASM_OP */
384
385 extern void __do_global_dtors (void);
386
387 /* This case is used by the Irix 6 port, which supports named sections but
388    not an SVR4-style .fini section.  __do_global_dtors can be non-static
389    in this case because we protect it with -hidden_symbol.  */
390
391 void
392 __do_global_dtors (void)
393 {
394   func_ptr *p, f;
395   for (p = __DTOR_LIST__ + 1; (f = *p); p++)
396     f ();
397
398 #ifdef USE_EH_FRAME_REGISTRY
399   if (__deregister_frame_info)
400     __deregister_frame_info (__EH_FRAME_BEGIN__);
401 #endif
402 }
403
404 #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
405 /* A helper function for __do_global_ctors, which is in crtend.o.  Here
406    in crtbegin.o, we can reference a couple of symbols not visible there.
407    Plus, since we're before libgcc.a, we have no problems referencing
408    functions from there.  */
409 void
410 __do_global_ctors_1(void)
411 {
412 #ifdef USE_EH_FRAME_REGISTRY
413   static struct object object;
414   if (__register_frame_info)
415     __register_frame_info (__EH_FRAME_BEGIN__, &object);
416 #endif
417 #ifdef JCR_SECTION_NAME
418   if (__JCR_LIST__[0])
419     {
420       void (*register_classes) (void *) = _Jv_RegisterClasses;
421       __asm ("" : "+r" (register_classes));
422       if (register_classes)
423         register_classes (__JCR_LIST__);
424     }
425 #endif
426 }
427 #endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME */
428
429 #else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */
430 #error "What are you doing with crtstuff.c, then?"
431 #endif
432
433 #elif defined(CRT_END) /* ! CRT_BEGIN */
434
435 /* Put a word containing zero at the end of each of our two lists of function
436    addresses.  Note that the words defined here go into the .ctors and .dtors
437    sections of the crtend.o file, and since that file is always linked in
438    last, these words naturally end up at the very ends of the two lists
439    contained in these two sections.  */
440
441 #ifdef CTOR_LIST_END
442 CTOR_LIST_END;
443 #elif defined(CTORS_SECTION_ASM_OP)
444 /* Hack: force cc1 to switch to .data section early, so that assembling
445    __CTOR_LIST__ does not undo our behind-the-back change to .ctors.  */
446 static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
447 asm (CTORS_SECTION_ASM_OP);
448 STATIC func_ptr __CTOR_END__[1]
449   __attribute__((aligned(sizeof(func_ptr))))
450   = { (func_ptr) 0 };
451 #else
452 STATIC func_ptr __CTOR_END__[1]
453   __attribute__((section(".ctors"), aligned(sizeof(func_ptr))))
454   = { (func_ptr) 0 };
455 #endif
456
457 #ifdef DTOR_LIST_END
458 DTOR_LIST_END;
459 #elif defined(DTORS_SECTION_ASM_OP)
460 asm (DTORS_SECTION_ASM_OP);
461 STATIC func_ptr __DTOR_END__[1]
462   __attribute__ ((unused, aligned(sizeof(func_ptr))))
463   = { (func_ptr) 0 };
464 #else
465 STATIC func_ptr __DTOR_END__[1]
466   __attribute__((unused, section(".dtors"), aligned(sizeof(func_ptr))))
467   = { (func_ptr) 0 };
468 #endif
469
470 #ifdef EH_FRAME_SECTION_NAME
471 /* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
472    this would be the 'length' field in a real FDE.  */
473 # if __INT_MAX__ == 2147483647
474 typedef int int32;
475 # elif __LONG_MAX__ == 2147483647
476 typedef long int32;
477 # elif __SHRT_MAX__ == 2147483647
478 typedef short int32;
479 # else
480 #  error "Missing a 4 byte integer"
481 # endif
482 STATIC EH_FRAME_SECTION_CONST int32 __FRAME_END__[]
483      __attribute__ ((unused, section(EH_FRAME_SECTION_NAME),
484                      aligned(sizeof(int32))))
485      = { 0 };
486 #endif /* EH_FRAME_SECTION_NAME */
487
488 #ifdef JCR_SECTION_NAME
489 /* Null terminate the .jcr section array.  */
490 STATIC void *__JCR_END__[1] 
491    __attribute__ ((unused, section(JCR_SECTION_NAME),
492                    aligned(sizeof(void *))))
493    = { 0 };
494 #endif /* JCR_SECTION_NAME */
495
496 #ifdef INIT_ARRAY_SECTION_ASM_OP
497
498 /* If we are using .init_array, there is nothing to do.  */
499
500 #elif defined(INIT_SECTION_ASM_OP)
501
502 #ifdef OBJECT_FORMAT_ELF
503 static void __attribute__((used))
504 __do_global_ctors_aux (void)
505 {
506   func_ptr *p;
507   for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
508     (*p) ();
509 }
510
511 /* Stick a call to __do_global_ctors_aux into the .init section.  */
512 CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_ctors_aux)
513 #else  /* OBJECT_FORMAT_ELF */
514
515 /* Stick the real initialization code, followed by a normal sort of
516    function epilogue at the very end of the .init section for this
517    entire root executable file or for this entire shared library file.
518
519    Note that we use some tricks here to get *just* the body and just
520    a function epilogue (but no function prologue) into the .init
521    section of the crtend.o file.  Specifically, we switch to the .text
522    section, start to define a function, and then we switch to the .init
523    section just before the body code.
524
525    Earlier on, we put the corresponding function prologue into the .init
526    section of the crtbegin.o file (which will be linked in first).
527
528    Note that we want to invoke all constructors for C++ file-scope static-
529    storage objects AFTER any other possible initialization actions which
530    may be performed by the code in the .init section contributions made by
531    other libraries, etc.  That's because those other initializations may
532    include setup operations for very primitive things (e.g. initializing
533    the state of the floating-point coprocessor, etc.) which should be done
534    before we start to execute any of the user's code.  */
535
536 static void
537 __do_global_ctors_aux (void)    /* prologue goes in .text section */
538 {
539   asm (INIT_SECTION_ASM_OP);
540   DO_GLOBAL_CTORS_BODY;
541   atexit (__do_global_dtors);
542 }                               /* epilogue and body go in .init section */
543
544 FORCE_CODE_SECTION_ALIGN
545 asm (TEXT_SECTION_ASM_OP);
546
547 #endif /* OBJECT_FORMAT_ELF */
548
549 #elif defined(HAS_INIT_SECTION) /* ! INIT_SECTION_ASM_OP */
550
551 extern void __do_global_ctors (void);
552
553 /* This case is used by the Irix 6 port, which supports named sections but
554    not an SVR4-style .init section.  __do_global_ctors can be non-static
555    in this case because we protect it with -hidden_symbol.  */
556 void
557 __do_global_ctors (void)
558 {
559   func_ptr *p;
560 #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
561   __do_global_ctors_1();
562 #endif
563   for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
564     (*p) ();
565 }
566
567 #else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */
568 #error "What are you doing with crtstuff.c, then?"
569 #endif
570
571 #else /* ! CRT_BEGIN && ! CRT_END */
572 #error "One of CRT_BEGIN or CRT_END must be defined."
573 #endif