aboutsummaryrefslogtreecommitdiff
path: root/elf/tst-array1.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-11-07 22:28:16 +0000
committerRoland McGrath <roland@gnu.org>2002-11-07 22:28:16 +0000
commitdfe4c900cb1d03533702c453c3a9abe6d41e545d (patch)
tree3abdeee7d6276ec401eed3b7ed19772baaa8b8a0 /elf/tst-array1.c
parent1d8a0fd965535f5c48cfb1e0b9d4fb8596190cd6 (diff)
downloadglibc-dfe4c900cb1d03533702c453c3a9abe6d41e545d.tar
glibc-dfe4c900cb1d03533702c453c3a9abe6d41e545d.tar.gz
glibc-dfe4c900cb1d03533702c453c3a9abe6d41e545d.tar.bz2
glibc-dfe4c900cb1d03533702c453c3a9abe6d41e545d.zip
* sysdeps/ia64/elf/initfini.c [HAVE_INITFINI_ARRAY]
(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.
Diffstat (limited to 'elf/tst-array1.c')
-rw-r--r--elf/tst-array1.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/elf/tst-array1.c b/elf/tst-array1.c
new file mode 100644
index 0000000000..86ed4a1a63
--- /dev/null
+++ b/elf/tst-array1.c
@@ -0,0 +1,99 @@
+#include <unistd.h>
+
+static void init (void) __attribute__ ((constructor));
+
+static void
+init (void)
+{
+ write (STDOUT_FILENO, "init\n", 5);
+}
+
+static void fini (void) __attribute__ ((destructor));
+
+static void
+fini (void)
+{
+ write (STDOUT_FILENO, "fini\n", 5);
+}
+
+static void
+preinit_0 (void)
+{
+ write (STDOUT_FILENO, "preinit array 0\n", 16);
+}
+
+static void
+preinit_1 (void)
+{
+ write (STDOUT_FILENO, "preinit array 1\n", 16);
+}
+
+static void
+preinit_2 (void)
+{
+ write (STDOUT_FILENO, "preinit array 2\n", 16);
+}
+
+void (*const preinit_array []) (void)
+ __attribute__ ((section (".preinit_array"))) =
+{
+ &preinit_0,
+ &preinit_1,
+ &preinit_2
+};
+
+static void
+init_0 (void)
+{
+ write (STDOUT_FILENO, "init array 0\n", 13);
+}
+
+static void
+init_1 (void)
+{
+ write (STDOUT_FILENO, "init array 1\n", 13);
+}
+
+static void
+init_2 (void)
+{
+ write (STDOUT_FILENO, "init array 2\n", 13);
+}
+
+void (*const init_array []) (void) __attribute__ ((section (".init_array"))) =
+{
+ &init_0,
+ &init_1,
+ &init_2
+};
+
+static void
+fini_0 (void)
+{
+ write (STDOUT_FILENO, "fini array 0\n", 13);
+}
+
+static void
+fini_1 (void)
+{
+ write (STDOUT_FILENO, "fini array 1\n", 13);
+}
+
+static void
+fini_2 (void)
+{
+ write (STDOUT_FILENO, "fini array 2\n", 13);
+}
+
+void (*const fini_array []) (void) __attribute__ ((section (".fini_array"))) =
+{
+ &fini_0,
+ &fini_1,
+ &fini_2
+};
+
+int
+main (void)
+{
+ return 0;
+}