1
/* initpri1.c -- test constructor priorities.
3
Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
4
Copied from the gcc testsuite, where the test was contributed by
5
Mark Mitchell <mark@codesourcery.com>.
7
This file is part of gold.
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 3 of the License, or
12
(at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22
MA 02110-1301, USA. */
24
/* This tests that the linker handles constructor and destructor
25
priorities correctly. */
29
/* Constructor priorities in attributes were added in gcc 4.3. */
30
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)
35
void c1(void) __attribute__((constructor (500)));
36
void c2(void) __attribute__((constructor (700)));
37
void c3(void) __attribute__((constructor (600)));
54
void d1(void) __attribute__((destructor (500)));
55
void d2(void) __attribute__((destructor (700)));
56
void d3(void) __attribute__((destructor (600)));
75
void cd4(void) __attribute__((constructor (800), destructor (800)));
83
void cd5(void) __attribute__((constructor, destructor));
99
#else /* !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) */
105
#endif /* !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) */