aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-11-16 07:40:38 -0800
committerH.J. Lu <hjl.tools@gmail.com>2012-11-16 07:40:38 -0800
commitbcbf9830b735acdd9b0d49fe96da73dfacfa17d0 (patch)
tree0598b36a2e94ac5511eddd3485a86889c61ab6ad /elf
parent02665652d74808a2d20a4f6f8a6f98bddb669464 (diff)
downloadglibc-bcbf9830b735acdd9b0d49fe96da73dfacfa17d0.zip
glibc-bcbf9830b735acdd9b0d49fe96da73dfacfa17d0.tar.gz
glibc-bcbf9830b735acdd9b0d49fe96da73dfacfa17d0.tar.bz2
Set constructor/destructor priority to 1000
Diffstat (limited to 'elf')
-rw-r--r--elf/tst-array1.c6
-rw-r--r--elf/tst-array2dep.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/elf/tst-array1.c b/elf/tst-array1.c
index ca9bdf4..e998932 100644
--- a/elf/tst-array1.c
+++ b/elf/tst-array1.c
@@ -1,6 +1,7 @@
#include <unistd.h>
-static void init (void) __attribute__ ((constructor));
+/* Give init non-default priority so that it runs before init_array. */
+static void init (void) __attribute__ ((constructor (1000)));
static void
init (void)
@@ -8,7 +9,8 @@ init (void)
write (STDOUT_FILENO, "init\n", 5);
}
-static void fini (void) __attribute__ ((destructor));
+/* Give fini the same priority as init. */
+static void fini (void) __attribute__ ((destructor (1000)));
static void
fini (void)
diff --git a/elf/tst-array2dep.c b/elf/tst-array2dep.c
index 2812761..2f920cd 100644
--- a/elf/tst-array2dep.c
+++ b/elf/tst-array2dep.c
@@ -1,6 +1,7 @@
#include <unistd.h>
-static void init (void) __attribute__ ((constructor));
+/* Give init non-default priority so that it runs before init_array. */
+static void init (void) __attribute__ ((constructor (1000)));
static void
init (void)
@@ -8,7 +9,8 @@ init (void)
write (STDOUT_FILENO, "DSO init\n", 9);
}
-static void fini (void) __attribute__ ((destructor));
+/* Give fini the same priority as init. */
+static void fini (void) __attribute__ ((destructor (1000)));
static void
fini (void)