aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2001-08-09 15:33:35 -0700
committerRichard Henderson <rth@gcc.gnu.org>2001-08-09 15:33:35 -0700
commit2cc07db4b089b8b3df05261f1d7acbc96d2e720a (patch)
treeddb2d5519f49bc33648c25225b8b8ba84df590b9 /gcc/config
parentef8d8b8922a034dfac5cff9d5fa781dc57c49ed0 (diff)
downloadgcc-2cc07db4b089b8b3df05261f1d7acbc96d2e720a.zip
gcc-2cc07db4b089b8b3df05261f1d7acbc96d2e720a.tar.gz
gcc-2cc07db4b089b8b3df05261f1d7acbc96d2e720a.tar.bz2
Move constructor/destructor handling into target hooks.
From-SVN: r44747
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/1750a/1750a.h8
-rw-r--r--gcc/config/a29k/a29k.c2
-rw-r--r--gcc/config/a29k/udi.h94
-rw-r--r--gcc/config/alpha/alpha-interix.h48
-rw-r--r--gcc/config/alpha/alpha.c27
-rw-r--r--gcc/config/alpha/elf.h47
-rw-r--r--gcc/config/alpha/vms.h44
-rw-r--r--gcc/config/arc/arc.h22
-rw-r--r--gcc/config/arm/aof.h58
-rw-r--r--gcc/config/arm/coff.h52
-rw-r--r--gcc/config/arm/elf.h84
-rw-r--r--gcc/config/c4x/c4x.c4
-rw-r--r--gcc/config/c4x/c4x.h87
-rw-r--r--gcc/config/clipper/clipper.c22
-rw-r--r--gcc/config/clipper/clix.h25
-rw-r--r--gcc/config/d30v/d30v.h23
-rw-r--r--gcc/config/darwin-protos.h2
-rw-r--r--gcc/config/darwin.c30
-rw-r--r--gcc/config/darwin.h29
-rw-r--r--gcc/config/elfos.h73
-rw-r--r--gcc/config/h8300/h8300.h43
-rw-r--r--gcc/config/i386/aix386.h9
-rw-r--r--gcc/config/i386/aix386ng.h4
-rw-r--r--gcc/config/i386/cygwin.h46
-rw-r--r--gcc/config/i386/djgpp.h54
-rw-r--r--gcc/config/i386/i386-coff.h62
-rw-r--r--gcc/config/i386/i386-interix.h71
-rw-r--r--gcc/config/i386/i386.c28
-rw-r--r--gcc/config/i386/sco5.h63
-rw-r--r--gcc/config/i386/svr3gas.h94
-rw-r--r--gcc/config/i386/sysv3.h13
-rw-r--r--gcc/config/i386/vsta.h48
-rw-r--r--gcc/config/i386/win32.h46
-rw-r--r--gcc/config/i960/i960-coff.h55
-rw-r--r--gcc/config/ia64/sysv4.h44
-rw-r--r--gcc/config/lynx.h26
-rw-r--r--gcc/config/m68hc11/m68hc11.c20
-rw-r--r--gcc/config/m68hc11/m68hc11.h30
-rw-r--r--gcc/config/m68k/auxgas.h2
-rw-r--r--gcc/config/m68k/coff.h60
-rw-r--r--gcc/config/m68k/dpx2.h34
-rw-r--r--gcc/config/m68k/dpx2g.h50
-rw-r--r--gcc/config/m68k/m68k.c20
-rw-r--r--gcc/config/m68k/mot3300.h55
-rw-r--r--gcc/config/m68k/tower-as.h17
-rw-r--r--gcc/config/m88k/m88k.c46
-rw-r--r--gcc/config/m88k/m88k.h9
-rw-r--r--gcc/config/m88k/sysv3.h35
-rw-r--r--gcc/config/mcore/mcore-pe.h30
-rw-r--r--gcc/config/mcore/mcore.h30
-rw-r--r--gcc/config/mips/elf.h69
-rw-r--r--gcc/config/mips/elf64.h70
-rw-r--r--gcc/config/mips/iris6.h77
-rw-r--r--gcc/config/mips/mips.h13
-rw-r--r--gcc/config/mips/rtems64.h15
-rw-r--r--gcc/config/mips/vxworks.h17
-rw-r--r--gcc/config/netware.h50
-rw-r--r--gcc/config/nextstep.c21
-rw-r--r--gcc/config/nextstep.h23
-rw-r--r--gcc/config/nextstep21.h4
-rw-r--r--gcc/config/pa/pa64-hpux.h70
-rw-r--r--gcc/config/psos.h71
-rw-r--r--gcc/config/rs6000/aix.h4
-rw-r--r--gcc/config/rs6000/lynx.h4
-rw-r--r--gcc/config/rs6000/sysv4.h51
-rw-r--r--gcc/config/sh/elf.h4
-rw-r--r--gcc/config/sh/sh.h47
-rw-r--r--gcc/config/sparc/linux64.h28
-rw-r--r--gcc/config/sparc/litecoff.h57
-rw-r--r--gcc/config/sparc/sol2-sld-64.h28
-rw-r--r--gcc/config/svr3.h42
-rw-r--r--gcc/config/vax/vax.c35
-rw-r--r--gcc/config/vax/vms.h23
73 files changed, 349 insertions, 2399 deletions
diff --git a/gcc/config/1750a/1750a.h b/gcc/config/1750a/1750a.h
index 72ee543..ac6e7ee 100644
--- a/gcc/config/1750a/1750a.h
+++ b/gcc/config/1750a/1750a.h
@@ -1220,14 +1220,6 @@ enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLA
( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
-#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) do { \
- fprintf(FILE, "\tinit\n\t"); assemble_name(FILE, NAME); \
- fprintf(FILE," ;constructor\n"); } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE, NAME) do { \
- fprintf(FILE, "\tinit\n\t"); assemble_name(FILE, NAME); \
- fprintf(FILE," ;destructor\n"); } while (0)
-
/* Print operand X (an rtx) in assembler syntax to file FILE.
CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
For `%' followed by punctuation, CODE is the punctuation and X is null.
diff --git a/gcc/config/a29k/a29k.c b/gcc/config/a29k/a29k.c
index a4905e6..8d816b2 100644
--- a/gcc/config/a29k/a29k.c
+++ b/gcc/config/a29k/a29k.c
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "rtl.h"
+#include "tree.h"
#include "regs.h"
#include "hard-reg-set.h"
#include "real.h"
@@ -36,7 +37,6 @@ Boston, MA 02111-1307, USA. */
#include "function.h"
#include "expr.h"
#include "obstack.h"
-#include "tree.h"
#include "reload.h"
#include "tm_p.h"
#include "target.h"
diff --git a/gcc/config/a29k/udi.h b/gcc/config/a29k/udi.h
deleted file mode 100644
index 1b35bb2..0000000
--- a/gcc/config/a29k/udi.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Definitions of target machine for GNU compiler, for AMD Am29000 CPU
- running over UDI using COFF.
- Copyright (C) 1994, 1996, 2000 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* Support the ctors and dtors sections for g++. */
-
-#define CTORS_SECTION_ASM_OP "\t.use .ctors"
-#define DTORS_SECTION_ASM_OP "\t.use .dtors"
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS readonly_data, in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- READONLY_DATA_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define READONLY_DATA_FUNCTION \
-void \
-literal_section () \
-{ \
- if (in_section != readonly_data) \
- { \
- fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \
- in_section = readonly_data; \
- } \
-} \
-
-#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; \
- } \
-}
-
-#define INT_ASM_OP "\t.word\t"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
diff --git a/gcc/config/alpha/alpha-interix.h b/gcc/config/alpha/alpha-interix.h
index 4bbd988..b396c86 100644
--- a/gcc/config/alpha/alpha-interix.h
+++ b/gcc/config/alpha/alpha-interix.h
@@ -100,7 +100,7 @@ Boston, MA 02111-1307, USA. */
includes this file. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
@@ -108,9 +108,7 @@ Boston, MA 02111-1307, USA. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
+ CONST_SECTION_FUNCTION
#undef READONLY_DATA_SECTION
#define READONLY_DATA_SECTION() const_section ()
@@ -128,50 +126,8 @@ const_section () \
} \
}
-#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; \
- } \
-}
-
#define INT_ASM_OP "\t.long\t"
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* The linker will take care of this, and having them causes problems with
ld -r (specifically -rU). */
#define CTOR_LISTS_DEFINED_EXTERNALLY 1
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 345d95e..ef65d72 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -152,6 +152,8 @@ static int vms_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
static unsigned int vms_section_type_flags PARAMS ((tree, const char *, int));
static void vms_asm_named_section PARAMS ((const char *, unsigned int,
unsigned int));
+static void vms_asm_out_constructor PARAMS ((rtx, int));
+static void vms_asm_out_destructor PARAMS ((rtx, int));
# undef TARGET_VALID_DECL_ATTRIBUTE
# define TARGET_VALID_DECL_ATTRIBUTE vms_valid_decl_attribute_p
# undef TARGET_SECTION_TYPE_FLAGS
@@ -6585,6 +6587,31 @@ vms_asm_named_section (name, flags, align)
ASM_OUTPUT_ALIGN (asm_out_file, 0);
}
+/* Record an element in the table of global constructors. SYMBOL is
+ a SYMBOL_REF of the function to be called; PRIORITY is a number
+ between 0 and MAX_INIT_PRIORITY.
+
+ Differs from default_ctors_section_asm_out_constructor in that the
+ width of the .ctors entry is always 64 bits, rather than the 32 bits
+ used by a normal pointer. */
+
+static void
+vms_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ ctors_section ();
+ assemble_integer (symbol, UNITS_PER_WORD, 1);
+}
+
+static void
+vms_asm_out_destructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ dtors_section ();
+ assemble_integer (symbol, UNITS_PER_WORD, 1);
+}
#else
rtx
diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index a8e8900..c8e7667 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -202,27 +202,6 @@ do { \
#undef CONST_SECTION_ASM_OP
#define CONST_SECTION_ASM_OP "\t.section\t.rodata"
-/* 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.) */
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
-
-/* Handle the small data sections. */
#undef BSS_SECTION_ASM_OP
#define BSS_SECTION_ASM_OP "\t.section\t.bss"
#undef SBSS_SECTION_ASM_OP
@@ -247,7 +226,7 @@ do { \
includes this file. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_sbss, in_sdata
+#define EXTRA_SECTIONS in_const, in_sbss, in_sdata
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
@@ -256,8 +235,6 @@ do { \
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
- SECTION_FUNCTION_TEMPLATE(ctors_section, in_ctors, CTORS_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(dtors_section, in_dtors, DTORS_SECTION_ASM_OP) \
SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
@@ -297,28 +274,6 @@ void FN () \
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\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(FILE, NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
or a constant of some sort. RELOC indicates whether forming
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index bc7e1e6..506223c 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -253,7 +253,7 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
#define DTORS_SECTION_ASM_OP "\t.dtors"
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_link, in_rdata, in_literals, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_link, in_rdata, in_literals
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
@@ -283,31 +283,11 @@ literals_section () \
fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \
in_section = in_literals; \
} \
-} \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-} \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
}
extern void readonly_section PARAMS ((void));
extern void link_section PARAMS ((void));
extern void literals_section PARAMS ((void));
-extern void ctors_section PARAMS ((void));
-extern void dtors_section PARAMS ((void));
#undef ASM_OUTPUT_ADDR_DIFF_ELT
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) abort ()
@@ -373,25 +353,9 @@ do { \
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, -1)
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t.quad "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t.quad "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
+/* Control how constructors and destructors are emitted. */
+#define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
+#define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
#undef SDB_DEBUGGING_INFO
#undef MIPS_DEBUGGING_INFO
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 9a7b270..07507a1 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -1373,28 +1373,6 @@ do { \
that we use). */
#define SET_ASM_OP "\t.set\t"
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
-do { \
- ctors_section (); \
- fprintf (FILE, "\t.word\t%%st("); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ")\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(FILE, NAME) \
-do { \
- dtors_section (); \
- fprintf (FILE, "\t.word\t%%st("); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ")\n"); \
-} while (0)
-
/* How to refer to registers in assembler output.
This sequence is indexed by compiler's hard-register-number (see above). */
#define REGISTER_NAMES \
diff --git a/gcc/config/arm/aof.h b/gcc/config/arm/aof.h
index 3b0baf5..2721b8b 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 11cb9bb..db057b9 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 102b53a..0c8cd03 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) \
diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c
index da2f90d..add05c7 100644
--- a/gcc/config/c4x/c4x.c
+++ b/gcc/config/c4x/c4x.c
@@ -25,8 +25,8 @@ Boston, MA 02111-1307, USA. */
/* Some output-actions in c4x.md need these. */
#include "config.h"
#include "system.h"
-#include "toplev.h"
#include "rtl.h"
+#include "tree.h"
#include "regs.h"
#include "hard-reg-set.h"
#include "basic-block.h"
@@ -35,7 +35,6 @@ Boston, MA 02111-1307, USA. */
#include "insn-attr.h"
#include "conditions.h"
#include "output.h"
-#include "tree.h"
#include "function.h"
#include "expr.h"
#include "flags.h"
@@ -46,6 +45,7 @@ Boston, MA 02111-1307, USA. */
#include "cpplib.h"
#include "c-lex.h"
#include "c-pragma.h"
+#include "toplev.h"
#include "c4x-protos.h"
#include "target.h"
#include "target-def.h"
diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h
index dba5e47..607bc48 100644
--- a/gcc/config/c4x/c4x.h
+++ b/gcc/config/c4x/c4x.h
@@ -1979,48 +1979,14 @@ if (REG_P (OP1) && ! REG_P (OP0)) \
#define FINI_SECTION_ASM_OP "\t.sect\t\".fini\""
-/* Support const sections and the ctors and dtors sections for g++.
- Note that there appears to be two different ways to support const
- sections at the moment. You can either #define the symbol
- READONLY_DATA_SECTION (giving it some code which switches to the
- readonly data section) or else you can #define the symbols
- EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
- SELECT_RTX_SECTION. We do both here just to be on the safe side. */
-
-/* Define a few machine-specific details of the implementation of
- constructors.
-
- The __CTORS_LIST__ goes in the .ctors section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .ctors section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor. */
-
-#define CTORS_SECTION_ASM_OP "\t.sect\t\".ctors\""
-#define DTORS_SECTION_ASM_OP "\t.sect\t\".dtors\""
-
-/* Constructor list on stack is in reverse order. Go to the end of the
- list and go backwards to call constructors in the right order. */
-
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- extern func_ptr __CTOR_LIST__[]; \
- func_ptr *p, *beg = __CTOR_LIST__ + 1; \
- for (p = beg; *p ; p++) ; \
- while (p != beg) \
- (*--p) (); \
-} while (0)
-
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const, in_init, in_fini
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
INIT_SECTION_FUNCTION \
- FINI_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
+ FINI_SECTION_FUNCTION
#define INIT_SECTION_FUNCTION \
void \
@@ -2061,58 +2027,9 @@ const_section () \
#define ASM_STABS_OP "\t.stabs\t"
-/* The ctors and dtors sections are not normally put into use
- by EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS as defined in svr3.h,
- but it can't hurt to define these macros for whatever systems use them. */
-
-#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; \
- } \
-}
-
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION c4x_asm_named_section
-/* This is machine-dependent because it needs to push something
- on the stack. */
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t.word\t "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t.word\t "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
or a constant of some sort. RELOC indicates whether forming
diff --git a/gcc/config/clipper/clipper.c b/gcc/config/clipper/clipper.c
index 1e3118e..d92030d 100644
--- a/gcc/config/clipper/clipper.c
+++ b/gcc/config/clipper/clipper.c
@@ -42,6 +42,8 @@ Boston, MA 02111-1307, USA. */
static void clipper_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void clipper_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void clix_asm_out_constructor PARAMS ((rtx, int));
+static void clix_asm_out_destructor PARAMS ((rtx, int));
extern char regs_ever_live[];
@@ -691,3 +693,23 @@ fp_reg_operand (op, mode)
GET_MODE_CLASS (GET_MODE (SUBREG_REG (op))) == MODE_FLOAT));
}
+static void
+clix_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ init_section ();
+ fputs ("\tloada ", asm_out_file);
+ assemble_name (asm_out_file, XSTR (symbol, 0));
+ fputs (",r0\n\tsubq $8,sp\n\tstorw r0,(sp)\n", asm_out_file);
+}
+
+static void
+clix_asm_out_destructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ fini_section ();
+ assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+ assemble_integer (const0_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
+}
diff --git a/gcc/config/clipper/clix.h b/gcc/config/clipper/clix.h
index 6aedd6e..bce6979 100644
--- a/gcc/config/clipper/clix.h
+++ b/gcc/config/clipper/clix.h
@@ -96,33 +96,16 @@ do { \
#undef CTOR_LIST_END
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fputs ("\tloada ", FILE); \
- assemble_name (FILE, NAME); \
- fputs (",r0\n\tsubq $8,sp\n\tstorw r0,(sp)\n", FILE); \
- } while (0)
-
-
/* fini psect is 8 aligned */
#define DTOR_LIST_BEGIN \
asm (DTORS_SECTION_ASM_OP); \
func_ptr __DTOR_LIST__[2] = { (func_ptr) (-1), 0 };
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- fini_section (); \
- fprintf (FILE, "%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",0\n"); \
- } while (0)
-
+#undef TARGET_ASM_CONSTRUCTOR
+#define TARGET_ASM_CONSTRUCTOR clix_asm_out_constructor
+#undef TARGET_ASM_DESTRUCTOR
+#define TARGET_ASM_DESTRUCTOR clix_asm_out_destructor
/* On clix crt1.o first calls init code and then sets environ and a valid
chrclass. Unfortunately stdio routines bomb with unset chrclass.
diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h
index 44e2e27..e39f37c 100644
--- a/gcc/config/d30v/d30v.h
+++ b/gcc/config/d30v/d30v.h
@@ -4463,29 +4463,6 @@ do { \
collecting the lists of constructors and destructors. */
#define INVOKE__main
-/* Define this macro as a C statement to output on the stream STREAM the
- assembler code to arrange to call the function named NAME at initialization
- time.
-
- Assume that NAME is the name of a C function generated automatically by the
- compiler. This function takes no arguments. Use the function
- `assemble_name' to output the name NAME; this performs any system-specific
- syntactic transformations such as adding an underscore.
-
- If you don't define this macro, nothing special is output to arrange to call
- the function. This is correct when the function will be called in some
- other manner--for example, by means of the `collect2' program, which looks
- through the symbol table to find these functions by their names.
-
- Defined in svr4.h. */
-/* #define ASM_OUTPUT_CONSTRUCTOR(STREAM, NAME) */
-
-/* This is like `ASM_OUTPUT_CONSTRUCTOR' but used for termination functions
- rather than initialization functions.
-
- Defined in svr4.h. */
-/* #define ASM_OUTPUT_DESTRUCTOR(STREAM, NAME) */
-
/* If your system uses `collect2' as the means of processing constructors, then
that program normally uses `nm' to scan an object file for constructor
functions to be called. On certain kinds of systems, you can define these
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 6eb5bfd..f911076 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -42,6 +42,8 @@ extern rtx machopic_indirect_data_reference PARAMS ((rtx, rtx));
extern rtx machopic_indirect_call_target PARAMS ((rtx));
extern rtx machopic_legitimize_pic_address PARAMS ((rtx, enum machine_mode, rtx));
+extern void machopic_asm_out_constructor PARAMS ((rtx, int));
+extern void machopic_asm_out_destructor PARAMS ((rtx, int));
#endif /* RTX_CODE */
#ifdef TREE_CODE
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 65311a3..f2bd5bd 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1107,3 +1107,33 @@ update_stubs (name)
}
}
}
+
+void
+machopic_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ if (flag_pic)
+ mod_init_section ();
+ else
+ constructor_section ();
+ assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+
+ if (!flag_pic)
+ fprintf (asm_out_file, ".reference .constructors_used\n");
+}
+
+void
+machopic_asm_out_destructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ if (flag_pic)
+ mod_term_section ();
+ else
+ destructor_section ();
+ assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+
+ if (!flag_pic)
+ fprintf (asm_out_file, ".reference .destructors_used\n");
+}
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 5cebd58..193a523 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -158,33 +158,8 @@ do { text_section (); \
#undef INVOKE__main
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { if (flag_pic) \
- mod_init_section (); \
- else \
- constructor_section (); \
- ASM_OUTPUT_ALIGN (FILE, 1); \
- fprintf (FILE, "\t.long "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- if (!flag_pic) \
- fprintf (FILE, ".reference .constructors_used\n"); \
- } while (0)
-
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { if (flag_pic) \
- mod_term_section (); \
- else \
- destructor_section (); \
- ASM_OUTPUT_ALIGN (FILE, 1); \
- fprintf (FILE, "\t.long "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- if (!flag_pic) \
- fprintf (FILE, ".reference .destructors_used\n"); \
- } while (0)
+#define TARGET_ASM_CONSTRUCTOR machopic_asm_out_constructor
+#define TARGET_ASM_DESTRUCTOR machopic_asm_out_destructor
/* Don't output a .file directive. That is only used by the assembler for
diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h
index 82dde08..d813678 100644
--- a/gcc/config/elfos.h
+++ b/gcc/config/elfos.h
@@ -225,8 +225,7 @@ Boston, MA 02111-1307, USA. */
/* This is the pseudo-op used to generate a reference to a specific
symbol in some section. It is only used in machine-specific
- configuration files, typically only in ASM_OUTPUT_CONSTRUCTOR and
- ASM_OUTPUT_DESTRUCTOR. This is the same for all known svr4
+ configuration files. This is the same for all known svr4
assemblers, except those in targets that don't use 32-bit pointers.
Those should override INT_ASM_OP. Yes, the name of the macro is
misleading. */
@@ -254,24 +253,6 @@ Boston, MA 02111-1307, USA. */
#define CONST_SECTION_ASM_OP "\t.section\t.rodata"
-/* 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.) */
-
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
-
/* On svr4, we *do* have support for the .init and .fini sections, and we
can put stuff in there to be executed before and after `main'. We let
crtstuff.c and other files know this by defining the following symbols.
@@ -287,7 +268,7 @@ Boston, MA 02111-1307, USA. */
includes this file. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
@@ -295,9 +276,7 @@ Boston, MA 02111-1307, USA. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
+ CONST_SECTION_FUNCTION
#define READONLY_DATA_SECTION() const_section ()
@@ -314,28 +293,6 @@ const_section () \
} \
}
-#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; \
- } \
-}
-
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
#define UNIQUE_SECTION(DECL, RELOC) \
@@ -377,30 +334,6 @@ dtors_section () \
} \
while (0)
-/* A C statement (sans semicolon) to output an
- element in the table of global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
- do \
- { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } \
- while (0)
-
-/* A C statement (sans semicolon) to output an
- element in the table of global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do \
- { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } \
- while (0)
-
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index f419ba4..735a423 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -1088,34 +1088,11 @@ struct cum_arg
#define DATA_SECTION_ASM_OP "\t.section .data"
#define BSS_SECTION_ASM_OP "\t.section .bss"
#define INIT_SECTION_ASM_OP "\t.section .init"
-#define CTORS_SECTION_ASM_OP "\t.section .ctors"
-#define DTORS_SECTION_ASM_OP "\t.section .dtors"
#define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata"
-#define EXTRA_SECTIONS in_ctors, in_dtors, in_readonly_data
+#define EXTRA_SECTIONS in_readonly_data
#define EXTRA_SECTION_FUNCTIONS \
- \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-} \
- \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-} \
- \
void \
readonly_data () \
{ \
@@ -1126,22 +1103,6 @@ readonly_data () \
} \
}
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do \
- { \
- ctors_section (); \
- fprintf (FILE, "%s_%s\n", ASM_WORD_OP, NAME); \
- } \
- while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do \
- { \
- dtors_section (); \
- fprintf (FILE, "%s_%s\n", ASM_WORD_OP, NAME); \
- } \
- while (0)
-
#undef DO_GLOBAL_CTORS_BODY
#define DO_GLOBAL_CTORS_BODY \
{ \
@@ -1156,7 +1117,7 @@ readonly_data () \
}
#undef DO_GLOBAL_DTORS_BODY
-#define DO_GLOBAL_DTORS_BODY \
+#define DO_GLOBAL_DTORS_BODY \
{ \
typedef (*pfunc)(); \
extern pfunc __dtors[]; \
diff --git a/gcc/config/i386/aix386.h b/gcc/config/i386/aix386.h
index a9115ad..f085c42 100644
--- a/gcc/config/i386/aix386.h
+++ b/gcc/config/i386/aix386.h
@@ -60,10 +60,5 @@ Boston, MA 02111-1307, USA. */
asm ("pushl $0")
#define CTOR_LIST_END CTOR_LIST_BEGIN
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tpushl $"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
+#undef TARGET_ASM_CONSTRUCTOR
+#define TARGET_ASM_CONSTRUCTOR ix86_svr3_asm_out_constructor
diff --git a/gcc/config/i386/aix386ng.h b/gcc/config/i386/aix386ng.h
index 02f9502..445d333 100644
--- a/gcc/config/i386/aix386ng.h
+++ b/gcc/config/i386/aix386ng.h
@@ -106,8 +106,8 @@ Boston, MA 02111-1307, USA. */
# undef FINI_SECTION_ASM_OP
# undef CTORS_SECTION_ASM_OP
# undef DTORS_SECTION_ASM_OP
-# undef ASM_OUTPUT_CONSTRUCTOR
-# undef ASM_OUTPUT_DESTRUCTOR
+# undef TARGET_ASM_CONSTRUCTOR
+# undef TARGET_ASM_DESTRUCTOR
# undef DO_GLOBAL_CTORS_BODY
# undef CTOR_LIST_BEGIN
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index 9ea367f..71b8468 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -199,39 +199,13 @@ union tree_node;
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor, in_drectve
+#define EXTRA_SECTIONS in_drectve
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
- CTOR_SECTION_FUNCTION \
- DTOR_SECTION_FUNCTION \
DRECTVE_SECTION_FUNCTION \
SWITCH_TO_SECTION_FUNCTION
-#define CTOR_SECTION_FUNCTION \
-void \
-ctor_section () \
-{ \
- if (in_section != in_ctor) \
- { \
- fprintf (asm_out_file, "\t.section .ctor\n"); \
- in_section = in_ctor; \
- } \
-}
-void ctor_section PARAMS ((void));
-
-#define DTOR_SECTION_FUNCTION \
-void \
-dtor_section () \
-{ \
- if (in_section != in_dtor) \
- { \
- fprintf (asm_out_file, "\t.section .dtor\n"); \
- in_section = in_dtor; \
- } \
-}
-void dtor_section PARAMS ((void));
-
#define DRECTVE_SECTION_FUNCTION \
void \
drectve_section () \
@@ -262,29 +236,11 @@ switch_to_section (section, decl) \
case in_text: text_section (); break; \
case in_data: data_section (); break; \
case in_named: named_section (decl, NULL, 0); break; \
- case in_ctor: ctor_section (); break; \
- case in_dtor: dtor_section (); break; \
case in_drectve: drectve_section (); break; \
default: abort (); break; \
} \
}
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctor_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtor_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* Don't allow flag_pic to propagate since gas may produce invalid code
otherwise. */
diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h
index f5e79c2..0bde498 100644
--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -45,18 +45,10 @@ Boston, MA 02111-1307, USA. */
#undef BSS_SECTION_ASM_OP
#define BSS_SECTION_ASM_OP "\t.section\t.bss"
-/* Define the name of the .ctor section. */
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.section .ctor"
-
/* Define the name of the .data section. */
#undef DATA_SECTION_ASM_OP
#define DATA_SECTION_ASM_OP "\t.section .data"
-/* Define the name of the .dtor section. */
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.section .dtor"
-
/* Define the name of the .ident op. */
#undef IDENT_ASM_OP
#define IDENT_ASM_OP "\t.ident\t"
@@ -147,55 +139,9 @@ Boston, MA 02111-1307, USA. */
unless user explicitly requests it. */
#undef LOCAL_INCLUDE_DIR
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTOR_SECTION_FUNCTION \
- DTOR_SECTION_FUNCTION
-
-#define CTOR_SECTION_FUNCTION \
-void \
-ctor_section () \
-{ \
- if (in_section != in_ctor) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctor; \
- } \
-}
-
-#define DTOR_SECTION_FUNCTION \
-void \
-dtor_section () \
-{ \
- if (in_section != in_dtor) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtor; \
- } \
-}
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctor_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_coff_asm_named_section
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtor_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* Output at beginning of assembler file. */
/* The .file command should always begin the output. */
diff --git a/gcc/config/i386/i386-coff.h b/gcc/config/i386/i386-coff.h
index 69839e1..c1ae670 100644
--- a/gcc/config/i386/i386-coff.h
+++ b/gcc/config/i386/i386-coff.h
@@ -37,65 +37,7 @@ Boston, MA 02111-1307, USA. */
#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
-/* Support the ctors and dtors sections for g++. */
-
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\""
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_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; \
- } \
-}
-
-#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; \
- } \
-}
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_coff_asm_named_section
/* end of i386-coff.h */
diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h
index 864f520..5b114106 100644
--- a/gcc/config/i386/i386-interix.h
+++ b/gcc/config/i386/i386-interix.h
@@ -253,10 +253,7 @@ Boston, MA 02111-1307, USA. */
#undef LD_FINI_SWITCH
-/* The following are needed for C++, but also needed for profiling */
-
-/* Support const sections and the ctors and dtors sections for g++.
- Note that there appears to be two different ways to support const
+/* Note that there appears to be two different ways to support const
sections at the moment. You can either #define the symbol
READONLY_DATA_SECTION (giving it some code which switches to the
readonly data section) or else you can #define the symbols
@@ -267,31 +264,13 @@ Boston, MA 02111-1307, USA. */
#define CONST_SECTION_ASM_OP "\t.section\t.rdata,\"r\""
-/* 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.) */
-
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\""
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"x\""
-
/* A default list of other sections which we might be "in" at any given
time. For targets that use additional sections (e.g. .tdesc) you
should override this definition in the target-specific file which
includes this file. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
@@ -299,9 +278,7 @@ Boston, MA 02111-1307, USA. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
+ CONST_SECTION_FUNCTION
#undef READONLY_DATA_SECTION
#define READONLY_DATA_SECTION() const_section ()
@@ -319,53 +296,11 @@ const_section () \
} \
}
-#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; \
- } \
-}
-
/* The MS compilers take alignment as a number of bytes, so we do as well */
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* The linker will take care of this, and having them causes problems with
ld -r (specifically -rU). */
#define CTOR_LISTS_DEFINED_EXTERNALLY 1
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 6508625..aae281c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -608,9 +608,13 @@ static int ix86_save_reg PARAMS ((int, int));
static void ix86_compute_frame_layout PARAMS ((struct ix86_frame *));
static int ix86_comp_type_attributes PARAMS ((tree, tree));
+#ifdef DO_GLOBAL_CTORS_BODY
+static void ix86_svr3_asm_out_constructor PARAMS ((rtx, int));
+#endif
#if defined(TARGET_ELF) && defined(TARGET_COFF)
static void sco_asm_named_section PARAMS ((const char *, unsigned int,
unsigned int));
+static void sco_asm_out_constructor PARAMS ((rtx, int));
#endif
/* Initialize the GCC target structure. */
@@ -10783,6 +10787,19 @@ ix86_memory_move_cost (mode, class, in)
}
}
+#ifdef DO_GLOBAL_CTORS_BODY
+static void
+ix86_svr3_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ init_section ();
+ fputs ("\tpushl $", asm_out_file);
+ assemble_name (asm_out_file, XSTR (symbol, 0));
+ fputc ('\n', asm_out_file);
+}
+#endif
+
#if defined(TARGET_ELF) && defined(TARGET_COFF)
static void
sco_asm_named_section (name, flags, align)
@@ -10795,4 +10812,15 @@ sco_asm_named_section (name, flags, align)
else
default_coff_asm_named_section (name, flags, align);
}
+
+static void
+sco_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority;
+{
+ if (TARGET_ELF)
+ default_named_section_asm_out_constrctor (symbol, priority);
+ else
+ ix86_svr3_asm_out_constructor (symbol, priority);
+}
#endif
diff --git a/gcc/config/i386/sco5.h b/gcc/config/i386/sco5.h
index b7a7cdb..a818427 100644
--- a/gcc/config/i386/sco5.h
+++ b/gcc/config/i386/sco5.h
@@ -390,37 +390,8 @@ do { \
ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \
} while (0)
-
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
-do { \
- if (TARGET_ELF) { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } else { \
- init_section (); \
- fprintf (FILE, "\tpushl $"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); } \
- } while (0)
-
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
-do { \
- if (TARGET_ELF) { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } else { \
- fini_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); } \
- } while (0)
-
+#undef TARGET_ASM_CONSTRUCTOR
+#define TARGET_ASM_CONSTRUCTOR sco_asm_out_constructor
#undef ASM_OUTPUT_IDENT
#define ASM_OUTPUT_IDENT(FILE, NAME) \
@@ -508,15 +479,13 @@ do { \
((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG)
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_init, in_fini, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const, in_init, in_fini
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
INIT_SECTION_FUNCTION \
- FINI_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
+ FINI_SECTION_FUNCTION
#undef CONST_SECTION_FUNCTION
#define CONST_SECTION_FUNCTION \
@@ -556,30 +525,6 @@ init_section () \
} \
}
-#undef 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; \
- } \
-}
-
-#undef 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; \
- } \
-}
-
#undef SUBTARGET_FRAME_POINTER_REQUIRED
#define SUBTARGET_FRAME_POINTER_REQUIRED \
((TARGET_ELF) ? 0 : \
diff --git a/gcc/config/i386/svr3gas.h b/gcc/config/i386/svr3gas.h
index db4be5d..8733ba7 100644
--- a/gcc/config/i386/svr3gas.h
+++ b/gcc/config/i386/svr3gas.h
@@ -94,15 +94,6 @@ Boston, MA 02111-1307, USA. */
unless the specific tm.h file turns it on by defining
USE_CONST_SECTION as 1. */
-/* Define a few machine-specific details of the implementation of
- constructors.
-
- The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor. */
-
#define USE_CONST_SECTION 0
#define INIT_SECTION_ASM_OP "\t.section\t.init"
@@ -113,8 +104,12 @@ Boston, MA 02111-1307, USA. */
/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
because they push on the stack. */
+/* This is copied from i386/sysv3.h. */
-#ifdef STACK_GROWS_DOWNWARD
+#define CTOR_LIST_BEGIN \
+ asm (INIT_SECTION_ASM_OP); \
+ asm ("pushl $0")
+#define CTOR_LIST_END CTOR_LIST_BEGIN
/* Constructor list on stack is in reverse order. Go to the end of the
list and go backwards to call constructors in the right order. */
@@ -127,18 +122,6 @@ do { \
(*--p) (); \
} while (0)
-#else
-
-/* Constructor list on stack is in correct order. Just call them. */
-#define DO_GLOBAL_CTORS_BODY \
-do { \
- func_ptr *p, *beg = alloca (0); \
- for (p = beg; *p; ) \
- (*p++) (); \
-} while (0)
-
-#endif /* STACK_GROWS_DOWNWARD */
-
/* Add extra sections .rodata, .init and .fini. */
#undef EXTRA_SECTIONS
@@ -187,44 +170,7 @@ const_section () \
} \
}
-/* The ctors and dtors sections are not normally put into use
- by EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS as defined in svr3.h,
- but it can't hurt to define these macros for whatever systems use them. */
-#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; \
- } \
-}
-
-/* This is machine-dependent
- because it needs to push something on the stack. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- fini_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
+#define TARGET_ASM_CONSTRUCTOR ix86_svr3_asm_out_constructor
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
@@ -262,31 +208,3 @@ dtors_section () \
go into the const section. */
#define SELECT_RTX_SECTION(MODE,RTX) const_section()
-
-/* This is copied from i386/sysv3.h. */
-
-/* Define a few machine-specific details of the implementation of
- constructors.
-
- The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
- and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
- constructor. */
-
-#undef INIT_SECTION_ASM_OP
-#define INIT_SECTION_ASM_OP "\t.section .init,\"x\""
-
-#define CTOR_LIST_BEGIN \
- asm (INIT_SECTION_ASM_OP); \
- asm ("pushl $0")
-#define CTOR_LIST_END CTOR_LIST_BEGIN
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tpushl $"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
diff --git a/gcc/config/i386/sysv3.h b/gcc/config/i386/sysv3.h
index 9d73502..8eb4bec 100644
--- a/gcc/config/i386/sysv3.h
+++ b/gcc/config/i386/sysv3.h
@@ -102,10 +102,7 @@ Boston, MA 02111-1307, USA. */
The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
- constructor. */
+ push a word containing 0 (or some equivalent of that). */
#undef INIT_SECTION_ASM_OP
#define INIT_SECTION_ASM_OP "\t.section .init,\"x\""
@@ -115,10 +112,4 @@ Boston, MA 02111-1307, USA. */
asm ("pushl $0")
#define CTOR_LIST_END CTOR_LIST_BEGIN
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tpushl $"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
+#define TARGET_ASM_CONSTRUCTOR ix86_svr3_asm_out_constructor
diff --git a/gcc/config/i386/vsta.h b/gcc/config/i386/vsta.h
index e9479ef..1bb897d 100644
--- a/gcc/config/i386/vsta.h
+++ b/gcc/config/i386/vsta.h
@@ -27,51 +27,3 @@ Boston, MA 02111-1307, USA. */
#undef CPP_PREDEFINES
#endif
#define CPP_PREDEFINES "-Dunix -DVSTA -Asystem=unix -Asystem=vsta"
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTOR_SECTION_FUNCTION \
- DTOR_SECTION_FUNCTION
-
-#define CTOR_SECTION_FUNCTION \
-void \
-ctor_section () \
-{ \
- if (in_section != in_ctor) \
- { \
- fprintf (asm_out_file, "\t.section .ctor\n"); \
- in_section = in_ctor; \
- } \
-}
-
-#define DTOR_SECTION_FUNCTION \
-void \
-dtor_section () \
-{ \
- if (in_section != in_dtor) \
- { \
- fprintf (asm_out_file, "\t.section .dtor\n"); \
- in_section = in_dtor; \
- } \
-}
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctor_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtor_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-
diff --git a/gcc/config/i386/win32.h b/gcc/config/i386/win32.h
index 7e03383..d2ab075 100644
--- a/gcc/config/i386/win32.h
+++ b/gcc/config/i386/win32.h
@@ -103,52 +103,6 @@ Boston, MA 02111-1307, USA. */
#define NEED_ATEXIT 1
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTOR_SECTION_FUNCTION \
- DTOR_SECTION_FUNCTION
-
-#define CTOR_SECTION_FUNCTION \
-void \
-ctor_section () \
-{ \
- if (in_section != in_ctor) \
- { \
- fprintf (asm_out_file, "\t.section .ctor\n"); \
- in_section = in_ctor; \
- } \
-}
-
-#define DTOR_SECTION_FUNCTION \
-void \
-dtor_section () \
-{ \
- if (in_section != in_dtor) \
- { \
- fprintf (asm_out_file, "\t.section .dtor\n"); \
- in_section = in_dtor; \
- } \
-}
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctor_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtor_section (); \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* Define this macro if references to a symbol must be treated
differently depending on something about the variable or
function named by the symbol (such as what section it is in).
diff --git a/gcc/config/i960/i960-coff.h b/gcc/config/i960/i960-coff.h
index b1fed12..7f46215 100644
--- a/gcc/config/i960/i960-coff.h
+++ b/gcc/config/i960/i960-coff.h
@@ -41,61 +41,6 @@ Boston, MA 02111-1307, USA. */
#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\""
#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"x\""
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_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; \
- } \
-}
-
-#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; \
- } \
-}
-
#define INT_ASM_OP "\t.word\t"
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* end of i960-coff.h */
diff --git a/gcc/config/ia64/sysv4.h b/gcc/config/ia64/sysv4.h
index ea9eb2f..3902072 100644
--- a/gcc/config/ia64/sysv4.h
+++ b/gcc/config/ia64/sysv4.h
@@ -83,46 +83,6 @@ do { \
#define INIT_SECTION_ASM_OP "\t.section\t.init,\"ax\",\"progbits\""
#undef FINI_SECTION_ASM_OP
#define FINI_SECTION_ASM_OP "\t.section\t.fini,\"ax\",\"progbits\""
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\",\"progbits\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\",\"progbits\""
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-/* Must override this to get @fptr relocation. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
- fputs ("\tdata8\t ", FILE); \
- else \
- fputs ("\tdata8\t @fptr(", FILE); \
- assemble_name (FILE, NAME); \
- if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
- fputs ("\n", FILE); \
- else \
- fputs (")\n", FILE); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-/* Must override this to get @fptr relocation. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
- fputs ("\tdata8\t ", FILE); \
- else \
- fputs ("\tdata8\t @fptr(", FILE); \
- assemble_name (FILE, NAME); \
- if (TARGET_NO_PIC || TARGET_AUTO_PIC) \
- fputs ("\n", FILE); \
- else \
- fputs (")\n", FILE); \
- } while (0)
/* svr4.h undefines this, so we need to define it here. */
#define DBX_REGISTER_NUMBER(REGNO) \
@@ -238,13 +198,11 @@ extern unsigned int ia64_section_threshold;
}
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_sdata, in_sbss
+#define EXTRA_SECTIONS in_const, in_sdata, in_sbss
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
SDATA_SECTION_FUNCTION \
SBSS_SECTION_FUNCTION
diff --git a/gcc/config/lynx.h b/gcc/config/lynx.h
index 7769be5..a0594d8 100644
--- a/gcc/config/lynx.h
+++ b/gcc/config/lynx.h
@@ -128,13 +128,11 @@ do { \
#undef INIT_SECTION_ASM_OP
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_fini
+#define EXTRA_SECTIONS in_const, in_fini
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
FINI_SECTION_FUNCTION
#undef CTORS_SECTION_ASM_OP
@@ -144,28 +142,6 @@ do { \
#define INT_ASM_OP "\t.long\t"
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\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(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
#undef DO_GLOBAL_CTORS_BODY
#undef DO_GLOBAL_DTORS_BODY
diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c
index 119d8ee..04516fe 100644
--- a/gcc/config/m68hc11/m68hc11.c
+++ b/gcc/config/m68hc11/m68hc11.c
@@ -74,6 +74,8 @@ static void m68hc11_add_gc_roots PARAMS ((void));
static void asm_print_register PARAMS ((FILE *, int));
static void m68hc11_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void m68hc11_asm_out_constructor PARAMS ((rtx, int));
+static void m68hc11_asm_out_destructor PARAMS ((rtx, int));
rtx m68hc11_soft_tmp_reg;
@@ -5254,3 +5256,21 @@ m68hc11_add_gc_roots ()
ggc_add_rtx_root (&stack_push_word, 1);
ggc_add_rtx_root (&stack_pop_word, 1);
}
+
+static void
+m68hc11_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority;
+{
+ default_ctor_section_asm_out_constructor (symbol, priority);
+ fprintf (asm_out_file, "\t.globl\t__do_global_ctors\n");
+}
+
+static void
+m68hc11_asm_out_destructor (symbol, priority)
+ rtx symbol;
+ int priority;
+{
+ default_dtor_section_asm_out_destructor (symbol, priority);
+ fprintf (asm_out_file, "\t.globl\t__do_global_dtors\n");
+}
diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h
index 777fb88..5697a6a 100644
--- a/gcc/config/m68hc11/m68hc11.h
+++ b/gcc/config/m68hc11/m68hc11.h
@@ -1582,8 +1582,7 @@ do { \
/* This is the pseudo-op used to generate a reference to a specific
symbol in some section. It is only used in machine-specific
- configuration files, typically only in ASM_OUTPUT_CONSTRUCTOR and
- ASM_OUTPUT_DESTRUCTOR. This is the same for all known svr4
+ configuration files. This is the same for all known svr4
assemblers, except those in targets that don't use 32-bit pointers.
Those should override INT_ASM_OP. Yes, the name of the macro is
misleading. */
@@ -1600,31 +1599,8 @@ do { \
#undef DTORS_SECTION_ASM_OP
#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"a\""
-#undef CTORS_SECTION_FUNCTION
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "\t.globl\t__do_global_ctors\n"); \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#undef DTORS_SECTION_FUNCTION
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "\t.globl\t__do_global_dtors\n"); \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
+#define TARGET_ASM_CONSTRUCTOR m68hc11_asm_out_constructor
+#define TARGET_ASM_DESTRUCTOR m68hc11_asm_out_destructor
/* This is how to begin an assembly language file. Most svr4 assemblers want
at least a .file directive to come first, and some want to see a .version
diff --git a/gcc/config/m68k/auxgas.h b/gcc/config/m68k/auxgas.h
index c3c7635..28d9f9e 100644
--- a/gcc/config/m68k/auxgas.h
+++ b/gcc/config/m68k/auxgas.h
@@ -32,8 +32,6 @@ Boston, MA 02111-1307, USA. */
fprintf (FILE, "\t.ident \"%s\"\n", NAME);
#ifdef USE_COLLECT2
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
/* for the sake of link-level compatibility with /bin/as version */
#define NO_DOLLAR_IN_LABEL
#define NO_DOT_IN_LABEL
diff --git a/gcc/config/m68k/coff.h b/gcc/config/m68k/coff.h
index 8a63c6c..946f196 100644
--- a/gcc/config/m68k/coff.h
+++ b/gcc/config/m68k/coff.h
@@ -104,68 +104,8 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION m68k_coff_asm_named_section
-/* Support the ctors and dtors sections for g++. */
-
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\""
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_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; \
- } \
-}
-
-#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; \
- } \
-}
-
#define INT_ASM_OP "\t.long\t"
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* Don't assume anything about startfiles. */
#undef STARTFILE_SPEC
diff --git a/gcc/config/m68k/dpx2.h b/gcc/config/m68k/dpx2.h
index 886a34b..bb1c498 100644
--- a/gcc/config/m68k/dpx2.h
+++ b/gcc/config/m68k/dpx2.h
@@ -31,6 +31,21 @@ Boston, MA 02111-1307, USA. */
#undef SELECT_RTX_SECTION
#include "svr3.h"
+/* We use collect2 instead of ctors_section constructors. */
+#undef INIT_SECTION_ASM_OP
+#undef FINI_SECTION_ASM_OP
+#undef DTORS_SECTION_ASM_OP
+#undef DO_GLOBAL_CTORS_BODY
+
+/* Remove handling for a separate constant data section. We put
+ constant data in text_section, which is the default. */
+#undef SELECT_SECTION
+#undef SELECT_RTX_SECTION
+#undef EXTRA_SECTIONS
+#undef EXTRA_SECTION_FUNCTIONS
+#undef CONST_SECTION_ASM_OP
+#undef READONLY_DATA_SECTION
+
#define DPX2
/* See m68k.h. 7 means 68020 with 68881.
@@ -84,24 +99,11 @@ Boston, MA 02111-1307, USA. */
/* The native assembler doesn't support fmovecr. */
#define NO_ASM_FMOVECR
-#undef EXTRA_SECTIONS
-#undef EXTRA_SECTION_FUNCTIONS
-#undef READONLY_DATA_SECTION
-#define READONLY_DATA_SECTION data_section
-#undef SELECT_SECTION
-#undef SELECT_RTX_SECTION
-#define fini_section() while (0)
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\tsection 15"
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\tsection 15"
-#undef INIT_SECTION_ASM_OP
-#define BSS_SECTION_ASM_OP "\tsection 14"
#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP "\tsection 10"
+#define TEXT_SECTION_ASM_OP "\tsection 10"
#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP "\tsection 15"
+#define DATA_SECTION_ASM_OP "\tsection 15"
+#define BSS_SECTION_ASM_OP "\tsection 14"
/* Don't try using XFmode. */
diff --git a/gcc/config/m68k/dpx2g.h b/gcc/config/m68k/dpx2g.h
index ea5cd13..ecf00fc 100644
--- a/gcc/config/m68k/dpx2g.h
+++ b/gcc/config/m68k/dpx2g.h
@@ -5,49 +5,11 @@
#define USE_GAS
#include "m68k/dpx2.h"
-#if 0 /* #ifndef USE_COLLECT2 */
-
-/* We use set vectors for the constructors/destructors. */
-
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-
-/* Although the gas we use can create .ctor and .dtor sections from N_SETT
- stabs, it does not support section directives, so we need to have the loader
- define the lists.
- */
-#define CTOR_LISTS_DEFINED_EXTERNALLY
-
-/* similar to default, but allows for the table defined by ld with gcc.ifile.
- nptrs is always 0. So we need to instead check that __DTOR_LIST__[1] != 0.
- The old check is left in so that the same macro can be used if and when
- a future version of gas does support section directives. */
-
-#define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \
- if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0)) \
- for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); \
- for (i = nptrs; i >= 1; i--) \
- __DTOR_LIST__[i] (); }
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!r:gcc.ifile%s}\
- %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}\
- huge.o%s"
-
-#endif /* !USE_COLLECT2 */
-
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
"%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}\
huge.o%s"
-
-/*
- * we are using GAS
- */
-#undef EXTRA_SECTION_FUNCTIONS
-#undef EXTRA_SECTIONS
/* Gas understands dollars in labels. */
#undef NO_DOLLAR_IN_LABEL
/* GAS does not understand .ident so don't output anything for #ident. */
@@ -56,16 +18,4 @@
#undef ASM_LONG
#define ASM_LONG "\t.long"
-/*
- * put const's in the text section
- */
-#define const_section() text_section()
-#define fini_section() while (0)
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.data"
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.data"
-#undef INIT_SECTION_ASM_OP
-
/* end of dpx2g.h */
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index b18c07c..b03c29e 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */
#include "tm_p.h"
#include "target.h"
#include "target-def.h"
+#include "debug.h"
/* Needed for use_return_insn. */
#include "flags.h"
@@ -62,6 +63,9 @@ static void m68k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void m68k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static void m68k_coff_asm_named_section PARAMS ((const char *, unsigned int,
unsigned int));
+#ifdef INIT_SECTION_ASM_OP
+static void m68k_svr3_asm_out_constructor PARAMS ((rtx, int));
+#endif
/* Alignment to use for loops and jumps */
@@ -4228,3 +4232,19 @@ m68k_coff_asm_named_section (name, flags, align)
fprintf (asm_out_file, "\t.section\t%s,\"%c\"\n", name, flagchar);
}
+
+#ifdef INIT_SECTION_ASM_OP
+static void
+m68k_svr3_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ rtx xop[2];
+
+ xop[1] = symbol;
+ xop[0] = gen_rtx_MEM (SImode, gen_rtx_PRE_DEC (SImode, stack_pointer_rtx));
+
+ init_section ();
+ output_asm_insn (output_move_simode (xop), xop);
+}
+#endif
diff --git a/gcc/config/m68k/mot3300.h b/gcc/config/m68k/mot3300.h
index fd91481..5cfe659 100644
--- a/gcc/config/m68k/mot3300.h
+++ b/gcc/config/m68k/mot3300.h
@@ -196,61 +196,6 @@ Boston, MA 02111-1307, USA. */
#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\""
#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"x\""
-
-/* A list of other sections which the compiler might be "in" at any
- given time. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A list of extra section function definitions. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_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; \
- } \
-}
-
-#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; \
- } \
-}
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
#endif /* defined (USE_GLD) */
/* The file command should always begin the output. */
diff --git a/gcc/config/m68k/tower-as.h b/gcc/config/m68k/tower-as.h
index bb03b05..4679738 100644
--- a/gcc/config/m68k/tower-as.h
+++ b/gcc/config/m68k/tower-as.h
@@ -82,8 +82,8 @@ Boston, MA 02111-1307, USA. */
#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
fprintf (FILE, "\tln\t%d\n", \
- (sdb_begin_function_line \
- ? last_linenum - sdb_begin_function_line : 1))
+ (sdb_begin_function_line > -1 \
+ ? (LINENO) - sdb_begin_function_line : 1))
#undef ASM_OUTPUT_IDENT
#define ASM_OUTPUT_IDENT(FILE, NAME) \
@@ -581,10 +581,7 @@ do { fprintf (asm_out_file, "\ttag\t"); \
The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
and CTOR_LIST_END to contribute to the .init section an instruction to
- push a word containing 0 (or some equivalent of that).
-
- ASM_OUTPUT_CONSTRUCTOR should be defined
- to push the address of the constructor. */
+ push a word containing 0 (or some equivalent of that). */
#define ASM_LONG "\tlong"
#undef INIT_SECTION_ASM_OP
@@ -601,10 +598,4 @@ do { fprintf (asm_out_file, "\ttag\t"); \
#define BSS_SECTION_ASM_OP "\tsection\t~bss"
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tmov.l &"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ",-(%%sp)\n"); \
- } while (0)
+#define TARGET_ASM_CONSTRUCTOR m68k_svr3_asm_out_constructor
diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c
index 4ece2d6..f77aa47 100644
--- a/gcc/config/m88k/m88k.c
+++ b/gcc/config/m88k/m88k.c
@@ -67,6 +67,10 @@ static void m88k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void m88k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static void m88k_output_function_end_prologue PARAMS ((FILE *));
static void m88k_output_function_begin_epilogue PARAMS ((FILE *));
+#ifdef INIT_SECTION_ASM_OP
+static void m88k_svr3_asm_out_constructor PARAMS ((rtx, int));
+static void m88k_svr3_asm_out_destructor PARAMS ((rtx, int));
+#endif
/* Initialize the GCC target structure. */
#undef TARGET_ASM_FUNCTION_PROLOGUE
@@ -1891,15 +1895,10 @@ m88k_layout_frame ()
int need
= ((m88k_stack_size ? STACK_UNIT_BOUNDARY - STARTING_FRAME_OFFSET : 0)
- (frame_size % STACK_UNIT_BOUNDARY));
- if (need)
- {
- if (need < 0)
- need += STACK_UNIT_BOUNDARY;
- (void) assign_stack_local (BLKmode, need, BITS_PER_UNIT);
- frame_size = get_frame_size ();
- }
+ if (need < 0)
+ need += STACK_UNIT_BOUNDARY;
m88k_stack_size
- = ROUND_CALL_BLOCK_SIZE (m88k_stack_size + frame_size
+ = ROUND_CALL_BLOCK_SIZE (m88k_stack_size + frame_size + need
+ current_function_pretend_args_size);
}
}
@@ -3285,3 +3284,34 @@ symbolic_operand (op, mode)
return 0;
}
}
+
+#ifdef INIT_SECTION_ASM_OP
+static void
+m88k_svr3_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ const char *name = XSTR (symbol, 0);
+
+ init_section ();
+ fprintf (asm_out_file, "\tor.u\t r13,r0,hi16(");
+ assemble_name (asm_out_file, name);
+ fprintf (asm_out_file, ")\n\tor\t r13,r13,lo16(");
+ assemble_name (asm_out_file, name);
+ fprintf (asm_out_file, ")\n\tsubu\t r31,r31,%d\n\tst\t r13,r31,%d\n",
+ STACK_BOUNDARY / BITS_PER_UNIT, REG_PARM_STACK_SPACE (0));
+}
+
+static void
+m88k_svr3_asm_out_destructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ int i;
+
+ fini_section ();
+ assemble_integer (symbol, UNITS_PER_WORD, 1);
+ for (i = 1; i < 4; i++)
+ assemble_integer (constm1_rtx, UNITS_PER_WORD, 1);
+}
+#endif
diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h
index 81358f7..1f7304c 100644
--- a/gcc/config/m88k/m88k.h
+++ b/gcc/config/m88k/m88k.h
@@ -2438,15 +2438,14 @@ do { \
#if defined(USING_SVR4_H)
-#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata
#define INIT_SECTION_FUNCTION
#define FINI_SECTION_FUNCTION
#else
#if defined(USING_SVR3_H)
-#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata, in_ctors, in_dtors, \
- in_init, in_fini
+#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata, in_init, in_fini
#else /* luna or other not based on svr[34].h. */
@@ -2458,8 +2457,6 @@ const_section () \
{ \
text_section(); \
}
-#define CTORS_SECTION_FUNCTION
-#define DTORS_SECTION_FUNCTION
#define INIT_SECTION_FUNCTION
#define FINI_SECTION_FUNCTION
@@ -2490,8 +2487,6 @@ sdata_section () \
} \
} \
\
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
INIT_SECTION_FUNCTION \
FINI_SECTION_FUNCTION
diff --git a/gcc/config/m88k/sysv3.h b/gcc/config/m88k/sysv3.h
index 9986f62..bd9f4a1 100644
--- a/gcc/config/m88k/sysv3.h
+++ b/gcc/config/m88k/sysv3.h
@@ -76,20 +76,8 @@ Boston, MA 02111-1307, USA. */
asm ("\tst\t r0,r31,32"); /* REG_PARM_STACK_SPACE (0) == 32 */
#define CTOR_LIST_END
-/* ASM_OUTPUT_CONSTRUCTOR outputs code into the .init section to push the
- address of the constructor. This becomes the body of __do_global_ctors
- in crtstuff.c. r13 is a temporary register. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- init_section (); \
- fprintf (FILE, "\tor.u\t r13,r0,hi16("); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ")\n\tor\t r13,r13,lo16("); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ")\n\tsubu\t r31,r31,%d\n\tst\t r13,r31,%d\n", \
- STACK_BOUNDARY / BITS_PER_UNIT, REG_PARM_STACK_SPACE (0)); \
- } while (0)
+#define TARGET_ASM_CONSTRUCTOR m88k_svr3_asm_out_constructor
+#define TARGET_ASM_DESTRUCTOR m88k_svr3_asm_out_destructor
#undef DO_GLOBAL_CTORS_BODY
#define DO_GLOBAL_CTORS_BODY \
@@ -108,25 +96,6 @@ do { \
func_ptr __DTOR_END__[4] = { (func_ptr) 0, (func_ptr) 0, \
(func_ptr) 0, (func_ptr) 0 }
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. The table is constructed in the .fini section
- so that an explicit linker script is not required. The complication
- is that this section is padded with NOP instructions and to either
- 8 or 16 byte alignment depending on the specific system. A clever
- way to avoid trouble is to output a block of 16 bytes where the
- extra words are known values (-1). */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- register int i; \
- fini_section (); \
- fprintf (FILE, "\t%s\t ", ASM_LONG); \
- assemble_name (FILE,NAME); \
- fprintf (FILE, "\n"); \
- for (i = 1; i < 4; i++) \
- fprintf (FILE, "\t%s\t -1\n", ASM_LONG); \
- } while (0)
-
/* Walk the list looking for the terminating zero and ignoring all values of
-1. */
#undef DO_GLOBAL_DTORS_BODY
diff --git a/gcc/config/mcore/mcore-pe.h b/gcc/config/mcore/mcore-pe.h
index 2d0c195..2362b52 100644
--- a/gcc/config/mcore/mcore-pe.h
+++ b/gcc/config/mcore/mcore-pe.h
@@ -183,43 +183,15 @@ rdata_section () \
#define STARTFILE_SPEC "crt0.o%s"
#define ENDFILE_SPEC "%{!mno-lsim:-lsim}"
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"x\""
-
#define INT_ASM_OP "\t.long\t"
-#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
#undef DO_GLOBAL_CTORS_BODY
#undef DO_GLOBAL_DTORS_BODY
#undef INIT_SECTION_ASM_OP
+#undef DTORS_SECTION_ASM_OP
#define SUPPORTS_ONE_ONLY 1
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index 3cd595e..5974ab8 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -1080,39 +1080,13 @@ extern enum reg_class reg_class_from_letter[];
#define DATA_SECTION_ASM_OP "\t.data"
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors, SUBTARGET_EXTRA_SECTIONS
+#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
SUBTARGET_EXTRA_SECTION_FUNCTIONS \
SWITCH_SECTION_FUNCTION
-#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; \
- } \
-}
-
-#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; \
- } \
-}
-#endif
-
/* Switch to SECTION (an `enum in_section').
??? This facility should be provided by GCC proper.
@@ -1130,8 +1104,6 @@ switch_to_section (section, decl) \
case in_text: text_section (); break; \
case in_data: data_section (); break; \
case in_named: named_section (decl, NULL, 0); break; \
- case in_ctors: ctors_section (); break; \
- case in_dtors: dtors_section (); break; \
SUBTARGET_SWITCH_SECTIONS \
default: abort (); break; \
} \
diff --git a/gcc/config/mips/elf.h b/gcc/config/mips/elf.h
index 4b88363..aa094b6 100644
--- a/gcc/config/mips/elf.h
+++ b/gcc/config/mips/elf.h
@@ -200,29 +200,6 @@ do { \
#define UNIQUE_SECTION(DECL,RELOC) \
mips_unique_section ((DECL), (RELOC))
-/* Support the ctors/dtors and other sections. */
-
-/* Define the names of and 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.) */
-
-#define CTORS_SECTION_NAME ".ctors"
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
-#define DTORS_SECTION_NAME ".dtors"
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
-
/* There's no point providing a default definition of __CTOR_LIST__
since people are expected either to use crtbegin.o, or an equivalent,
or provide their own definition. */
@@ -231,7 +208,7 @@ do { \
/* A list of other sections which the compiler might be "in" at any
given time. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata
#define INVOKE__main
@@ -239,9 +216,7 @@ do { \
#define EXTRA_SECTION_FUNCTIONS \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(ctors_section, in_ctors, CTORS_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(dtors_section, in_dtors, DTORS_SECTION_ASM_OP)
+ SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP)
#define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
void FN () \
@@ -253,46 +228,6 @@ void FN () \
} \
}
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t", TARGET_LONG64 ? ".dword" : ".word"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\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(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t", TARGET_LONG64 ? ".dword" : ".word"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define CTOR_LIST_BEGIN \
-func_ptr __CTOR_LIST__ __attribute__((section(CTORS_SECTION_NAME))) = \
- (func_ptr) (-1)
-
-#define CTOR_LIST_END \
-func_ptr __CTOR_END__ __attribute__((section(CTORS_SECTION_NAME))) = \
- (func_ptr) 0
-
-#define DTOR_LIST_BEGIN \
-func_ptr __DTOR_LIST__ __attribute__((section(DTORS_SECTION_NAME))) = \
- (func_ptr) (-1)
-
-#define DTOR_LIST_END \
-func_ptr __DTOR_END__ __attribute__((section(DTORS_SECTION_NAME))) = \
- (func_ptr) 0
-
/* Don't set the target flags, this is done by the linker script */
#undef LIB_SPEC
#define LIB_SPEC ""
diff --git a/gcc/config/mips/elf64.h b/gcc/config/mips/elf64.h
index 782c62b..c9bcd3e 100644
--- a/gcc/config/mips/elf64.h
+++ b/gcc/config/mips/elf64.h
@@ -243,29 +243,6 @@ do { \
DECL_SECTION_NAME (DECL) = build_string (len, string); \
} while (0)
-/* Support the ctors/dtors and other sections. */
-
-/* Define the names of and 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.) */
-
-#define CTORS_SECTION_NAME ".ctors"
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
-#define DTORS_SECTION_NAME ".dtors"
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
-
/* There's no point providing a default definition of __CTOR_LIST__
since people are expected either to use crtbegin.o, or an equivalent,
or provide their own definition. */
@@ -274,16 +251,14 @@ do { \
/* A list of other sections which the compiler might be "in" at any
given time. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_rdata, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_sdata, in_rdata
#define INVOKE__main
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(ctors_section, in_ctors, CTORS_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(dtors_section, in_dtors, DTORS_SECTION_ASM_OP)
+ SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP)
#define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
void FN () \
@@ -294,47 +269,6 @@ void FN () \
in_section = ENUM; \
} \
}
-
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t", (Pmode == SImode) ? ".word" : ".dword"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\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(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t", (Pmode == SImode) ? ".word" : ".dword"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-#define CTOR_LIST_BEGIN \
-func_ptr __CTOR_LIST__ __attribute__((section(CTORS_SECTION_NAME))) = \
- (func_ptr) (-1)
-
-#define CTOR_LIST_END \
-func_ptr __CTOR_END__ __attribute__((section(CTORS_SECTION_NAME))) = \
- (func_ptr) 0
-
-#define DTOR_LIST_BEGIN \
-func_ptr __DTOR_LIST__ __attribute__((section(DTORS_SECTION_NAME))) = \
- (func_ptr) (-1)
-
-#define DTOR_LIST_END \
-func_ptr __DTOR_END__ __attribute__((section(DTORS_SECTION_NAME))) = \
- (func_ptr) 0
-
/* Don't set the target flags, this is done by the linker script */
#undef LIB_SPEC
#define LIB_SPEC ""
diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h
index 4e3a227..ee33487 100644
--- a/gcc/config/mips/iris6.h
+++ b/gcc/config/mips/iris6.h
@@ -242,8 +242,6 @@ Boston, MA 02111-1307, USA. */
#undef SUBTARGET_ASM_OPTIMIZING_SPEC
#define SUBTARGET_ASM_OPTIMIZING_SPEC "-O0"
-/* Stuff for constructors. Start here. */
-
/* The assembler now accepts .section pseudo-ops, but it does not allow
one to change the section in the middle of a function, so we can't use
the INIT_SECTION_ASM_OP code in crtstuff. But we can build up the ctor
@@ -254,38 +252,13 @@ Boston, MA 02111-1307, USA. */
#define CONST_SECTION_ASM_OP_32 "\t.rdata"
#define CONST_SECTION_ASM_OP_64 "\t.section\t.rodata"
-/* The IRIX 6 assembler .section directive takes four additional args:
- section type, flags, entry size, and alignment. The alignment of the
- .ctors and .dtors sections needs to be the same as the size of a pointer
- so that the linker doesn't add padding between elements. */
-#if defined (CRT_BEGIN) || defined (CRT_END)
-
-/* If we are included from crtstuff.c, these need to be plain strings.
- _MIPS_SZPTR is defined in SUBTARGET_CPP_SPEC above. */
-#if _MIPS_SZPTR == 64
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,1,2,0,8"
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,1,2,0,8"
-#else /* _MIPS_SZPTR != 64 */
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,1,2,0,4"
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,1,2,0,4"
-#endif /* _MIPS_SZPTR == 64 */
-
-#else /* ! (defined (CRT_BEGIN) || defined (CRT_END)) */
-
-/* If we are included from varasm.c, these need to depend on -mabi. */
-#define CTORS_SECTION_ASM_OP \
- (Pmode == DImode ? "\t.section\t.ctors,1,2,0,8" : "\t.section\t.ctors,1,2,0,4")
-#define DTORS_SECTION_ASM_OP \
- (Pmode == DImode ? "\t.section\t.dtors,1,2,0,8" : "\t.section\t.dtors,1,2,0,4")
-#endif /* defined (CRT_BEGIN) || defined (CRT_END) */
-
/* A default list of other sections which we might be "in" at any given
time. For targets that use additional sections (e.g. .tdesc) you
should override this definition in the target-specific file which
includes this file. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_rdata, in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_sdata, in_rdata, in_const
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
@@ -316,60 +289,12 @@ rdata_section () \
fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_32); \
in_section = in_rdata; \
} \
-} \
- CTORS_SECTION_FUNCTION \
- DTORS_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; \
- } \
}
-#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; \
- } \
-}
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", \
- (Pmode == DImode) ? ".dword" : ".word"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", \
- (Pmode == DImode) ? ".dword" : ".word"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* Switch into a generic section. */
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION iris6_asm_named_section
-/* Stuff for constructors. End here. */
-
/* ??? Perhaps just include svr4.h in this file? */
/* ??? SGI assembler may core dump when compiling with -g.
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index b917a78..c441198 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -1312,19 +1312,6 @@ do { \
#define OBJECT_FORMAT_COFF /* Object file looks like COFF */
#define EXTENDED_COFF /* ECOFF, not normal coff */
#endif
-
-#if 0 /* These definitions normally have no effect because
- MIPS systems define USE_COLLECT2, so
- assemble_constructor does nothing anyway. */
-
-/* Don't use the default definitions, because we don't have gld.
- Also, we don't want stabs when generating ECOFF output.
- Instead we depend on collect to handle these. */
-
-#define ASM_OUTPUT_CONSTRUCTOR(file, name)
-#define ASM_OUTPUT_DESTRUCTOR(file, name)
-
-#endif /* 0 */
/* Target machine storage layout */
diff --git a/gcc/config/mips/rtems64.h b/gcc/config/mips/rtems64.h
index ccec732..7a455e5 100644
--- a/gcc/config/mips/rtems64.h
+++ b/gcc/config/mips/rtems64.h
@@ -30,13 +30,6 @@ Boston, MA 02111-1307, USA. */
#define TARGET_MEM_FUNCTIONS
#endif
-/* Undefine the following which were defined in elf64.h. This will cause the rtems64
- port to continue to use collect2 for constructors/destructors. These may be removed
- when .ctor/.dtor section support is desired. */
-
-#undef CTORS_SECTION_ASM_OP
-#undef DTORS_SECTION_ASM_OP
-
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_rdata
@@ -49,14 +42,6 @@ Boston, MA 02111-1307, USA. */
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP)
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-
-#undef CTOR_LIST_BEGIN
-#undef CTOR_LIST_END
-#undef DTOR_LIST_BEGIN
-#undef DTOR_LIST_END
-
#undef STARTFILE_SPEC
#undef ENDFILE_SPEC
diff --git a/gcc/config/mips/vxworks.h b/gcc/config/mips/vxworks.h
index 7d48662..ec6e13b 100644
--- a/gcc/config/mips/vxworks.h
+++ b/gcc/config/mips/vxworks.h
@@ -17,13 +17,6 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* Undefine the following which were defined in elf.h. Thise will cause the mips-vxworks
- port to continue to use collect2 for constructors/destructors. This entire file may
- be removed when .ctor/.dtor section support is desired. */
-
-#undef CTORS_SECTION_ASM_OP
-#undef DTORS_SECTION_ASM_OP
-
#undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_rdata, in_sbss
@@ -37,15 +30,5 @@ Boston, MA 02111-1307, USA. */
SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \
SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP)
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-
-#undef CTOR_LIST_BEGIN
-#undef CTOR_LIST_END
-#undef DTOR_LIST_BEGIN
-#undef DTOR_LIST_END
-
#undef STARTFILE_SPEC
#undef ENDFILE_SPEC
-
-/* End of undefines to turn off .ctor/.dtor section support */
diff --git a/gcc/config/netware.h b/gcc/config/netware.h
index a28a9d0..2438a56 100644
--- a/gcc/config/netware.h
+++ b/gcc/config/netware.h
@@ -80,15 +80,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
given time. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const
/* A list of extra section function definitions. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
+ CONST_SECTION_FUNCTION
#undef CONST_SECTION_FUNCTION
#define CONST_SECTION_FUNCTION \
@@ -102,48 +100,4 @@ const_section () \
} \
}
-#undef 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; \
- } \
-}
-
-#undef 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; \
- } \
-}
-
#define INT_ASM_OP ".long"
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
diff --git a/gcc/config/nextstep.c b/gcc/config/nextstep.c
index f15ae04..94492d4 100644
--- a/gcc/config/nextstep.c
+++ b/gcc/config/nextstep.c
@@ -89,3 +89,24 @@ handle_pragma (p_getc, p_ungetc, pname)
return retval;
}
+
+void
+nextstep_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ constructor_section ();
+ assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+ fprintf (asm_out_file, ".reference .constructors_used\n");
+}
+
+void
+nextstep_asm_out_destructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ destructor_section ();
+ assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+ fprintf (asm_out_file, ".reference .destructors_used\n");
+}
+
diff --git a/gcc/config/nextstep.h b/gcc/config/nextstep.h
index d32675c..7bb9681 100644
--- a/gcc/config/nextstep.h
+++ b/gcc/config/nextstep.h
@@ -212,25 +212,10 @@ Boston, MA 02111-1307, USA. */
#define INIT_SECTION_ASM_OP
#undef INVOKE__main
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { constructor_section (); \
- ASM_OUTPUT_ALIGN (FILE, 1); \
- fprintf (FILE, "\t.long "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- fprintf (FILE, ".reference .constructors_used\n"); \
- } while (0)
-
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { destructor_section (); \
- ASM_OUTPUT_ALIGN (FILE, 1); \
- fprintf (FILE, "\t.long "); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- fprintf (FILE, ".reference .destructors_used\n"); \
- } while (0)
+#define TARGET_ASM_CONSTRUCTOR nextstep_asm_out_constructor
+#define TARGET_ASM_DESTRUCTOR nextstep_asm_out_destructor
+extern void nextstep_asm_out_constructor PARAMS ((struct rtx_def *, int));
+extern void nextstep_asm_out_destructor PARAMS ((struct rtx_def *, int));
/* ??? Should be changed to EH_FRAME_SECTION_NAME, but that requires
named section support. Based on this definition, it seems clear
diff --git a/gcc/config/nextstep21.h b/gcc/config/nextstep21.h
index aa2c443..40004d1 100644
--- a/gcc/config/nextstep21.h
+++ b/gcc/config/nextstep21.h
@@ -37,8 +37,8 @@ Boston, MA 02111-1307, USA. */
#define INVOKE__main
/* We call the global destructors, constructors from __main */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
+#undef TARGET_ASM_CONSTRUCTOR
+#undef TARGET_ASM_DESTRUCTOR
#undef ASM_FILE_END
#define ASM_FILE_END(FILE) \
diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h
index bc2cc92..2df1615 100644
--- a/gcc/config/pa/pa64-hpux.h
+++ b/gcc/config/pa/pa64-hpux.h
@@ -101,24 +101,6 @@ do { \
#define CONST_SECTION_ASM_OP "\t.section\t.rodata"
-/* 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.) */
-
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
-
/* On svr4, we *do* have support for the .init and .fini sections, and we
can put stuff in there to be executed before and after `main'. We let
crtstuff.c and other files know this by defining the following symbols.
@@ -137,7 +119,7 @@ do { \
includes this file. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
@@ -145,9 +127,8 @@ do { \
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
+ CONST_SECTION_FUNCTION
+
#define READONLY_DATA_SECTION() const_section ()
@@ -164,28 +145,6 @@ const_section () \
} \
}
-#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; \
- } \
-}
-
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
@@ -222,29 +181,6 @@ do { \
} while (0)
#define INT_ASM_OP "\t.dword\t"
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%sP%%", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%sP%%", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* ??? For the time being, we aren't using .ctors/.dtors sections. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#undef ASM_OUTPUT_CONSTRUCTOR
/* Define the strings used for the special svr4 .type and .size directives.
These strings generally do not vary from one system running svr4 to
diff --git a/gcc/config/psos.h b/gcc/config/psos.h
index 6f67f35..26be5ef 100644
--- a/gcc/config/psos.h
+++ b/gcc/config/psos.h
@@ -76,77 +76,6 @@ Boston, MA 02111-1307, USA.
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
-/* Define the pseudo-ops used to switch to the .ctors and .dtors
- sections. */
-
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
-
-/* A default list of other sections which we might be "in" at any given
- time. For targets that use additional sections (e.g. .tdesc) you
- should override this definition in the target-specific file which
- includes this file. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctors, in_dtors
-
-/* A default list of extra section function definitions. For targets
- that use additional sections (e.g. .tdesc) you should override this
- definition in the target-specific file which includes this file. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- CTORS_SECTION_FUNCTION \
- DTORS_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; \
- } \
-}
-
-#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; \
- } \
-}
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-
-#ifndef INT_ASM_OP
-#define INT_ASM_OP "\t.long\t"
-#endif
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-
/* Use DBX debugging info by default. */
#ifndef PREFERRED_DEBUGGING_TYPE
diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h
index f5b39e5..428ab43 100644
--- a/gcc/config/rs6000/aix.h
+++ b/gcc/config/rs6000/aix.h
@@ -30,10 +30,6 @@ Boston, MA 02111-1307, USA. */
/* This is the only version of nm that collect2 can work with. */
#define REAL_NM_FILE_NAME "/usr/ucb/nm"
-/* AIX does not have any init/fini or ctor/dtor sections, so create
- static constructors and destructors as normal functions. */
-/* #define ASM_OUTPUT_CONSTRUCTOR(file, name) */
-/* #define ASM_OUTPUT_DESTRUCTOR(file, name) */
#define USER_LABEL_PREFIX ""
/* Don't turn -B into -L if the argument specifies a relative file name. */
#define RELATIVE_PREFIX_NOT_LINKDIR
diff --git a/gcc/config/rs6000/lynx.h b/gcc/config/rs6000/lynx.h
index 646c987..8b755fc 100644
--- a/gcc/config/rs6000/lynx.h
+++ b/gcc/config/rs6000/lynx.h
@@ -38,10 +38,6 @@ Boston, MA 02111-1307, USA. */
#undef ASM_GENERATE_INTERNAL_LABEL
#undef ASM_OUTPUT_COMMON
#undef ASM_OUTPUT_LOCAL
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
-#undef CTORS_SECTION_FUNCTION
-#undef DTORS_SECTION_FUNCTION
#undef SDB_DEBUGGING_INFO
#undef DBX_DEBUGGING_INFO
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 2851d70..f52efa6 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -444,14 +444,12 @@ do { \
/* Besides the usual ELF sections, we need a toc section. */
/* Override elfos.h definition. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
+#define EXTRA_SECTIONS in_const, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
/* Override elfos.h definition. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
TOC_SECTION_FUNCTION \
SDATA_SECTION_FUNCTION \
SDATA2_SECTION_FUNCTION \
@@ -557,6 +555,13 @@ fini_section () \
} \
}
+/* Ordinarily, we wouldn't need to define these, since generic code would
+ do the right thing based on knowing that we have named sections.
+ However, -mrelocatable needs to know when we're in [cd]tors sections,
+ and the easiest way to do that is rely on varasm.c defining in_[cd]tors. */
+#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\""
+#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\""
+
/* A C statement or statements to switch to the appropriate section
for output of RTX in mode MODE. You can assume that RTX is some
kind of constant in RTL. The argument MODE is redundant except in
@@ -919,46 +924,6 @@ do { \
asm_fprintf (FILE, "%U%s", _name); \
} while (0)
-/* Override elfos.h definition. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- if (DEFAULT_ABI != ABI_SOLARIS) \
- { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- } \
- else \
- { \
- init_section (); \
- fputs ("\tbl ", FILE); \
- assemble_name (FILE, NAME); \
- } \
- fputs ("\n", FILE); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-/* Override elfos.h definition. */
-#undef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- if (DEFAULT_ABI != ABI_SOLARIS) \
- { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- } \
- else \
- { \
- fini_section (); \
- fputs ("\tbl ", FILE); \
- assemble_name (FILE, NAME); \
- } \
- fputs ("\n", FILE); \
- } while (0)
-
/* But, to make this work, we have to output the stabs for the function
name *first*... */
diff --git a/gcc/config/sh/elf.h b/gcc/config/sh/elf.h
index 183fa96..761b1fb 100644
--- a/gcc/config/sh/elf.h
+++ b/gcc/config/sh/elf.h
@@ -36,11 +36,7 @@ Boston, MA 02111-1307, USA. */
#undef ASM_FILE_END
#undef ASM_OUTPUT_SOURCE_LINE
#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
-#undef CTORS_SECTION_ASM_OP
-#undef DTORS_SECTION_ASM_OP
#undef TARGET_ASM_NAMED_SECTION
-#undef ASM_OUTPUT_CONSTRUCTOR
-#undef ASM_OUTPUT_DESTRUCTOR
#undef ASM_DECLARE_FUNCTION_NAME
#undef MAX_OFILE_ALIGNMENT
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 1377610..9a2c347 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1897,28 +1897,6 @@ while (0)
#define TEXT_SECTION_ASM_OP "\t.text"
#define DATA_SECTION_ASM_OP "\t.data"
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors\n"
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors\n"
-#define EXTRA_SECTIONS in_ctors, in_dtors
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-ctors_section() \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-} \
-void \
-dtors_section() \
-{ \
- if (in_section != in_dtors) \
- { \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
- } \
-}
/* If defined, a C expression whose value is a string containing the
assembler operation to identify the following data as
@@ -1956,32 +1934,7 @@ dtors_section() \
#define INT_ASM_OP "\t.long\t"
-/* A C statement (sans semicolon) to output an
- element in the table of global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
- do \
- { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } \
- while (0)
-
-/* A C statement (sans semicolon) to output an
- element in the table of global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do \
- { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } \
- while (0)
-
#undef DO_GLOBAL_CTORS_BODY
-
#define DO_GLOBAL_CTORS_BODY \
{ \
typedef (*pfunc)(); \
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
index 3481c4b..d72f57f 100644
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -387,31 +387,3 @@ do { \
: /* no outputs */ \
: "r" (ms_flags), "r" (ms_saveret));
#endif /* sparc32 */
-
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- if (TARGET_ARCH64) \
- fprintf (FILE, "\t%s\t ", ASM_LONGLONG); \
- else \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\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(FILE,NAME) \
- do { \
- dtors_section (); \
- if (TARGET_ARCH64) \
- fprintf (FILE, "\t%s\t ", ASM_LONGLONG); \
- else \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
diff --git a/gcc/config/sparc/litecoff.h b/gcc/config/sparc/litecoff.h
index c662eb3..e2340c3 100644
--- a/gcc/config/sparc/litecoff.h
+++ b/gcc/config/sparc/litecoff.h
@@ -42,72 +42,19 @@ Boston, MA 02111-1307, USA. */
#undef INIT_SECTION_ASM_OP
-/* Support the ctors and dtors sections for g++. */
-
-#undef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\""
-#undef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"x\""
-
/* A list of other sections which the compiler might be "in" at any
given time. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_const
/* A list of extra section function definitions. */
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
- CONST_SECTION_FUNCTION \
- CTORS_SECTION_FUNCTION \
- DTORS_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; \
- } \
-}
-
-#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; \
- } \
-}
+ CONST_SECTION_FUNCTION
#define INT_ASM_OP "\t.long\t"
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\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(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
#undef DO_GLOBAL_CTORS_BODY
#undef DO_GLOBAL_DTORS_BODY
diff --git a/gcc/config/sparc/sol2-sld-64.h b/gcc/config/sparc/sol2-sld-64.h
index 9179635..21545f2 100644
--- a/gcc/config/sparc/sol2-sld-64.h
+++ b/gcc/config/sparc/sol2-sld-64.h
@@ -329,32 +329,4 @@
#endif /* ! SPARC_BI_ARCH */
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- if (TARGET_ARCH64) \
- fprintf (FILE, "\t%s\t ", ASM_LONGLONG); \
- else \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\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(FILE,NAME) \
- do { \
- dtors_section (); \
- if (TARGET_ARCH64) \
- fprintf (FILE, "\t%s\t ", ASM_LONGLONG); \
- else \
- fprintf (FILE, "%s", INT_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
#endif
diff --git a/gcc/config/svr3.h b/gcc/config/svr3.h
index 5e732af..6f26fde 100644
--- a/gcc/config/svr3.h
+++ b/gcc/config/svr3.h
@@ -211,14 +211,13 @@ Boston, MA 02111-1307, USA.
and CTOR_LIST_END to contribute to the .init section an instruction to
push a word containing 0 (or some equivalent of that).
- Define ASM_OUTPUT_CONSTRUCTOR to push the address of the constructor. */
+ Define TARGET_ASM_CONSTRUCTOR to push the address of the constructor. */
#define USE_CONST_SECTION 0
#define INIT_SECTION_ASM_OP "\t.section\t.init"
#define FINI_SECTION_ASM_OP "\t.section .fini,\"x\""
#define CONST_SECTION_ASM_OP "\t.section\t.rodata, \"x\""
-#define CTORS_SECTION_ASM_OP INIT_SECTION_ASM_OP
#define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP
/* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent
@@ -297,45 +296,6 @@ const_section () \
} \
}
-/* The ctors and dtors sections are not normally put into use
- by EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS as defined in svr3.h,
- but it can't hurt to define these macros for whatever systems use them. */
-#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; \
- } \
-}
-
-/* This is machine-dependent
- because it needs to push something on the stack. */
-#undef ASM_OUTPUT_CONSTRUCTOR
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- fini_section (); \
- fprintf (FILE, "%s\t ", ASM_LONG); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
or a constant of some sort. RELOC indicates whether forming
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index e8a13dc..df4f76e 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -38,6 +38,10 @@ Boston, MA 02111-1307, USA. */
#include "target-def.h"
static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
+#if VMS_TARGET
+static void vms_asm_out_constructor PARAMS ((rtx, int));
+static void vms_asm_out_destructor PARAMS ((rtx, int));
+#endif
/* Initialize the GCC target structure. */
#undef TARGET_ASM_FUNCTION_PROLOGUE
@@ -833,11 +837,34 @@ vms_flush_pending_externals (file)
fprintf (file, ",%d\n", p->size);
}
}
+
+static void
+vms_asm_out_constructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ fprintf (asm_out_file,".globl $$PsectAttributes_NOOVR$$__gxx_init_1\n");
+ data_section();
+ fprintf (asm_out_file,"$$PsectAttributes_NOOVR$$__gxx_init_1:\n\t.long\t");
+ assemble_name (asm_out_file, XSTR (symbol, 0));
+ fputc ('\n', asm_out_file);
+}
+
+static void
+vms_asm_out_destructor (symbol, priority)
+ rtx symbol;
+ int priority ATTRIBUTE_UNUSED;
+{
+ fprintf (asm_out_file,".globl $$PsectAttributes_NOOVR$$__gxx_clean_1\n");
+ data_section();
+ fprintf (asm_out_file,"$$PsectAttributes_NOOVR$$__gxx_clean_1:\n\t.long\t");
+ assemble_name (asm_out_file, XSTR (symbol, 0));
+ fputc ('\n', asm_out_file);
+}
#endif /* VMS_TARGET */
-#ifdef VMS
/* Additional support code for VMS host. */
-
+/* ??? This should really be in libiberty; vax.c is a target file. */
#ifdef QSORT_WORKAROUND
/*
Do not use VAXCRTL's qsort() due to a severe bug: once you've
@@ -845,7 +872,7 @@ vms_flush_pending_externals (file)
and is longword aligned, you cannot safely sort anything which
is either not a multiple of 4 in size or not longword aligned.
A static "move-by-longword" optimization flag inside qsort() is
- never reset. This is known of affect VMS V4.6 through VMS V5.5-1,
+ never reset. This is known to affect VMS V4.6 through VMS V5.5-1,
and was finally fixed in VMS V5.5-2.
In this work-around an insertion sort is used for simplicity.
@@ -919,5 +946,3 @@ not_qsort (array, count, size, compare)
return;
}
#endif /* QSORT_WORKAROUND */
-
-#endif /* VMS */
diff --git a/gcc/config/vax/vms.h b/gcc/config/vax/vms.h
index ccc1715..52f4d27 100644
--- a/gcc/config/vax/vms.h
+++ b/gcc/config/vax/vms.h
@@ -248,27 +248,8 @@ const_section () \
that are needed to tell the startup code which constructors need to
be run. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
-{ \
- fprintf ((FILE),".globl $$PsectAttributes_NOOVR$$__gxx_init_1\n"); \
- data_section(); \
- fprintf ((FILE),"$$PsectAttributes_NOOVR$$__gxx_init_1:\n\t.long\t"); \
- assemble_name ((FILE), (NAME)); \
- fputc ('\n', (FILE)); \
-}
-
-/* This is used by a hook in varasm.c to write the assembler directives
- that are needed to tell the startup code which destructors need to
- be run. */
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
-{ \
- fprintf ((FILE),".globl $$PsectAttributes_NOOVR$$__gxx_clean_1\n"); \
- data_section(); \
- fprintf ((FILE),"$$PsectAttributes_NOOVR$$__gxx_clean_1:\n\t.long\t");\
- assemble_name ((FILE), (NAME)); \
- fputc ('\n', (FILE)); \
-}
+#define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
+#define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
/* The following definitions are used in libgcc2.c with the __main
function. The _SHR symbol is used when the sharable image library