2002-11-07 22:28:16 +00:00
|
|
|
#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);
|
|
|
|
}
|
|
|
|
|
2012-10-30 07:58:04 +00:00
|
|
|
void (*init_array []) (void)
|
2002-12-10 23:28:48 +00:00
|
|
|
__attribute__ ((section (".init_array"), aligned (sizeof (void *)))) =
|
2002-11-07 22:28:16 +00:00
|
|
|
{
|
|
|
|
&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);
|
|
|
|
}
|
|
|
|
|
2012-10-30 07:58:04 +00:00
|
|
|
void (*fini_array []) (void)
|
2002-12-10 23:28:48 +00:00
|
|
|
__attribute__ ((section (".fini_array"), aligned (sizeof (void *)))) =
|
2002-11-07 22:28:16 +00:00
|
|
|
{
|
|
|
|
&fini_0,
|
|
|
|
&fini_1,
|
|
|
|
&fini_2
|
|
|
|
};
|