comparison gcc/crtstuff.c @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
1 /* Specialized bits of code needed to support construction and 1 /* Specialized bits of code needed to support construction and
2 destruction of file-scope objects in C++ code. 2 destruction of file-scope objects in C++ code.
3 Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 3 Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
4 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc. 4 2002, 2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
5 Contributed by Ron Guilmette (rfg@monkeys.com). 5 Contributed by Ron Guilmette (rfg@monkeys.com).
6 6
7 This file is part of GCC. 7 This file is part of GCC.
8 8
9 GCC is free software; you can redistribute it and/or modify it under 9 GCC is free software; you can redistribute it and/or modify it under
51 51
52 /* FIXME: Including auto-host is incorrect, but until we have 52 /* FIXME: Including auto-host is incorrect, but until we have
53 identified the set of defines that need to go into auto-target.h, 53 identified the set of defines that need to go into auto-target.h,
54 this will have to do. */ 54 this will have to do. */
55 #include "auto-host.h" 55 #include "auto-host.h"
56 #undef gid_t
57 #undef pid_t 56 #undef pid_t
58 #undef rlim_t 57 #undef rlim_t
59 #undef ssize_t 58 #undef ssize_t
60 #undef uid_t
61 #undef vfork 59 #undef vfork
62 #include "tconfig.h" 60 #include "tconfig.h"
63 #include "tsystem.h" 61 #include "tsystem.h"
64 #include "coretypes.h" 62 #include "coretypes.h"
65 #include "tm.h" 63 #include "tm.h"
77 asm (SECTION_OP); \ 75 asm (SECTION_OP); \
78 FUNC (); \ 76 FUNC (); \
79 FORCE_CODE_SECTION_ALIGN \ 77 FORCE_CODE_SECTION_ALIGN \
80 asm (TEXT_SECTION_ASM_OP); \ 78 asm (TEXT_SECTION_ASM_OP); \
81 } 79 }
80 #endif
81
82 #if defined(OBJECT_FORMAT_ELF) \
83 && !defined(OBJECT_FORMAT_FLAT) \
84 && defined(HAVE_LD_EH_FRAME_HDR) \
85 && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
86 && defined(__FreeBSD__) && __FreeBSD__ >= 7
87 #include <link.h>
88 # define USE_PT_GNU_EH_FRAME
82 #endif 89 #endif
83 90
84 #if defined(OBJECT_FORMAT_ELF) \ 91 #if defined(OBJECT_FORMAT_ELF) \
85 && !defined(OBJECT_FORMAT_FLAT) \ 92 && !defined(OBJECT_FORMAT_FLAT) \
86 && defined(HAVE_LD_EH_FRAME_HDR) \ 93 && defined(HAVE_LD_EH_FRAME_HDR) \
126 133
127 So, we take an approach similar to #pragma weak -- we have a second 134 So, we take an approach similar to #pragma weak -- we have a second
128 declaration for functions that we want to have weak references. 135 declaration for functions that we want to have weak references.
129 136
130 Neither way is particularly good. */ 137 Neither way is particularly good. */
131 138
132 /* References to __register_frame_info and __deregister_frame_info should 139 /* References to __register_frame_info and __deregister_frame_info should
133 be weak in this file if at all possible. */ 140 be weak in this file if at all possible. */
134 extern void __register_frame_info (const void *, struct object *) 141 extern void __register_frame_info (const void *, struct object *)
135 TARGET_ATTRIBUTE_WEAK; 142 TARGET_ATTRIBUTE_WEAK;
136 extern void __register_frame_info_bases (const void *, struct object *, 143 extern void __register_frame_info_bases (const void *, struct object *,
245 /* The __cxa_finalize function may not be available so we use only a 252 /* The __cxa_finalize function may not be available so we use only a
246 weak declaration. */ 253 weak declaration. */
247 extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK; 254 extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK;
248 255
249 /* Run all the global destructors on exit from the program. */ 256 /* Run all the global destructors on exit from the program. */
250 257
251 /* Some systems place the number of pointers in the first word of the 258 /* Some systems place the number of pointers in the first word of the
252 table. On SVR4 however, that word is -1. In all cases, the table is 259 table. On SVR4 however, that word is -1. In all cases, the table is
253 null-terminated. On SVR4, we start from the beginning of the list and 260 null-terminated. On SVR4, we start from the beginning of the list and
254 invoke each per-compilation-unit destructor routine in order 261 invoke each per-compilation-unit destructor routine in order
255 until we find that null. 262 until we find that null.
325 } 332 }
326 333
327 /* Stick a call to __do_global_dtors_aux into the .fini section. */ 334 /* Stick a call to __do_global_dtors_aux into the .fini section. */
328 #ifdef FINI_SECTION_ASM_OP 335 #ifdef FINI_SECTION_ASM_OP
329 CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux) 336 CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
330 #else /* !defined(FINI_SECTION_ASM_OP) */ 337 #elif defined (FINI_ARRAY_SECTION_ASM_OP)
331 static func_ptr __do_global_dtors_aux_fini_array_entry[] 338 static func_ptr __do_global_dtors_aux_fini_array_entry[]
332 __attribute__ ((__unused__, section(".fini_array"))) 339 __attribute__ ((__unused__, section(".fini_array")))
333 = { __do_global_dtors_aux }; 340 = { __do_global_dtors_aux };
334 #endif /* !defined(FINI_SECTION_ASM_OP) */ 341 #else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
342 static void __attribute__((used))
343 __do_global_dtors_aux_1 (void)
344 {
345 atexit (__do_global_dtors_aux);
346 }
347 CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_dtors_aux_1)
348 #endif
335 349
336 #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME) 350 #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
337 /* Stick a call to __register_frame_info into the .init section. For some 351 /* Stick a call to __register_frame_info into the .init section. For some
338 reason calls with no arguments work more reliably in .init, so stick the 352 reason calls with no arguments work more reliably in .init, so stick the
339 call in another function. */ 353 call in another function. */
530 = { 0 }; 544 = { 0 };
531 #endif /* EH_FRAME_SECTION_NAME */ 545 #endif /* EH_FRAME_SECTION_NAME */
532 546
533 #ifdef JCR_SECTION_NAME 547 #ifdef JCR_SECTION_NAME
534 /* Null terminate the .jcr section array. */ 548 /* Null terminate the .jcr section array. */
535 STATIC void *__JCR_END__[1] 549 STATIC void *__JCR_END__[1]
536 __attribute__ ((unused, section(JCR_SECTION_NAME), 550 __attribute__ ((unused, section(JCR_SECTION_NAME),
537 aligned(sizeof(void *)))) 551 aligned(sizeof(void *))))
538 = { 0 }; 552 = { 0 };
539 #endif /* JCR_SECTION_NAME */ 553 #endif /* JCR_SECTION_NAME */
540 554