mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-11 07:40:05 +00:00
dfe4c900cb
(gmon_initializer): New function. (.init prologue): If HAVE_INITFINI_ARRAY is true, don't call __gmon_start__ here. Call it from gmon_initializer() instead. 2002-03-12 H.J. Lu <hjl@gnu.org> * elf/Makefile [$(have-initfini-array) = yes] (tests): Add tst-array1, tst-array2, and tst-array3. [$(have-initfini-array) = yes] (tests-static): Add tst-array3. [$(have-initfini-array) = yes] (modules-names): Add tst-array2dep. ($(objpfx)tst-array1.out): New target. ($(objpfx)tst-array2): Likewise. ($(objpfx)tst-array2.out): Likewise. ($(objpfx)tst-array3.out): Likewise. * elf/tst-array1.c: New file. * elf/tst-array1.exp: Likewise. * elf/tst-array2.c: Likewise. * elf/tst-array2dep.c: Likewise. * elf/tst-array2.exp: Likewise. * elf/tst-array3.c: Likewise.
68 lines
999 B
C
68 lines
999 B
C
#include <unistd.h>
|
|
|
|
static void init (void) __attribute__ ((constructor));
|
|
|
|
static void
|
|
init (void)
|
|
{
|
|
write (STDOUT_FILENO, "DSO init\n", 9);
|
|
}
|
|
|
|
static void fini (void) __attribute__ ((destructor));
|
|
|
|
static void
|
|
fini (void)
|
|
{
|
|
write (STDOUT_FILENO, "DSO fini\n", 9);
|
|
}
|
|
|
|
static void
|
|
init_0 (void)
|
|
{
|
|
write (STDOUT_FILENO, "DSO init array 0\n", 17);
|
|
}
|
|
|
|
static void
|
|
init_1 (void)
|
|
{
|
|
write (STDOUT_FILENO, "DSO init array 1\n", 17);
|
|
}
|
|
|
|
static void
|
|
init_2 (void)
|
|
{
|
|
write (STDOUT_FILENO, "DSO init array 2\n", 17);
|
|
}
|
|
|
|
void (*const init_array []) (void) __attribute__ ((section (".init_array"))) =
|
|
{
|
|
&init_0,
|
|
&init_1,
|
|
&init_2
|
|
};
|
|
|
|
static void
|
|
fini_0 (void)
|
|
{
|
|
write (STDOUT_FILENO, "DSO fini array 0\n", 17);
|
|
}
|
|
|
|
static void
|
|
fini_1 (void)
|
|
{
|
|
write (STDOUT_FILENO, "DSO fini array 1\n", 17);
|
|
}
|
|
|
|
static void
|
|
fini_2 (void)
|
|
{
|
|
write (STDOUT_FILENO, "DSO fini array 2\n", 17);
|
|
}
|
|
|
|
void (*const fini_array []) (void) __attribute__ ((section (".fini_array"))) =
|
|
{
|
|
&fini_0,
|
|
&fini_1,
|
|
&fini_2
|
|
};
|