mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 12:59:21 +08:00
437c5c5085
This define is only used by newlib internally, so stop exporting it as HAVE_INITFINI_ARRAY since this can conflict with defines packages use themselves. We don't really need to add _ to HAVE_INIT_FINI too since it isn't exported in newlib.h, but might as well be consistent here. We can't (easily) add this to newlib_cflags like HAVE_INIT_FINI is because this is based on a compile-time test in the top configure, not on plain shell code in configure.host. We'd have to replicate the test in every subdir in order to have it passed down.
48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
/*
|
|
* Copyright (C) 2004 CodeSourcery, LLC
|
|
*
|
|
* Permission to use, copy, modify, and distribute this file
|
|
* for any purpose is hereby granted without fee, provided that
|
|
* the above copyright notice and this notice appears in all
|
|
* copies.
|
|
*
|
|
* This file is distributed WITHOUT ANY WARRANTY; without even the implied
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
*/
|
|
|
|
/* Handle ELF .{pre_init,init,fini}_array sections. */
|
|
#include <sys/types.h>
|
|
|
|
#ifdef _HAVE_INITFINI_ARRAY
|
|
|
|
/* These magic symbols are provided by the linker. */
|
|
extern void (*__preinit_array_start []) (void) __attribute__((weak));
|
|
extern void (*__preinit_array_end []) (void) __attribute__((weak));
|
|
extern void (*__init_array_start []) (void) __attribute__((weak));
|
|
extern void (*__init_array_end []) (void) __attribute__((weak));
|
|
|
|
#ifdef _HAVE_INIT_FINI
|
|
extern void _init (void);
|
|
#endif
|
|
|
|
/* Iterate over all the init routines. */
|
|
void
|
|
__libc_init_array (void)
|
|
{
|
|
size_t count;
|
|
size_t i;
|
|
|
|
count = __preinit_array_end - __preinit_array_start;
|
|
for (i = 0; i < count; i++)
|
|
__preinit_array_start[i] ();
|
|
|
|
#ifdef _HAVE_INIT_FINI
|
|
_init ();
|
|
#endif
|
|
|
|
count = __init_array_end - __init_array_start;
|
|
for (i = 0; i < count; i++)
|
|
__init_array_start[i] ();
|
|
}
|
|
#endif
|