310fd250b9
bfd/ 2011-05-07 H.J. Lu <hongjiu.lu@intel.com> PR ld/12730 * elf.c (_bfd_elf_section_offset): Check SEC_ELF_REVERSE_COPY. * elflink.c (elf_link_input_bfd): Reverse copy .ctors/.dtors sections if needed. * section.c (SEC_ELF_REVERSE_COPY): New. * bfd-in2.h: Regenerated. ld/testsuite/ 2011-05-07 H.J. Lu <hongjiu.lu@intel.com> PR ld/12730 * ld-elf/elf.exp (array_tests): Add "pr12730". (array_tests_pie): New. (array_tests_static): Add -static for "static init array mixed". Add "static pr12730". Run array_tests_pie for Linux. * ld-elf/init-mixed.c (ctor1007): Renamed to ... (ctor1007a): This. (ctor1007b): New. (ctors1007): Remove ctor1007. Add ctor1007b and ctor1007a. (dtor1007): Renamed to ... (dtor1007a): This. (dtor1007b): New. (dtors1007): Remove dtor1007. Add dtor1007b and dtor1007a. (ctor65535): Renamed to ... (ctor65535a): This. (ctor65535b): New. (ctors65535): Remove ctor65535. Add ctor65535b and ctor65535a. (dtor65535): Renamed to ... (dtor65535a): This. (dtor65535b): New. (dtors65535): Remove dtor65535. Add dtor65535b and dtor65535a. * ld-elf/pr12730.cc: New. * ld-elf/pr12730.out: Likewise.
126 lines
2.1 KiB
C
126 lines
2.1 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "config.h"
|
|
|
|
#ifdef HAVE_INITFINI_ARRAY
|
|
static int count;
|
|
|
|
static void
|
|
init1005 ()
|
|
{
|
|
if (count != 0)
|
|
abort ();
|
|
count = 1005;
|
|
}
|
|
void (*const init_array1005[]) ()
|
|
__attribute__ ((section (".init_array.01005"), aligned (sizeof (void *))))
|
|
= { init1005 };
|
|
static void
|
|
fini1005 ()
|
|
{
|
|
if (count != 1005)
|
|
abort ();
|
|
}
|
|
void (*const fini_array1005[]) ()
|
|
__attribute__ ((section (".fini_array.01005"), aligned (sizeof (void *))))
|
|
= { fini1005 };
|
|
|
|
static void
|
|
ctor1007a ()
|
|
{
|
|
if (count != 1005)
|
|
abort ();
|
|
count = 1006;
|
|
}
|
|
static void
|
|
ctor1007b ()
|
|
{
|
|
if (count != 1006)
|
|
abort ();
|
|
count = 1007;
|
|
}
|
|
void (*const ctors1007[]) ()
|
|
__attribute__ ((section (".ctors.64528"), aligned (sizeof (void *))))
|
|
= { ctor1007b, ctor1007a };
|
|
static void
|
|
dtor1007a ()
|
|
{
|
|
if (count != 1006)
|
|
abort ();
|
|
count = 1005;
|
|
}
|
|
static void
|
|
dtor1007b ()
|
|
{
|
|
if (count != 1007)
|
|
abort ();
|
|
count = 1006;
|
|
}
|
|
void (*const dtors1007[]) ()
|
|
__attribute__ ((section (".dtors.64528"), aligned (sizeof (void *))))
|
|
= { dtor1007b, dtor1007a };
|
|
|
|
static void
|
|
init65530 ()
|
|
{
|
|
if (count != 1007)
|
|
abort ();
|
|
count = 65530;
|
|
}
|
|
void (*const init_array65530[]) ()
|
|
__attribute__ ((section (".init_array.65530"), aligned (sizeof (void *))))
|
|
= { init65530 };
|
|
static void
|
|
fini65530 ()
|
|
{
|
|
if (count != 65530)
|
|
abort ();
|
|
count = 1007;
|
|
}
|
|
void (*const fini_array65530[]) ()
|
|
__attribute__ ((section (".fini_array.65530"), aligned (sizeof (void *))))
|
|
= { fini65530 };
|
|
|
|
static void
|
|
ctor65535a ()
|
|
{
|
|
if (count != 65530)
|
|
abort ();
|
|
count = 65535;
|
|
}
|
|
static void
|
|
ctor65535b ()
|
|
{
|
|
if (count != 65535)
|
|
abort ();
|
|
count = 65536;
|
|
}
|
|
void (*const ctors65535[]) ()
|
|
__attribute__ ((section (".ctors"), aligned (sizeof (void *))))
|
|
= { ctor65535b, ctor65535a };
|
|
static void
|
|
dtor65535b ()
|
|
{
|
|
if (count != 65536)
|
|
abort ();
|
|
count = 65535;
|
|
}
|
|
static void
|
|
dtor65535a ()
|
|
{
|
|
if (count != 65535)
|
|
abort ();
|
|
count = 65530;
|
|
}
|
|
void (*const dtors65535[]) ()
|
|
__attribute__ ((section (".dtors"), aligned (sizeof (void *))))
|
|
= { dtor65535b, dtor65535a };
|
|
#endif
|
|
|
|
int
|
|
main ()
|
|
{
|
|
printf ("OK\n");
|
|
return 0;
|
|
}
|