--- /dev/null
+/* { dg-do run { target init_priority } } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-flto -O3" } */
+/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
+/* { dg-additional-options -DCDTOR_LINKAGE=static } */
+
+#include "initpri1.c"
/* { dg-require-effective-target lto } */
/* { dg-options "-flto -O3" } */
/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
+/* { dg-additional-options -DCDTOR_LINKAGE= } */
#include "initpri1.c"
--- /dev/null
+/* { dg-do run { target init_priority } } */
+/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
+/* { dg-additional-sources {initpri1_part_c1.c initpri1_part_c2.c initpri1_part_c3.c initpri1_part_d1.c initpri1_part_d2.c initpri1_part_d3.c initpri1_part_cd4.c initpri1_part_main.c} } */
+/* { dg-additional-options -DCDTOR_LINKAGE=static } */
/* { dg-do run { target init_priority } } */
/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
/* { dg-additional-sources {initpri1_part_c1.c initpri1_part_c2.c initpri1_part_c3.c initpri1_part_d1.c initpri1_part_d2.c initpri1_part_d3.c initpri1_part_cd4.c initpri1_part_main.c} } */
+/* { dg-additional-options -DCDTOR_LINKAGE= } */
--- /dev/null
+/* { dg-do run { target init_priority } } */
+/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
+/* { dg-additional-options -DCDTOR_LINKAGE=static } */
+
+#include "initpri1.c"
/* { dg-do run { target init_priority } } */
/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */
+/* { dg-additional-options -DCDTOR_LINKAGE= } */
#include "initpri1_part_c1.c"
extern int i;
+CDTOR_LINKAGE
void c1() __attribute__((constructor (500)));
+CDTOR_LINKAGE
void c1() {
if (i++ != 0)
__builtin_abort ();
extern int i;
+CDTOR_LINKAGE
void c2() __attribute__((constructor (700)));
+CDTOR_LINKAGE
void c2() {
if (i++ != 2)
__builtin_abort ();
extern int i;
+CDTOR_LINKAGE
void c3() __attribute__((constructor (600)));
+CDTOR_LINKAGE
void c3() {
if (i++ != 1)
__builtin_abort ();
extern int i;
extern int j;
+CDTOR_LINKAGE
void cd4() __attribute__((constructor (800), destructor (800)));
+CDTOR_LINKAGE
void cd4() {
if (i != 3)
__builtin_abort ();
extern int i;
+CDTOR_LINKAGE
void d1() __attribute__((destructor (500)));
+CDTOR_LINKAGE
void d1() {
if (--i != 0)
__builtin_abort ();
extern int i;
+CDTOR_LINKAGE
void d2() __attribute__((destructor (700)));
+CDTOR_LINKAGE
void d2() {
if (--i != 2)
__builtin_abort ();
extern int i;
extern int j;
+CDTOR_LINKAGE
void d3() __attribute__((destructor (600)));
+CDTOR_LINKAGE
void d3() {
if (j != 2)
__builtin_abort ();