diff options
author | Richard Henderson <rth@redhat.com> | 2001-08-09 15:33:35 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2001-08-09 15:33:35 -0700 |
commit | 2cc07db4b089b8b3df05261f1d7acbc96d2e720a (patch) | |
tree | ddb2d5519f49bc33648c25225b8b8ba84df590b9 /gcc/config/arm | |
parent | ef8d8b8922a034dfac5cff9d5fa781dc57c49ed0 (diff) | |
download | gcc-2cc07db4b089b8b3df05261f1d7acbc96d2e720a.tar.gz |
Move constructor/destructor handling into target hooks.
From-SVN: r44747
Diffstat (limited to 'gcc/config/arm')
-rw-r--r-- | gcc/config/arm/aof.h | 58 | ||||
-rw-r--r-- | gcc/config/arm/coff.h | 52 | ||||
-rw-r--r-- | gcc/config/arm/elf.h | 84 |
3 files changed, 4 insertions, 190 deletions
diff --git a/gcc/config/arm/aof.h b/gcc/config/arm/aof.h index 3b0baf57ac5..2721b8bbdeb 100644 --- a/gcc/config/arm/aof.h +++ b/gcc/config/arm/aof.h @@ -60,12 +60,10 @@ char *aof_text_section (); char *aof_data_section (); #define DATA_SECTION_ASM_OP aof_data_section () -#define EXTRA_SECTIONS in_zero_init, in_ctor, in_dtor, in_common +#define EXTRA_SECTIONS in_zero_init, in_common #define EXTRA_SECTION_FUNCTIONS \ ZERO_INIT_SECTION \ -CTOR_SECTION \ -DTOR_SECTION \ COMMON_SECTION #define ZERO_INIT_SECTION \ @@ -81,44 +79,6 @@ zero_init_section () \ } \ } -#define CTOR_SECTION \ -void \ -ctor_section () \ -{ \ - static int ctors_once = 0; \ - if (in_section != in_ctor) \ - { \ - if (ctors_once) \ - { \ - fprintf (stderr, \ - "Attempt to output more than one ctor section\n"); \ - abort (); \ - } \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctor; \ - ctors_once = 1; \ - } \ -} - -#define DTOR_SECTION \ -void \ -dtor_section () \ -{ \ - static int dtors_once = 0; \ - if (in_section != in_dtor) \ - { \ - if (dtors_once) \ - { \ - fprintf (stderr, \ - "Attempt to output more than one dtor section\n"); \ - abort (); \ - } \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtor; \ - dtors_once = 1; \ - } \ -} - /* Used by ASM_OUTPUT_COMMON (below) to tell varasm.c that we've changed areas. */ #define COMMON_SECTION \ @@ -364,22 +324,6 @@ do { \ #define CTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_ctorsvec|, DATA, READONLY" #define DTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_dtorsvec|, DATA, READONLY" -#define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \ -do { \ - ctor_section (); \ - fprintf ((STREAM), "\tDCD\t"); \ - assemble_name ((STREAM), (NAME)); \ - fputc ('\n', (STREAM)); \ -} while (0); - -#define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \ -do { \ - dtor_section (); \ - fprintf ((STREAM), "\tDCD\t"); \ - assemble_name ((STREAM), (NAME)); \ - fputc ('\n', (STREAM)); \ -} while (0); - /* Output of Assembler Instructions */ #define REGISTER_NAMES \ diff --git a/gcc/config/arm/coff.h b/gcc/config/arm/coff.h index 11cb9bb1fca..db057b917a3 100644 --- a/gcc/config/arm/coff.h +++ b/gcc/config/arm/coff.h @@ -89,7 +89,7 @@ Boston, MA 02111-1307, USA. */ given time. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata, in_ctors, in_dtors +#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata #define SUBTARGET_EXTRA_SECTIONS @@ -98,8 +98,6 @@ Boston, MA 02111-1307, USA. */ #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ RDATA_SECTION_FUNCTION \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION \ SUBTARGET_EXTRA_SECTION_FUNCTIONS #define SUBTARGET_EXTRA_SECTION_FUNCTIONS @@ -114,59 +112,11 @@ rdata_section () \ in_section = in_rdata; \ } \ } - -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} - -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} /* Support the ctors/dtors sections for g++. */ #define INT_ASM_OP "\t.word\t" -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#undef ASM_OUTPUT_CONSTRUCTOR -#define ASM_OUTPUT_CONSTRUCTOR(STREAM, NAME) \ - do \ - { \ - ctors_section (); \ - fprintf (STREAM, "%s", INT_ASM_OP); \ - assemble_name (STREAM, NAME); \ - fprintf (STREAM, "\n"); \ - } \ - while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#undef ASM_OUTPUT_DESTRUCTOR -#define ASM_OUTPUT_DESTRUCTOR(STREAM, NAME) \ - do \ - { \ - dtors_section (); \ - fprintf (STREAM, "%s", INT_ASM_OP); \ - assemble_name (STREAM, NAME); \ - fprintf (STREAM, "\n"); \ - } \ - while (0) - /* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */ #define CTOR_LISTS_DEFINED_EXTERNALLY diff --git a/gcc/config/arm/elf.h b/gcc/config/arm/elf.h index 102b53ae0c7..0c8cd03abb9 100644 --- a/gcc/config/arm/elf.h +++ b/gcc/config/arm/elf.h @@ -227,30 +227,6 @@ Boston, MA 02111-1307, USA. */ while (0) #endif -/* Support the ctors/dtors and other sections. */ - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ -#ifndef CTORS_SECTION_ASM_OP -#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\"" -#endif - -#ifndef DTORS_SECTION_ASM_OP -#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\"" -#endif - /* A list of other sections which the compiler might be "in" at any given time. */ #ifndef SUBTARGET_EXTRA_SECTIONS @@ -258,7 +234,7 @@ Boston, MA 02111-1307, USA. */ #endif #ifndef EXTRA_SECTIONS -#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_ctors, in_dtors +#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS #endif /* A list of extra section function definitions. */ @@ -268,35 +244,7 @@ Boston, MA 02111-1307, USA. */ #ifndef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - SUBTARGET_EXTRA_SECTION_FUNCTIONS \ - CTORS_SECTION_FUNCTION \ - DTORS_SECTION_FUNCTION -#endif - -#ifndef CTORS_SECTION_FUNCTION -#define CTORS_SECTION_FUNCTION \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} -#endif - -#ifndef DTORS_SECTION_FUNCTION -#define DTORS_SECTION_FUNCTION \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ -} + SUBTARGET_EXTRA_SECTION_FUNCTIONS #endif /* Switch into a generic section. */ @@ -308,34 +256,6 @@ dtors_section () \ #define INT_ASM_OP "\t.word\t" #endif -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#ifndef ASM_OUTPUT_CONSTRUCTOR -#define ASM_OUTPUT_CONSTRUCTOR(STREAM, NAME) \ - do \ - { \ - ctors_section (); \ - fprintf (STREAM, "%s", INT_ASM_OP); \ - assemble_name (STREAM, NAME); \ - fprintf (STREAM, "\n"); \ - } \ - while (0) -#endif - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#ifndef ASM_OUTPUT_DESTRUCTOR -#define ASM_OUTPUT_DESTRUCTOR(STREAM, NAME) \ - do \ - { \ - dtors_section (); \ - fprintf (STREAM, "%s", INT_ASM_OP); \ - assemble_name (STREAM, NAME); \ - fprintf (STREAM, "\n"); \ - } \ - while (0) -#endif - /* This is how we tell the assembler that a symbol is weak. */ #define ASM_WEAKEN_LABEL(FILE, NAME) \ |