Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Set constructor/destructor priority to 1000
  • Loading branch information
H.J. Lu committed Nov 16, 2012
1 parent 0266565 commit bcbf983
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2012-11-16 H.J. Lu <hongjiu.lu@intel.com>

* elf/tst-array1.c (init): Set constructor priority to 1000.
(fini): Set destructor priority to 1000.
* elf/tst-array2dep.c: Likewise.

2012-11-16 Siddhesh Poyarekar <siddhesh@redhat.com>

[BZ #11741]
Expand Down
6 changes: 4 additions & 2 deletions elf/tst-array1.c
@@ -1,14 +1,16 @@
#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)
{
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)
Expand Down
6 changes: 4 additions & 2 deletions elf/tst-array2dep.c
@@ -1,14 +1,16 @@
#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)
{
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)
Expand Down

0 comments on commit bcbf983

Please sign in to comment.