]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move constructor/destructor handling into target hooks.
authorRichard Henderson <rth@redhat.com>
Thu, 9 Aug 2001 22:33:35 +0000 (15:33 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 9 Aug 2001 22:33:35 +0000 (15:33 -0700)
From-SVN: r44747

96 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/c-decl.c
gcc/ch/ChangeLog
gcc/ch/grant.c
gcc/config.gcc
gcc/config/1750a/1750a.h
gcc/config/a29k/a29k.c
gcc/config/a29k/udi.h [deleted file]
gcc/config/alpha/alpha-interix.h
gcc/config/alpha/alpha.c
gcc/config/alpha/elf.h
gcc/config/alpha/vms.h
gcc/config/arc/arc.h
gcc/config/arm/aof.h
gcc/config/arm/coff.h
gcc/config/arm/elf.h
gcc/config/c4x/c4x.c
gcc/config/c4x/c4x.h
gcc/config/clipper/clipper.c
gcc/config/clipper/clix.h
gcc/config/d30v/d30v.h
gcc/config/darwin-protos.h
gcc/config/darwin.c
gcc/config/darwin.h
gcc/config/elfos.h
gcc/config/h8300/h8300.h
gcc/config/i386/aix386.h
gcc/config/i386/aix386ng.h
gcc/config/i386/cygwin.h
gcc/config/i386/djgpp.h
gcc/config/i386/i386-coff.h
gcc/config/i386/i386-interix.h
gcc/config/i386/i386.c
gcc/config/i386/sco5.h
gcc/config/i386/svr3gas.h
gcc/config/i386/sysv3.h
gcc/config/i386/vsta.h
gcc/config/i386/win32.h
gcc/config/i960/i960-coff.h
gcc/config/ia64/sysv4.h
gcc/config/lynx.h
gcc/config/m68hc11/m68hc11.c
gcc/config/m68hc11/m68hc11.h
gcc/config/m68k/auxgas.h
gcc/config/m68k/coff.h
gcc/config/m68k/dpx2.h
gcc/config/m68k/dpx2g.h
gcc/config/m68k/m68k.c
gcc/config/m68k/mot3300.h
gcc/config/m68k/tower-as.h
gcc/config/m88k/m88k.c
gcc/config/m88k/m88k.h
gcc/config/m88k/sysv3.h
gcc/config/mcore/mcore-pe.h
gcc/config/mcore/mcore.h
gcc/config/mips/elf.h
gcc/config/mips/elf64.h
gcc/config/mips/iris6.h
gcc/config/mips/mips.h
gcc/config/mips/rtems64.h
gcc/config/mips/vxworks.h
gcc/config/netware.h
gcc/config/nextstep.c
gcc/config/nextstep.h
gcc/config/nextstep21.h
gcc/config/pa/pa64-hpux.h
gcc/config/psos.h
gcc/config/rs6000/aix.h
gcc/config/rs6000/lynx.h
gcc/config/rs6000/sysv4.h
gcc/config/sh/elf.h
gcc/config/sh/sh.h
gcc/config/sparc/linux64.h
gcc/config/sparc/litecoff.h
gcc/config/sparc/sol2-sld-64.h
gcc/config/svr3.h
gcc/config/vax/vax.c
gcc/config/vax/vms.h
gcc/configure
gcc/configure.in
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/crtstuff.c
gcc/defaults.h
gcc/doc/tm.texi
gcc/java/ChangeLog
gcc/java/Make-lang.in
gcc/java/class.c
gcc/objc/Make-lang.in
gcc/objc/objc-act.c
gcc/output.h
gcc/profile.c
gcc/target-def.h
gcc/target.h
gcc/varasm.c

index 92b43523b8b4025baef4c55a2e5f3747cb2dd95c..2ebe5cde0e1d212d7e64a81e0f4eb775f54368ba 100644 (file)
@@ -1,3 +1,163 @@
+2001-08-09  Richard Henderson  <rth@redhat.com>
+
+       * Makefile.in (MAYBE_USE_COLLECT2): Remove; purge all uses.
+       (USE_COLLECT2): Remove duplicate definition.
+       * config.gcc (a29k-udi, a29k-wrs-vxworks) [tm_file]: Remove a29k/udi.h.
+       (use_collect2): Remove dead code.
+       * configure.in (use_collect2): Remove will_use_collect2 and
+       maybe_use_collect2; add USE_COLLECT2 to host_xm_defines and xm_defines.
+       * configure: Rebuild.
+
+       * target.h (targetm.asm_out.constructor): New.
+       (targetm.asm_out.destructor, targetm.have_ctors_dtors): New.
+       * target-def.h (TARGET_ASM_CONSTRUCTOR): New.
+       (TARGET_ASM_DESTRUCTOR, TARGET_HAVE_CTORS_DTORS): New.
+       * varasm.c (in_ctors, in_dtors): New.
+       (assemble_constructor, assemble_destructor): Remove.
+       (default_stabs_asm_out_destructor): New.
+       (default_named_section_asm_out_destructor): New.
+       (dtors_section, default_dtor_section_asm_out_destructor): New.
+       (default_stabs_asm_out_constructor): New.
+       (default_named_section_asm_out_constructor): New.
+       (ctors_section, default_ctor_section_asm_out_constructor): New.
+       * output.h: Update declarations.
+       * c-decl.c (c_expand_body): Use target hooks instead of
+       assemble_constructor and assemble_destructor.
+       * profile.c (output_func_start_profiler): Likewise.
+       * objc/objc-act.c (finish_objc): Likewise.
+       (build_module_descriptor): Tidy.  Set TREE_PUBLIC properly
+       for the constructor.
+       * objc/Make-lang.in (objc-act.o): Depend on TARGET_H.
+
+       * crtstuff.c (CTORS_SECTION_ASM_OP): Don't define.
+       (DTORS_SECTION_ASM_OP): Likewise.
+       (__CTOR_LIST__): Use attribute section when possible.
+       (__DTOR_LIST__, __CTOR_END__, __DTOR_END__): Likewise.
+
+       * defaults.h (EH_FRAME_SECTION_NAME): Don't depend on
+       ASM_OUTPUT_CONSTRUCTOR.
+
+       * config/darwin.c (machopic_asm_out_constructor): New.
+       (machopic_asm_out_destructor): New.
+       * config/darwin-protos.h: Update declarations.
+       * config/darwin.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (ASM_OUTPUT_DESTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR, TARGET_ASM_DESTRUCTOR): New.
+       * config/nextstep.c (nextstep_asm_out_constructor): New.
+       (nextstep_asm_out_destructor): New.
+       * config/nextstep.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (ASM_OUTPUT_DESTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR, TARGET_ASM_DESTRUCTOR): New.
+       * config/nextstep21.h: Undef TARGET_ASM_*STRUCTOR instead of
+       ASM_OUTPUT_*STRUCTOR.
+       * config/i386/aix386ng.h: Likewise.
+
+       * config/elfos.h (CTORS_SECTION_ASM_OP, DTORS_SECTION_ASM_OP): Remove.
+       (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): No ctors/dtors.
+       (CTORS_SECTION_FUNCTION, DTORS_SECTION_FUNCTION): Remove.
+       (ASM_OUTPUT_CONSTRUCTOR, ASM_OUTPUT_DESTRUCTOR): Remove.
+       * config/lynx.h: Likewise.
+       * config/netware.h: Likewise.
+       * config/psos.h: Likewise.
+       * config/alpha/alpha-interix.h: Likewise.
+       * config/alpha/elf.h: Likewise.
+       * config/arc/arc.h: Likewise.
+       * config/arm/aof.h: Likewise.
+       * config/arm/coff.h: Likewise.
+       * config/arm/elf.h: Likewise.
+       * config/c4x/c4x.h: Likewise.
+       * config/h8300/h8300.h: Likewise.
+       * config/i386/cygwin.h: Likewise.
+       * config/i386/djgpp.h: Likewise.
+       * config/i386/i386-coff.h: Likewise.
+       * config/i386/i386-interix.h: Likewise.
+       * config/i386/sco5.h: Likewise.
+       * config/i386/vsta.h: Likewise.
+       * config/i386/win32.h: Likewise.
+       * config/i960/i960-coff.h: Likewise.
+       * config/ia64/sysv4.h: Likewise.
+       * config/m68hc11/m68hc11.h: Likewise.
+       * config/m68k/coff.h: Likewise.
+       * config/m68k/mot3300.h: Likewise.
+       * config/m88k/m88k.h: Likewise.
+       * config/mcore/mcore-pe.h: Likewise.
+       * config/mcore/mcore.h: Likewise.
+       * config/mips/elf.h: Likewise.
+       * config/mips/elf64.h: Likewise.
+       * config/mips/iris6.h: Likewise.
+       * config/pa/pa64-hpux.h: Likewise.
+       * config/rs6000/sysv4.h: Likewise.
+       * config/sh/sh.h: Likewise.
+       * config/sparc/litecoff.h: Likewise.
+
+       * config/svr3.h (CTORS_SECTION_ASM_OP): Remove.
+       (CTORS_SECTION_FUNCTION, DTORS_SECTION_FUNCTION): Remove.
+       (ASM_OUTPUT_CONSTRUCTOR, ASM_OUTPUT_DESTRUCTOR): Remove.
+       * config/1750a/1750a.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (ASM_OUTPUT_DESTRUCTOR): Remove.
+       * config/a29k/a29k.c: Move include of tree.h.
+       * config/a29k/udi.h: Delete file.
+       * config/alpha/alpha.c (vms_asm_out_constructor): New.
+       (vms_asm_out_destructor): New.
+       * config/alpha/vms.h (EXTRA_SECTIONS): No ctors/dtors.
+       (EXTRA_SECTION_FUNCTIONS): Likewise.
+       (ASM_OUTPUT_CONSTRUCTOR, ASM_OUTPUT_DESTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR, TARGET_ASM_DESTRUCTOR): New.
+       * config/c4x/c4x.c: Move include of tree.h.
+       * config/clipper/clipper.c (clix_asm_out_constructor): New.     
+       (clix_asm_out_destructor): New.
+       * config/clipper/clix.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (ASM_OUTPUT_DESTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR, TARGET_ASM_DESTRUCTOR): New.
+       * config/i386/aix386.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR): New.
+       * config/i386/i386.c (ix86_svr3_asm_out_constructor): New.
+       (sco_asm_out_constructor): New.
+       * config/i386/sco5.h (TARGET_ASM_CONSTRUCTOR): New.
+       * config/i386/svr3gas.h: Remove stack grows up code.
+       Remove code duplicated from i386/sysv3.h.
+       (TARGET_ASM_CONSTRUCTOR): New.
+       (ASM_OUTPUT_CONSTRUCTOR, ASM_OUTPUT_DESTRUCTOR): Remove.
+       (DTORS_SECTION_FUNCTION, CTORS_SECTION_FUNCTION): Remove.
+       * config/i386/sysv3.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR): New.
+       * config/m68hc11/m68hc11.c (m68hc11_asm_out_constructor): New.
+       (m68hc11_asm_out_destructor): New.
+       * config/m68hc11/m68hc11.h (TARGET_ASM_CONSTRUCTOR): New.
+       (TARGET_ASM_DESTRUCTOR): New.
+       * config/m68k/auxgas.h: Don't undef ASM_OUTPUT_*STRUCTOR.
+       * config/m68k/dpx2.h: Properly undef all the bits inherited from
+       config/svr3.h pertaining to section manipulation.
+       * config/m68k/dpx2g.h: Remove #if 0 code.
+       * config/m68k/m68k.c (m68k_svr3_asm_out_constructor): New.
+       * config/m68k/tower-as.h (ASM_OUTPUT_SOURCE_LINE): Fix typo.
+       (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR): New.
+       * config/m88k/m88k.c (m88k_layout_frame): Don't use assign_stack_local.
+       (m88k_svr3_asm_out_constructor): New.
+       (m88k_svr3_asm_out_destructor): New.
+       * config/m88k/sysv3.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (ASM_OUTPUT_DESTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR, TARGET_ASM_DESTRUCTOR): New.
+       * config/mips/mips.h: Remove #if 0 ASM_OUTPUT_*STRUCTOR code.
+       * config/rs6000/aix.h: Likewise.
+       * config/mips/rtems64.h: Don't undef removed constructor related bits.
+       * config/mips/vxworks.h: Likewise.
+       * config/rs6000/lynx.h: Likewise.
+       * config/sh/elf.h: Likewise.
+       * config/rs6000/sysv4.h (CTORS_SECTION_ASM_OP): New.
+       (DTORS_SECTION_ASM_OP): New.
+       * config/sparc/linux64.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (ASM_OUTPUT_DESTRUCTOR): Remove.
+       * config/sparc/sol2-sld-64.h: Likewise.
+       * config/vax/vax.c (vms_asm_out_constructor): New.
+       (vms_asm_out_destructor): New.
+       * config/vax/vms.h (ASM_OUTPUT_CONSTRUCTOR): Remove.
+       (ASM_OUTPUT_DESTRUCTOR): Remove.
+       (TARGET_ASM_CONSTRUCTOR, TARGET_ASM_DESTRUCTOR): New.
+
+       * doc/tm.texi (@node Initialization): Update.
+
 2001-08-09  Richard Henderson  <rth@redhat.com>
 
        * config/alpha/crtbegin.asm (__JCR_LIST__): New.
index bfa3a84dd27c32b85fc2731146caf385c968ed48..fb490f946195d85b0c13e7a06eeafd90a1a1585f 100644 (file)
@@ -409,12 +409,6 @@ EXTRA_GCC_OBJS =@host_extra_gcc_objs@
 # Often this is edited directly by `configure'.
 EXTRA_HEADERS =@extra_headers_list@
 
-# Set this to `collect2' to enable use of collect2.
-USE_COLLECT2 = @will_use_collect2@
-# If we might be using collect2, then this variable will be set to
-# -DUSE_COLLECT2.  toplev.c, collect2.c and libgcc2.c all need to
-# know if we may be using collect2.
-MAYBE_USE_COLLECT2 = @maybe_use_collect2@
 # It is convenient for configure to add the assignment at the beginning,
 # so don't override it here.
 USE_COLLECT2 = collect2$(exeext)
@@ -1058,7 +1052,7 @@ libgcc.a: $(LIBGCC_DEPS)
          RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \
          NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \
          LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
-         INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
+         INCLUDES="$(INCLUDES)" \
          CONFIG_H="$(TCONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
          LIB1ASMSRC='$(LIB1ASMSRC)' \
          MAKEOVERRIDES= \
@@ -1092,7 +1086,7 @@ stmp-multilib: $(LIBGCC_DEPS)
          RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \
          NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \
          LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
-         INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
+         INCLUDES="$(INCLUDES)" \
          CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
          LIB1ASMSRC='$(LIB1ASMSRC)' \
          MAKEOVERRIDES= \
@@ -1203,7 +1197,7 @@ collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
 collect2.o : collect2.c $(CONFIG_H) $(SYSTEM_H) gstab.h intl.h \
        $(OBSTACK_H) $(DEMANGLE_H) collect2.h version.h
        $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES)  \
-       -DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \
+       -DTARGET_MACHINE=\"$(target_alias)\" \
        -c $(srcdir)/collect2.c
 
 tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H) $(SYSTEM_H) collect2.h intl.h
@@ -1361,7 +1355,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) function.h \
    dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
    graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) \
    ssa.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H)
-       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
+       $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
          -DTARGET_NAME=\"$(target_alias)\" \
          -c $(srcdir)/toplev.c
 main.o : main.c toplev.h
@@ -1476,7 +1470,7 @@ conflict.o : conflict.c $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H) $(HASHTAB_H) \
    $(RTL_H) hard-reg-set.h $(BASIC_BLOCK_H)
 profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
    insn-config.h output.h $(REGS_H) $(EXPR_H) function.h \
-   gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H)
+   gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TARGET_H)
 loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h $(LOOP_H) insn-config.h \
    $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h $(PREDICT_H) \
    $(BASIC_BLOCK_H) function.h toplev.h varray.h except.h cselib.h $(TM_P_H)
@@ -2679,7 +2673,7 @@ install-libgcc: libgcc.mk libgcc.a installdirs
          RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \
          NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \
          LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
-         INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
+         INCLUDES="$(INCLUDES)" \
          CONFIG_H="$(TCONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
          LIB1ASMSRC='$(LIB1ASMSRC)' \
          MAKEOVERRIDES= \
@@ -2705,7 +2699,7 @@ install-multilib: stmp-multilib installdirs
          RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \
          NM_FOR_TARGET="$(NM_FOR_TARGET)" AWK="$(AWK)" \
          LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" \
-         INCLUDES="$(INCLUDES)" MAYBE_USE_COLLECT2="$(MAYBE_USE_COLLECT2)" \
+         INCLUDES="$(INCLUDES)" \
          CONFIG_H="$(CONFIG_H)" MACHMODE_H="$(MACHMODE_H)" \
          LIB1ASMSRC='$(LIB1ASMSRC)' \
          MAKEOVERRIDES= \
index 6c5056f875eab26aa8687f25c31dfaeebac1b3a4..490d96c99d857e9b79fa68249fb86873a1b1a00a 100644 (file)
@@ -6776,24 +6776,20 @@ c_expand_body (fndecl, nested_p)
 
   if (DECL_STATIC_CONSTRUCTOR (fndecl))
     {
-#ifndef ASM_OUTPUT_CONSTRUCTOR
-      if (! flag_gnu_linker)
-       static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
+      if (targetm.have_ctors_dtors)
+       (* targetm.asm_out.constructor) (XEXP (DECL_RTL (fndecl), 0),
+                                        DEFAULT_INIT_PRIORITY);
       else
-#endif
-       assemble_constructor (XEXP (DECL_RTL (fndecl), 0),
-                             DEFAULT_INIT_PRIORITY);
+       static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
     }
 
   if (DECL_STATIC_DESTRUCTOR (fndecl))
     {
-#ifndef ASM_OUTPUT_DESTRUCTOR
-      if (! flag_gnu_linker)
-       static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
+      if (targetm.have_ctors_dtors)
+       (* targetm.asm_out.destructor) (XEXP (DECL_RTL (fndecl), 0),
+                                       DEFAULT_INIT_PRIORITY);
       else
-#endif
-       assemble_destructor (XEXP (DECL_RTL (fndecl), 0),
-                            DEFAULT_INIT_PRIORITY);
+       static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
     }
 
   if (nested_p)
index b1c048b64ea5c74665972f16b5a50e3451d1a4db..f8fe135dcfb8597e80fb276d880b47404b82df28 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-09  Richard Henderson  <rth@redhat.com>
+
+       * grant.c (chill_finish_compile): Use target hooks instead of
+       assemble_constructor.
+
 2001-08-06  Richard Henderson  <rth@redhat.com>
 
        * grant.c (chill_finish_compile): Pass a symbol_ref and priority
index c10eb99dc20fee33a27dbe180e3a70dc65279910..806c944b0a969d2fa08a70d08fc73bbb61ae61a3 100644 (file)
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA.  */
 #include "tasking.h"
 #include "toplev.h"
 #include "output.h"
+#include "target.h"
 
 #define APPEND(X,Y) X = append (X, Y)
 #define PREPEND(X,Y) X = prepend (X, Y);
@@ -3046,12 +3047,9 @@ chill_finish_compile ()
 
       finish_chill_function ();
 
-      if (pass == 2)
-       {
-         assemble_constructor (XEXP (DECL_RTL (chill_init_function), 0),
-                               DEFAULT_INIT_PRIORITY);
-         globalize_decl (chill_init_function);
-       }
+      if (pass == 2 && targetm.have_ctors_dtors)
+       (* targetm.asm_out.constructor)
+         (XEXP (DECL_RTL (chill_init_function), 0), DEFAULT_INIT_PRIORITY);
 
       /* ready now to link decls onto this list in pass 2. */
       module_init_list = NULL_TREE;
index 087101dc865cee7ddf4698c4be8a559be3dcf16e..433e77c5ad06cba03d72a68ea4621b12a77434ee 100644 (file)
@@ -379,7 +379,7 @@ a29k-*-bsd* | a29k-*-sym1*)
        use_collect2=yes
        ;;
 a29k-*-udi | a29k-*-coff)
-       tm_file="${tm_file} dbxcoff.h a29k/udi.h"
+       tm_file="${tm_file} dbxcoff.h"
        tmake_file=a29k/t-a29kbare
        ;;
 a29k*-*-rtems*)
@@ -390,7 +390,7 @@ a29k*-*-rtems*)
        fi
        ;;
 a29k-wrs-vxworks*)
-       tm_file="${tm_file} dbxcoff.h a29k/udi.h a29k/vx29k.h"
+       tm_file="${tm_file} dbxcoff.h a29k/vx29k.h"
        tmake_file=a29k/t-vx29k
        extra_parts="crtbegin.o crtend.o"
        thread_file='vxworks'
@@ -519,6 +519,9 @@ alpha*-dec-vms*)
        xm_file=alpha/xm-vms.h
        tmake_file="alpha/t-alpha alpha/t-vms alpha/t-ieee"
        ;;
+arc-*-elf*)
+       extra_parts="crtinit.o crtfini.o"
+       ;;
 arm*-*-rtems*)
        tm_file=arm/rtems-elf.h
        tmake_file="arm/t-arm-elf t-rtems"
@@ -526,9 +529,6 @@ arm*-*-rtems*)
          thread_file='rtems'
        fi
        ;;
-arc-*-elf*)
-       extra_parts="crtinit.o crtfini.o"
-       ;;
 arm-*-coff* | armel-*-coff*)
        tm_file=arm/coff.h
        tmake_file=arm/t-arm-coff
@@ -3378,15 +3378,6 @@ then
        fi
 fi
 
-# No need for collect2 if we have the GNU linker.
-# Actually, there is now; GNU ld doesn't handle the EH info or
-# collecting for shared libraries.
-#case x$gnu_ld in
-#xyes)
-#      use_collect2=
-#      ;;
-#esac
-
 # Save data on machine being used to compile GCC in build_xm_file.
 # Save data on host machine in vars host_xm_file and host_xmake_file.
 if test x$pass1done = x
index 72ee543a11cd60e6c50a08479b84d415442868a9..ac6e7ee6335173062197cfa329df898cb181e8c2 100644 (file)
@@ -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.
index a4905e6597cdad12962bab4824202931dab8be98..8d816b24f4cd5387f3b04ebf39399d41a7d44ef6 100644 (file)
@@ -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 (file)
index 1b35bb2..0000000
+++ /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)
index 4bbd98809ff5b03a7e1dd6576c8a094a2d6ac5fa..b396c865f8e13c97c1ac0375565d138fd778fb26 100644 (file)
@@ -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
index 345d95e2f6ba6e182f4d02b0748c1c3e8de89e62..ef65d72b6debfe50189d31199996810cae72defa 100644 (file)
@@ -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
index a8e89003be4a2361a0e090ee4da6bc4584602c24..c8e7667da82d0b460bb88dba29b9354cf1b7be1a 100644 (file)
@@ -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
index bc7e1e6afacd52ca1957f1672286090423602d19..506223cb85480f4c8231aadc7fa15f7e0d60a8a1 100644 (file)
@@ -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
index 9a7b270b5c27d98f40817bd2bb295ddfdab85195..07507a1d4dd02ceb806e99f676bd1e948aeecd25 100644 (file)
@@ -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 \
index 3b0baf57ac583bded43c358721ee894e70d0bab9..2721b8bbdebe760323ea67feb035d59a1674976c 100644 (file)
@@ -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                 \
index 11cb9bb1fca9cc698f8ab1b0ba30075e7e39407d..db057b917a3562aa66661e3103e5279c9b403282 100644 (file)
@@ -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;                                   \
-    }                                                          \
-}
 \f
 /* 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
 
index 102b53ae0c7274f279ee69b88dc9d54db6bf29ec..0c8cd03abb959f9466c8b7aaa3e74c35b52810ff 100644 (file)
@@ -227,30 +227,6 @@ Boston, MA 02111-1307, USA.  */
   while (0)
 #endif
 \f
-/* 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)           \
index da2f90d895cb48729218862bb90a15779f6325b3..add05c7f2ca4b9e8fecf9c4e15a75f7620a5fc25 100644 (file)
@@ -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"
index dba5e47807331ffbc9ce31d3493dbdcbb53924ee..607bc48b6e8076fc5768ba9e3eb38fccaaf3b7ce 100644 (file)
@@ -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
index 1e3118e84f34239f6027493e3a95129694dacebc..d92030d6524ac829d51031a6b1e2a026b1a0b6cf 100644 (file)
@@ -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);
+}
index 6aedd6ed7a4a1e89b5cef708adb2c960d4636f87..bce6979ea4121a3a8aebcbf2ab3185becb4b628d 100644 (file)
@@ -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.
index 44e2e276918e9cd406ad915fd9890ac8ca9154eb..e39f37c9f8c1be2bfaa0facc67bbf3da26a9c90e 100644 (file)
@@ -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
index 6eb5bfd02d9c6ddee0196fc2cd17a7012c4f5341..f911076cd1876ca004029e7aee7233b590e17808 100644 (file)
@@ -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
index 65311a3a61583e8be7265f2872c79abc5870dea6..f2bd5bd614a35530ced2f559bc5bccaeb9fffca7 100644 (file)
@@ -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");
+}
index 5cebd58b7e7801160513e6d8b2b7954908531665..193a523be7a2aef8d2f611a974938662f1a6da52 100644 (file)
@@ -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
index 82dde08c758e1ae6e0501bf92db1d20861442c2a..d813678682e4fc0529fd9cc6428f0a59119456a9 100644 (file)
@@ -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
 
index f419ba4b1d0037ebf3a32745234c801726a2197c..735a42305a330f2899c49f07af60e69c06fbb9f7 100644 (file)
@@ -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[];                      \
index a9115ad5ce73361d8d6d11fef5f01496f9435685..f085c4210fe5c8686e38e325f706514b3ba9a8a2 100644 (file)
@@ -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
index 02f9502bba9289b83cc9ef0ead2eadd22b01f89b..445d333f784a11de6026f9b597d26257ca7f8696 100644 (file)
@@ -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
index 9ea367f3a8fcb53fa26b0926c060c2aa9924d809..71b84684545cb332698e3e32c0bb20a15b144ab9 100644 (file)
@@ -199,39 +199,13 @@ union tree_node;
 
 \f
 #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. */
 
index f5e79c2ba0fd68f62c0dabbe5a1309a42d132763..0bde4982583faf834b947b41aec28a82e557d30e 100644 (file)
@@ -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.  */
 
index 69839e17276bb7b46d7ea3bd895b5152816bca7a..c1ae670e117e4d075fe35fca3556edb9a6821119 100644 (file)
@@ -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 */
index 864f5200c7c7a743465cc396e9bc1c32d6ce791b..5b1141066b11c02be5b1d9617826314c2f24888f 100644 (file)
@@ -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
index 6508625dc78e5f2f7f81e5d02568d79816314757..aae281ca4c33557a590a3093caf284f7edb7b5ab 100644 (file)
@@ -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
 \f
 /* 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
index b7a7cdbfd294d08f873e4a96fc3184f12dd4d6a0..a818427082198ad67486399dfb2235669ac92751 100644 (file)
@@ -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 :                                                  \
index db4be5da68f705d281c10f50fbf93ebae88c15c2..8733ba7272458d036a19b5d6ed8a301bf2966830 100644 (file)
@@ -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()
-\f
-/* 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)
index 9d7350283d2f20b37c49cbe87d1695ceb07cda3d..8eb4bec8db227330974db12cce444349b8904ee8 100644 (file)
@@ -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
index e9479ef103a04cb2b1f2c03fdf45681538bda00f..1bb897d727956f33d9912cdb8fd06e4f86856d47 100644 (file)
@@ -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)
-
-
index 7e03383f29f94040b56891387b43eabd43f9919c..d2ab075f774d9dc3acb4f592bf243b6afdcf2784 100644 (file)
@@ -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).
index b1fed12d6156ff9e54d52cdacc42742e428a51ba..7f462153a6ce2b8e17a3300b0767635b368f1c13 100644 (file)
@@ -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 */
index ea9eb2f7014610f37207a16ed0fbf06c9a715033..39020722bb5316a36a2ea1b56f4ee46c0ce1f286 100644 (file)
@@ -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
 
index 7769be5634339c56764e6a6c32a0ef4aacafa0ff..a0594d8a25e8db56e74cfd46f4ec010801920d72 100644 (file)
@@ -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
 
index 119d8ee5e51a4bcca01fbd9b0c1d17b562d555e8..04516fe4c1535dc1ea28c8fe7097a2ea3fb20b6a 100644 (file)
@@ -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");
+}
index 777fb886b03b7327801f0ecab4d04c808019a39a..5697a6a3c8ba86f8933f0254fd31ffed2f1187c8 100644 (file)
@@ -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
index c3c76352f936d12ea9706aee19a3e46c25ccbddc..28d9f9e65ca168b3a536ca1b2bb1a622f31c4515 100644 (file)
@@ -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
index 8a63c6ca5bac0d74edbe8747bc12f208305068cd..946f1967e7f2f8f65a3720b376bef92acc4f15d8 100644 (file)
@@ -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
index 886a34b2f7ac75e81274ae1f36146f53d40f6d01..bb1c4987e2bfeeef484313bd919f25a8a776191c 100644 (file)
@@ -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.  */
index ea5cd13d09983704393e16697ca6ed4922076c7f..ecf00fc75a1529b812c5c049d2289fccc1da5019 100644 (file)
@@ -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.  */
 #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 */
index b18c07cd089b5f9d1f196a0246385ecd4760dd19..b03c29ef09add2f670d580bf5e7a403aa17f12fb 100644 (file)
@@ -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
 \f
 
 /* 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
index fd914815d64f1538a5fff77e5e480d168906526d..5cfe659740abba4dcbc554d77c99e630f4abe3b5 100644 (file)
@@ -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.  */
index bb03b058a8272fe3f144151cd4c8af9e3fef0992..46797384893e207903ef920e0648cfd9d6730246 100644 (file)
@@ -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
index 4ece2d6052e415de1fc8ac1b452ce93ecef5772d..f77aa474a7c4a56aeb93720e364f6d77538de728 100644 (file)
@@ -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
 \f
 /* 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
index 81358f717bf05547c3bd9d446a9e2b5e1ca3b394..1f7304c51c784cf4facafc1b12394e067e407b69 100644 (file)
@@ -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
 
index 9986f62bc26b68e62c867aab027c19e6aaf0d9d2..bd9f4a1823d65c6b0cf11df70cb4c3318f230bd3 100644 (file)
@@ -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
index 2d0c195549ad3597b1fdeac3965afd80ddc21ba3..2362b521a18f0a71b007c9ba2477986ab710fc37 100644 (file)
@@ -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
 
index 3cd595efb36d86a5aba54cf8b53f83cf1a7dfc23..5974ab849a9be9fa804ff21ee44898360447f13f 100644 (file)
@@ -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;                                        \
     }                                                          \
index 4b88363e1ddf1a34468d380280045116652684cc..aa094b6b8363b10936df4dc1eb0188949158822a 100644 (file)
@@ -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 ""
index 782c62bad8dfa06b45dad6f7502dc60bf24b826c..c9bcd3ead2d23e221d9462b186a548845917f13e 100644 (file)
@@ -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 ""
index 4e3a227638a13ee1008e491edeb7acd2fc2b99a4..ee334870efb1e40d1dc5d9ce9dc34f7346ec86c2 100644 (file)
@@ -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.
index b917a782ad44c73b534a49710a4a71dafb627baf..c441198910548fe261ddc26bd9d6364deb8ebb4a 100644 (file)
@@ -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 */
 \f
 /* Target machine storage layout */
 
index ccec73202829d1162629e590b1e03a3a6a2c0dff..7a455e514fa68d52451f46a6a38bc4164d3c67bd 100644 (file)
@@ -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
 
index 7d4866230085a2aa3ff5dbbf20c86c161e63463b..ec6e13bcebc0f832a7741fd7e156e08578d43b87 100644 (file)
@@ -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 */
index a28a9d09542f73efa79a13b3765a41a830594f68..2438a568983f9e8dca1e59b372fbf37839290047 100644 (file)
@@ -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)
index f15ae04654ffa0b6a1a69a7522daa3cf701668a7..94492d4998e9561f804e7513e1fb29eff4da5fe4 100644 (file)
@@ -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");
+}
+
index d32675cfc5e604c910e5dd2ef3b7f6b616c18ec0..7bb9681463424955cad0f394e04dd726143e1fff 100644 (file)
@@ -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
index aa2c443fe02a295e3f8994389f0ceca8fbecf9fe..40004d1d0e63b6903c33da464a09498c063aa532 100644 (file)
@@ -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)                                     \
index bc2cc92698f668a517c2e37926763338c9dcec0b..2df1615dd545129ff98d03fdd23257f202867dc4 100644 (file)
@@ -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
index 6f67f35cc1d969a589f65bdb0cb473f2588df424..26be5ef8193dd1749536bbd189a7444d36ab604b 100644 (file)
@@ -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
index f5b39e525141b1b58426f54c72c633193ed276aa..428ab43ea32a0eb6fa46beb9e02f651dd1da6d6c 100644 (file)
@@ -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
index 646c987d8f545cb144f3621a57b588562d0d1ae1..8b755fc905688de26b43407030c2ea43d2b499b8 100644 (file)
@@ -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
index 2851d700f87750b1171027e666177d206157b731..f52efa6e69be96a8e493699d286ba3c7a4f410da 100644 (file)
@@ -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*...  */
 
index 183fa96c2ab3c3a8711e01cb3afb2b446b496c73..761b1fb568b982755ef6ab0dfb929751b8795b74 100644 (file)
@@ -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
 
index 1377610a319199aa52fcb6a70c2a26395a3febde..9a2c3479d7399cbdad597d7974ae3f3bd29aa1c6 100644 (file)
@@ -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)();                          \
index 3481c4b4c27d3b113380df6462757376ed95268e..d72f57f08ce37a1e7b25bd853e28e5a7c6340c17 100644 (file)
@@ -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)
index c662eb3f5b08bdad039cc0b1c77bad8d6d38971e..e2340c3bdf0ac88d7b06be60c53d68d1c6383094 100644 (file)
@@ -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
index 9179635c6363ea9663aaf539edbe03c4a7cbcfd7..21545f2f84e19bde28eb444dec996d7185728020 100644 (file)
  
 #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
index 5e732af8922e52cee0ed1eea75dd4ce6d2d24f9d..6f26fde8cd53c14be06210870e439bc81845f5ae 100644 (file)
@@ -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
index e8a13dcb7f44ad8f93f5aa15287e2c310b2812d0..df4f76e4ffb91d84f7617093e190f3b321005c42 100644 (file)
@@ -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
 \f
 /* 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 */
 \f
-#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 */
index ccc1715dcd4f38eb2407a3a96a7a513cb601dfd6..52f4d2750e3ff6fc67ee0eeca72faed493f432e2 100644 (file)
@@ -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
index cd03812d1d6c4d883a9195898ac4541725e9c06a..640e5c2e8f90d562f948bb101048aabef87cb4f3 100755 (executable)
@@ -6785,15 +6785,10 @@ if test x$use_collect2 = xno; then
 fi
 
 # Add a definition of USE_COLLECT2 if system wants one.
-# Also tell toplev.c what to do.
-# This substitutes for lots of t-* files.
-if test x$use_collect2 = x
+if test x$use_collect2 != x
 then
-       will_use_collect2=
-       maybe_use_collect2=
-else
-       will_use_collect2="collect2"
-       maybe_use_collect2="-DUSE_COLLECT2"
+       host_xm_defines="${host_xm_defines} USE_COLLECT2"
+       xm_defines="${xm_defines} USE_COLLECT2"
 fi
 
 # If we have gas in the build tree, make a link to it.
@@ -6808,16 +6803,12 @@ fi
 
 # If we have ld in the build tree, make a link to it.
 if test -f ../ld/Makefile; then
-#      if test x$use_collect2 = x; then
-#              rm -f ld; $symbolic_link ../ld/ld-new$host_exeext ld$host_exeext 2>/dev/null
-#      else
-               rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
-#      fi
+       rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
 fi
 
 # Figure out what assembler we will be using.
 echo $ac_n "checking what assembler to use""... $ac_c" 1>&6
-echo "configure:6821: checking what assembler to use" >&5
+echo "configure:6812: checking what assembler to use" >&5
 gcc_cv_as=
 gcc_cv_gas_major_version=
 gcc_cv_gas_minor_version=
@@ -6902,7 +6893,7 @@ fi
 
 # Figure out what nm we will be using.
 echo $ac_n "checking what nm to use""... $ac_c" 1>&6
-echo "configure:6906: checking what nm to use" >&5
+echo "configure:6897: checking what nm to use" >&5
 if test -x nm$host_exeext; then
        gcc_cv_nm=./nm$host_exeext
 elif test x$host = x$target; then
@@ -6913,7 +6904,7 @@ echo "$ac_t""$gcc_cv_nm" 1>&6
 
 # Figure out what assembler alignment features are present.
 echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6
-echo "configure:6917: checking assembler alignment features" >&5
+echo "configure:6908: checking assembler alignment features" >&5
 gcc_cv_as_alignment_features=none
 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
        # Gas version 2.6 and later support for .balign and .p2align.
@@ -6961,7 +6952,7 @@ fi
 echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6
 
 echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6
-echo "configure:6965: checking assembler subsection support" >&5
+echo "configure:6956: checking assembler subsection support" >&5
 gcc_cv_as_subsections=no
 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
@@ -7001,7 +6992,7 @@ fi
 echo "$ac_t""$gcc_cv_as_subsections" 1>&6
 
 echo $ac_n "checking assembler weak support""... $ac_c" 1>&6
-echo "configure:7005: checking assembler weak support" >&5
+echo "configure:6996: checking assembler weak support" >&5
 gcc_cv_as_weak=no
 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then
@@ -7024,7 +7015,7 @@ fi
 echo "$ac_t""$gcc_cv_as_weak" 1>&6
 
 echo $ac_n "checking assembler hidden support""... $ac_c" 1>&6
-echo "configure:7028: checking assembler hidden support" >&5
+echo "configure:7019: checking assembler hidden support" >&5
 gcc_cv_as_hidden=no
 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 10 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
@@ -7048,7 +7039,7 @@ fi
 echo "$ac_t""$gcc_cv_as_hidden" 1>&6
 
 echo $ac_n "checking assembler leb128 support""... $ac_c" 1>&6
-echo "configure:7052: checking assembler leb128 support" >&5
+echo "configure:7043: checking assembler leb128 support" >&5
 gcc_cv_as_leb128=no
 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
@@ -7093,7 +7084,7 @@ fi
 echo "$ac_t""$gcc_cv_as_leb128" 1>&6
 
 echo $ac_n "checking assembler eh_frame optimization""... $ac_c" 1>&6
-echo "configure:7097: checking assembler eh_frame optimization" >&5
+echo "configure:7088: checking assembler eh_frame optimization" >&5
 gcc_cv_as_eh_frame=no
 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
   if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then
@@ -7176,7 +7167,7 @@ echo "$ac_t""$gcc_cv_as_eh_frame" 1>&6
 case "$target" in 
   sparc*-*-*)
     echo $ac_n "checking assembler .register pseudo-op support""... $ac_c" 1>&6
-echo "configure:7180: checking assembler .register pseudo-op support" >&5
+echo "configure:7171: checking assembler .register pseudo-op support" >&5
 if eval "test \"`echo '$''{'gcc_cv_as_register_pseudo_op'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7204,7 +7195,7 @@ EOF
     fi
 
     echo $ac_n "checking assembler supports -relax""... $ac_c" 1>&6
-echo "configure:7208: checking assembler supports -relax" >&5
+echo "configure:7199: checking assembler supports -relax" >&5
 if eval "test \"`echo '$''{'gcc_cv_as_relax_opt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7234,7 +7225,7 @@ EOF
     case "$tm_file" in
     *64*)
        echo $ac_n "checking for 64 bit support in assembler ($gcc_cv_as)""... $ac_c" 1>&6
-echo "configure:7238: checking for 64 bit support in assembler ($gcc_cv_as)" >&5
+echo "configure:7229: checking for 64 bit support in assembler ($gcc_cv_as)" >&5
 if eval "test \"`echo '$''{'gcc_cv_as_flags64'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7279,7 +7270,7 @@ EOF
 
     if test "x$gcc_cv_as_flags64" != xno; then
        echo $ac_n "checking for assembler offsetable %lo() support""... $ac_c" 1>&6
-echo "configure:7283: checking for assembler offsetable %lo() support" >&5
+echo "configure:7274: checking for assembler offsetable %lo() support" >&5
 if eval "test \"`echo '$''{'gcc_cv_as_offsetable_lo10'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7319,7 +7310,7 @@ EOF
 
   i[34567]86-*-*)
     echo $ac_n "checking assembler instructions""... $ac_c" 1>&6
-echo "configure:7323: checking assembler instructions" >&5
+echo "configure:7314: checking assembler instructions" >&5
     gcc_cv_as_instructions=
     if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
       if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then
@@ -7348,7 +7339,7 @@ EOF
 esac
 
 echo $ac_n "checking assembler dwarf2 debug_line support""... $ac_c" 1>&6
-echo "configure:7352: checking assembler dwarf2 debug_line support" >&5
+echo "configure:7343: checking assembler dwarf2 debug_line support" >&5
 gcc_cv_as_dwarf2_debug_line=no
 # ??? Not all targets support dwarf2 debug_line, even within a version
 # of gas.  Moreover, we need to emit a valid instruction to trigger any
@@ -7533,7 +7524,7 @@ fi
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:7537: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:7528: checking whether to enable maintainer-specific portions of Makefiles" >&5
     # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
 if test "${enable_maintainer_mode+set}" = set; then
   enableval="$enable_maintainer_mode"
@@ -7841,8 +7832,6 @@ ${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xma
 
 
 
-
-
 
 
 
@@ -8142,7 +8131,6 @@ s%@lang_options_files@%$lang_options_files%g
 s%@lang_specs_files@%$lang_specs_files%g
 s%@lang_tree_files@%$lang_tree_files%g
 s%@local_prefix@%$local_prefix%g
-s%@maybe_use_collect2@%$maybe_use_collect2%g
 s%@md_file@%$md_file%g
 s%@objc_boehm_gc@%$objc_boehm_gc%g
 s%@out_file@%$out_file%g
@@ -8156,7 +8144,6 @@ s%@tm_p_file_list@%$tm_p_file_list%g
 s%@tm_p_file@%$tm_p_file%g
 s%@xm_file@%$xm_file%g
 s%@xm_defines@%$xm_defines%g
-s%@will_use_collect2@%$will_use_collect2%g
 s%@c_target_objs@%$c_target_objs%g
 s%@cxx_target_objs@%$cxx_target_objs%g
 s%@target_cpu_default@%$target_cpu_default%g
index b4a8ba7029e1cfa15367703c6cd44b0e5c7072ce..6d1058304ff8076b335a67f2067310837710eb82 100644 (file)
@@ -1129,15 +1129,10 @@ if test x$use_collect2 = xno; then
 fi
 
 # Add a definition of USE_COLLECT2 if system wants one.
-# Also tell toplev.c what to do.
-# This substitutes for lots of t-* files.
-if test x$use_collect2 = x
+if test x$use_collect2 != x
 then
-       will_use_collect2=
-       maybe_use_collect2=
-else
-       will_use_collect2="collect2"
-       maybe_use_collect2="-DUSE_COLLECT2"
+       host_xm_defines="${host_xm_defines} USE_COLLECT2"
+       xm_defines="${xm_defines} USE_COLLECT2"
 fi
 
 # If we have gas in the build tree, make a link to it.
@@ -1152,11 +1147,7 @@ fi
 
 # If we have ld in the build tree, make a link to it.
 if test -f ../ld/Makefile; then
-#      if test x$use_collect2 = x; then
-#              rm -f ld; $symbolic_link ../ld/ld-new$host_exeext ld$host_exeext 2>/dev/null
-#      else
-               rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
-#      fi
+       rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
 fi
 
 # Figure out what assembler we will be using.
@@ -2089,7 +2080,6 @@ AC_SUBST(lang_options_files)
 AC_SUBST(lang_specs_files)
 AC_SUBST(lang_tree_files)
 AC_SUBST(local_prefix)
-AC_SUBST(maybe_use_collect2)
 AC_SUBST(md_file)
 AC_SUBST(objc_boehm_gc)
 AC_SUBST(out_file)
@@ -2103,7 +2093,6 @@ AC_SUBST(tm_p_file_list)
 AC_SUBST(tm_p_file)
 AC_SUBST(xm_file)
 AC_SUBST(xm_defines)
-AC_SUBST(will_use_collect2)
 AC_SUBST(c_target_objs)
 AC_SUBST(cxx_target_objs)
 AC_SUBST(target_cpu_default)
index 50a96b6cf20f4b001e0748534617842e527b157d..02f34156b3c5493adcac58f618d0dd3c9e8b4c1b 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-09  Richard Henderson  <rth@redhat.com>
+
+       * decl2.c (finish_objects): Use target hooks instead of
+       assemble_constructor and assemble_destructor.
+
 2001-08-08  John David Anglin  <dave@hiauly1.hia.nrc.ca>
 
        * g++spec.c (lang_specific_driver): Quote argument after `-Xlinker'.
index a649e23220bc85a413be36bb0c7392745fd05619..0a9e5ad817c5ebbadb1f1a1f9e609fa07ac6b7b4 100644 (file)
@@ -2806,11 +2806,9 @@ start_objects (method_type, initp)
                                        NULL_TREE),
                  NULL_TREE, SF_DEFAULT);
 
-#if defined(ASM_OUTPUT_CONSTRUCTOR) && defined(ASM_OUTPUT_DESTRUCTOR)
   /* It can be a static function as long as collect2 does not have
      to scan the object file to find its ctor/dtor routine.  */
-  TREE_PUBLIC (current_function_decl) = 0;
-#endif
+  TREE_PUBLIC (current_function_decl) = ! targetm.have_ctors_dtors;
 
   /* Mark this declaration as used to avoid spurious warnings.  */
   TREE_USED (current_function_decl) = 1;
@@ -2843,7 +2841,6 @@ finish_objects (method_type, initp, body)
      tree body;
 {
   tree fn;
-  rtx fnsym;
 
   /* Finish up.  */
   finish_compound_stmt (/*has_no_scope=*/0, body);
@@ -2856,11 +2853,14 @@ finish_objects (method_type, initp, body)
   if (flag_syntax_only)
     return;
 
-  fnsym = XEXP (DECL_RTL (fn), 0);
-  if (method_type == 'I')
-    assemble_constructor (fnsym, initp);
-  else
-    assemble_destructor (fnsym, initp);
+  if (targetm.have_ctors_dtors)
+    {
+      rtx fnsym = XEXP (DECL_RTL (fn), 0);
+      if (method_type == 'I')
+       (* targetm.asm_out.constructor) (fnsym, initp);
+      else
+       (* targetm.asm_out.destructor) (fnsym, initp);
+    }
 }
 
 /* The names of the parameters to the function created to handle
index c74377eefee7768d86ad654583946f96ef5c6663..402ab0114e099bdc6eabd3b969da401ecb0814f3 100644 (file)
@@ -100,32 +100,6 @@ extern void *__deregister_frame_info_bases (void *)
 
 #ifndef OBJECT_FORMAT_MACHO
 
-/* Provide default definitions for 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.)
-
-   These defaults do not include leading spacing, as they will only be
-   used in asm:s here.  */
-
-#ifndef CTORS_SECTION_ASM_OP
-#define CTORS_SECTION_ASM_OP   ".section\t.ctors,\"aw\""
-#endif
-#ifndef DTORS_SECTION_ASM_OP
-#define DTORS_SECTION_ASM_OP   ".section\t.dtors,\"aw\""
-#endif
-
 #ifdef OBJECT_FORMAT_ELF
 
 /*  Declare a pointer to void function type.  */
@@ -372,9 +346,6 @@ __frame_dummy (void)
 
 #endif /* defined(INIT_SECTION_ASM_OP) */
 
-/* Force cc1 to switch to .data section.  */
-static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
-
 /* NOTE:  In order to be able to support SVR4 shared libraries, we arrange
    to have one set of symbols { __CTOR_LIST__, __DTOR_LIST__, __CTOR_END__,
    __DTOR_END__ } per root executable and also one set of these symbols
@@ -387,21 +358,36 @@ static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
    refer to only the __CTOR_END__ symbol in crtend.o and the __DTOR_LIST__
    symbol in crtbegin.o, where they are defined.  */
 
-/* The -1 is a flag to __do_global_[cd]tors
-   indicating that this table does not start with a count of elements.  */
+/* The -1 is a flag to __do_global_[cd]tors indicating that this table
+   does not start with a count of elements.  */
 #ifdef CTOR_LIST_BEGIN
 CTOR_LIST_BEGIN;
+
+#elif defined(CTORS_SECTION_ASM_OP)
+/* Hack: force cc1 to switch to .data section early, so that assembling
+   __CTOR_LIST__ does not undo our behind-the-back change to .ctors.  */
+static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
+asm (CTORS_SECTION_ASM_OP);
+STATIC func_ptr __CTOR_LIST__[1]
+  __attribute__ ((__unused__))
+  = { (func_ptr) (-1) };
+
 #else
-asm (CTORS_SECTION_ASM_OP);    /* cc1 doesn't know that we are switching! */
-STATIC func_ptr __CTOR_LIST__[1] __attribute__ ((__unused__))
+STATIC func_ptr __CTOR_LIST__[1]
+  __attribute__ ((__unused__, section(".ctors")))
   = { (func_ptr) (-1) };
+
 #endif
 
 #ifdef DTOR_LIST_BEGIN
 DTOR_LIST_BEGIN;
-#else
-asm (DTORS_SECTION_ASM_OP);    /* cc1 doesn't know that we are switching! */
+#elif defined(DTORS_SECTION_ASM_OP)
+asm (DTORS_SECTION_ASM_OP);
 STATIC func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };
+#else
+STATIC func_ptr __DTOR_LIST__[1]
+  __attribute__((section(".dtors")))
+  = { (func_ptr) (-1) };
 #endif
 
 #ifdef EH_FRAME_SECTION_NAME
@@ -533,9 +519,6 @@ __do_global_ctors (void)
 
 #endif /* defined(INIT_SECTION_ASM_OP) */
 
-/* Force cc1 to switch to .data section.  */
-static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
-
 /* Put a word containing zero at the end of each of our two lists of function
    addresses.  Note that the words defined here go into the .ctors and .dtors
    sections of the crtend.o file, and since that file is always linked in
@@ -544,16 +527,29 @@ static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
 
 #ifdef CTOR_LIST_END
 CTOR_LIST_END;
-#else
-asm (CTORS_SECTION_ASM_OP);    /* cc1 doesn't know that we are switching! */
+
+#elif defined(CTORS_SECTION_ASM_OP)
+/* Hack: force cc1 to switch to .data section early, so that assembling
+   __CTOR_LIST__ does not undo our behind-the-back change to .ctors.  */
+static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
+asm (CTORS_SECTION_ASM_OP);
 STATIC func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
+
+#else
+STATIC func_ptr __CTOR_END__[1]
+  __attribute__((section(".ctors")))
+  = { (func_ptr) 0 };
 #endif
 
 #ifdef DTOR_LIST_END
 DTOR_LIST_END;
+#elif defined(DTORS_SECTION_ASM_OP)
+asm (DTORS_SECTION_ASM_OP);
+STATIC func_ptr __DTOR_END__[1] __attribute__ ((unused))
+  = { (func_ptr) 0 };
 #else
-asm (DTORS_SECTION_ASM_OP);    /* cc1 doesn't know that we are switching! */
-STATIC func_ptr __DTOR_END__[1] __attribute__ ((__unused__))
+STATIC func_ptr __DTOR_END__[1]
+  __attribute__((unused, section(".dtors")))
   = { (func_ptr) 0 };
 #endif
 
@@ -636,4 +632,3 @@ STATIC int __FRAME_END__[]
 #endif /* CRT_END */
 
 #endif /* OBJECT_FORMAT_MACHO */
-
index 0939d077d63b10e80bae14dfc554eeb92866f9a2..b069c5713d374bfe73469caca21a3fc123b56f33 100644 (file)
@@ -209,9 +209,9 @@ do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNATE_NAME (INSN)); } while (0)
 #define DWARF2_UNWIND_INFO 1
 #endif
 
-/* If we have named section, and we're using crtstuff to run ctors,
-   then use named sections for registering eh frame information.  */
-#if defined (TARGET_ASM_NAMED_SECTION) && defined (ASM_OUTPUT_CONSTRUCTOR)
+/* If we have named sections, and we're using crtstuff to run ctors,
+   use them for registering eh frame information.  */
+#if defined (TARGET_ASM_NAMED_SECTION)
 #ifndef EH_FRAME_SECTION_NAME
 #define EH_FRAME_SECTION_NAME ".eh_frame"
 #endif
index 4bcf82748b520d519664f76701e612858a509552..0de3768b2739cb0281a6516258309095b0dd4dcd 100644 (file)
@@ -396,7 +396,7 @@ the effect you need.
 
 @findex LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
 @item LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
-A nonzero value causes collect2 to remove duplicate @option{-L@var{directory}} search
+A nonzero value causes @command{collect2} to remove duplicate @option{-L@var{directory}} search
 directories from linking commands.  Do not give it a nonzero value if
 removing duplicate search directories changes the linker's semantics.
 
@@ -6318,7 +6318,7 @@ systems.  This macro is used in @code{assemble_name}.
 @ignore @c Seems not to exist anymore.
 @findex ASM_OUTPUT_LABELREF_AS_INT
 @item ASM_OUTPUT_LABELREF_AS_INT (@var{file}, @var{label})
-Define this macro for systems that use the program @code{collect2}.
+Define this macro for systems that use the program @command{collect2}.
 The definition should be a C statement to output a word containing
 a reference to the label @var{label}.
 @end ignore
@@ -6546,49 +6546,56 @@ the constructor section to point to that function.  The linker
 accumulates all these words into one contiguous @samp{.ctors} section.
 Termination functions are handled similarly.
 
-To use this method, you need appropriate definitions of the macros
-@code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR}.  Usually
-you can get them by including @file{svr4.h}.
+This method will be chosen as the default by @file{target-def.h} if
+@code{TARGET_ASM_NAMED_SECTION} is defined.  A target that does not
+support arbitrary sections, but does support special designated 
+constructor and destructor sections may define @code{CTORS_SECTION_ASM_OP}
+and @code{DTORS_SECTION_ASM_OP} to achieve the same effect.
 
 When arbitrary sections are available, there are two variants, depending
 upon how the code in @file{crtstuff.c} is called.  On systems that
-support an @dfn{init} section which is executed at program startup,
+support a @dfn{.init} section which is executed at program startup,
 parts of @file{crtstuff.c} are compiled into that section.  The
 program is linked by the @code{gcc} driver like this:
 
 @example
-ld -o @var{output_file} crtbegin.o @dots{} crtend.o -lgcc
+ld -o @var{output_file} crti.o crtbegin.o @dots{} -lgcc crtend.o crtn.o
 @end example
 
-The head of a function (@code{__do_global_ctors}) appears in the init
-section of @file{crtbegin.o}; the remainder of the function appears in
-the init section of @file{crtend.o}.  The linker will pull these two
-parts of the section together, making a whole function.  If any of the
-user's object files linked into the middle of it contribute code, then that
-code will be executed as part of the body of @code{__do_global_ctors}.
+The prologue of a function (@code{__init}) appears in the @code{.init}
+section of @file{crti.o}; the epilogue appears in @file{crtn.o}.  Likewise
+for the function @code{__fini} in the @dfn{.fini} section.  Normally these
+files are provided by the operating system or by the GNU C library, but
+are provided by GCC for a few targets.
+
+The objects @file{crtbegin.o} and @file{crtend.o} are (for most targets)
+compiled from @file{crtstuff.c}.  They contain, among other things, code
+fragments within the @code{.init} and @code{.fini} sections that branch
+to routines in the @code{.text} section.  The linker will pull all parts
+of a section together, which results in a complete @code{__init} function
+that invokes the routines we need at startup.
 
 To use this variant, you must define the @code{INIT_SECTION_ASM_OP}
 macro properly.
 
-If no init section is available, do not define
-@code{INIT_SECTION_ASM_OP}.  Then @code{__do_global_ctors} is built into
-the text section like all other functions, and resides in
-@file{libgcc.a}.  When GCC compiles any function called @code{main}, it
-inserts a procedure call to @code{__main} as the first executable code
-after the function prologue.  The @code{__main} function, also defined
-in @file{libgcc2.c}, simply calls @file{__do_global_ctors}.
+If no init section is available, when GCC compiles any function called
+@code{main} (or more accurately, any function designated as a program
+entry point by the language front end calling @code{expand_main_function}),
+it inserts a procedure call to @code{__main} as the first executable code
+after the function prologue.  The @code{__main} function is defined
+in @file{libgcc2.c} and runs the global constructors.
 
 In file formats that don't support arbitrary sections, there are again
 two variants.  In the simplest variant, the GNU linker (GNU @code{ld})
 and an `a.out' format must be used.  In this case,
-@code{ASM_OUTPUT_CONSTRUCTOR} is defined to produce a @code{.stabs}
+@code{TARGET_ASM_CONSTRUCTOR} is defined to produce a @code{.stabs}
 entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__},
 and with the address of the void function containing the initialization
 code as its value.  The GNU linker recognizes this as a request to add
-the value to a ``set''; the values are accumulated, and are eventually
+the value to a @dfn{set}; the values are accumulated, and are eventually
 placed in the executable as a vector in the format described above, with
 a leading (ignored) count and a trailing zero element.
-@code{ASM_OUTPUT_DESTRUCTOR} is handled similarly.  Since no init
+@code{TARGET_ASM_DESTRUCTOR} is handled similarly.  Since no init
 section is available, the absence of @code{INIT_SECTION_ASM_OP} causes
 the compilation of @code{main} to call @code{__main} as above, starting
 the initialization process.
@@ -6596,37 +6603,14 @@ the initialization process.
 The last variant uses neither arbitrary sections nor the GNU linker.
 This is preferable when you want to do dynamic linking and when using
 file formats which the GNU linker does not support, such as `ECOFF'@.  In
-this case, @code{ASM_OUTPUT_CONSTRUCTOR} does not produce an
-@code{N_SETT} symbol; initialization and termination functions are
-recognized simply by their names.  This requires an extra program in the
-linkage step, called @code{collect2}.  This program pretends to be the
-linker, for use with GCC; it does its job by running the ordinary
-linker, but also arranges to include the vectors of initialization and
-termination functions.  These functions are called via @code{__main} as
-described above.
-
-Choosing among these configuration options has been simplified by a set
-of operating-system-dependent files in the @file{config} subdirectory.
-These files define all of the relevant parameters.  Usually it is
-sufficient to include one into your specific machine-dependent
-configuration file.  These files are:
-
-@table @file
-@item aoutos.h
-For operating systems using the `a.out' format.
-
-@item next.h
-For operating systems using the `MachO' format.
-
-@item svr3.h
-For System V Release 3 and similar systems using `COFF' format.
-
-@item svr4.h
-For System V Release 4 and similar systems using `ELF' format.
-
-@item vms.h
-For the VMS operating system.
-@end table
+this case, @code{TARGET_HAVE_CTORS_DTORS} is false, initialization and
+termination functions are recognized simply by their names.  This requires
+an extra program in the linkage step, called @command{collect2}.  This program
+pretends to be the linker, for use with GCC; it does its job by running
+the ordinary linker, but also arranges to include the vectors of
+initialization and termination functions.  These functions are called
+via @code{__main} as described above.  In order to use this method,
+@code{use_collect2} must be defined in the target in @file{config.gcc}.
 
 @ifinfo
 The following section describes the specific macros that control and
@@ -6652,10 +6636,9 @@ run the initialization functions.
 @item HAS_INIT_SECTION
 @findex HAS_INIT_SECTION
 If defined, @code{main} will not call @code{__main} as described above.
-This macro should be defined for systems that control the contents of the
-init section on a symbol-by-symbol basis, such as OSF/1, and should not
-be defined explicitly for systems that support
-@code{INIT_SECTION_ASM_OP}.
+This macro should be defined for systems that control start-up code
+on a symbol-by-symbol basis, such as OSF/1, and should not
+be defined explicitly for systems that support @code{INIT_SECTION_ASM_OP}.
 
 @item LD_INIT_SWITCH
 @findex LD_INIT_SWITCH
@@ -6680,65 +6663,65 @@ If nonzero, the C++ @code{init_priority} attribute is supported and the
 compiler should emit instructions to control the order of initialization
 of objects.  If zero, the compiler will issue an error message upon
 encountering an @code{init_priority} attribute.
+@end table
+
+@deftypefn {Target Hook} bool TARGET_HAVE_CTORS_DTORS
+This value is true if the target supports some ``native'' method of
+collecting constructors and destructors to be run at startup and exit.
+It is false if we must use @command{collect2}.
+@end deftypefn
+
+@deftypefn {Target Hook} void TARGET_ASM_CONSTRUCTOR (rtx @var{symbol}, int @var{priority})
+If defined, a function that outputs assembler code to arrange to call
+the function referenced by @var{symbol} at initialization time.
 
-@item ASM_OUTPUT_CONSTRUCTOR (@var{stream}, @var{name})
-@findex ASM_OUTPUT_CONSTRUCTOR
-Define this macro as a C statement to output on the stream @var{stream}
-the assembler code to arrange to call the function named @var{name} at
-initialization time.
-
-Assume that @var{name} is the name of a C function generated
-automatically by the compiler.  This function takes no arguments.  Use
-the function @code{assemble_name} to output the name @var{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 @code{collect2} program,
-which looks through the symbol table to find these functions by their
-names.
-
-@item ASM_OUTPUT_DESTRUCTOR (@var{stream}, @var{name})
-@findex ASM_OUTPUT_DESTRUCTOR
-This is like @code{ASM_OUTPUT_CONSTRUCTOR} but used for termination
+Assume that @var{symbol} is a @code{SYMBOL_REF} for a function taking
+no arguments and with no return value.  If the target supports initialization
+priorities, @var{priority} is a value between 0 and @code{MAX_INIT_PRIORITY};
+otherwise it must be @code{DEFAULT_INIT_PRIORITY}.
+
+If this macro is is not defined by the target, a suitable default will
+be chosen if (1) the target supports arbitrary section names, (2) the
+target defines @code{CTORS_SECTION_ASM_OP}, or (3) @code{USE_COLLECT2}
+is not defined.
+@end deftypefn
+
+@deftypefn {Target Hook} void TARGET_ASM_DESTRUCTOR (rtx @var{symbol}, int @var{priority})
+This is like @code{TARGET_ASM_CONSTRUCTOR} but used for termination
 functions rather than initialization functions.
+@end deftypefn
 
-When @code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR} are
-defined, the initialization routine generated for the generated object
-file will have static linkage.
-@end table
+If @code{TARGET_HAVE_CTORS_DTORS} is true, the initialization routine
+generated for the generated object file will have static linkage.
 
-If your system uses @code{collect2} as the means of processing
-constructors, then that program normally uses @code{nm} to scan an
-object file for constructor functions to be called.  On such systems you
-must not define @code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR}
-as the object file's initialization routine must have global scope.
+If your system uses @command{collect2} as the means of processing
+constructors, then that program normally uses @command{nm} to scan
+an object file for constructor functions to be called.
 
 On certain kinds of systems, you can define these macros to make
-@code{collect2} work faster (and, in some cases, make it work at all):
+@command{collect2} work faster (and, in some cases, make it work at all):
 
 @table @code
 @findex OBJECT_FORMAT_COFF
 @item OBJECT_FORMAT_COFF
 Define this macro if the system uses COFF (Common Object File Format)
-object files, so that @code{collect2} can assume this format and scan
+object files, so that @command{collect2} can assume this format and scan
 object files directly for dynamic constructor/destructor functions.
 
 @findex OBJECT_FORMAT_ROSE
 @item OBJECT_FORMAT_ROSE
 Define this macro if the system uses ROSE format object files, so that
-@code{collect2} can assume this format and scan object files directly
+@command{collect2} can assume this format and scan object files directly
 for dynamic constructor/destructor functions.
 
-These macros are effective only in a native compiler; @code{collect2} as
-part of a cross compiler always uses @code{nm} for the target machine.
+These macros are effective only in a native compiler; @command{collect2} as
+part of a cross compiler always uses @command{nm} for the target machine.
 
 @findex REAL_NM_FILE_NAME
 @item REAL_NM_FILE_NAME
 Define this macro as a C string constant containing the file name to use
-to execute @code{nm}.  The default is to search the path normally for
-@code{nm}.
+to execute @command{nm}.  The default is to search the path normally for
+@command{nm}.
 
 If your system supports shared libraries and has a program to list the
 dynamic dependencies of a given library or executable, you can define
@@ -6747,8 +6730,8 @@ termination functions in shared libraries:
 
 @findex LDD_SUFFIX
 @item LDD_SUFFIX
-Define this macro to a C string constant containing the name of the
-program which lists dynamic dependencies, like @code{"ldd"} under SunOS 4.
+Define this macro to a C string constant containing the name of the program
+which lists dynamic dependencies, like @command{"ldd"} under SunOS 4.
 
 @findex PARSE_LDD_OUTPUT
 @item PARSE_LDD_OUTPUT (@var{ptr})
@@ -6758,7 +6741,6 @@ of type @code{char *} that points to the beginning of a line of output
 from @code{LDD_SUFFIX}.  If the line lists a dynamic dependency, the
 code must advance @var{ptr} to the beginning of the filename on that
 line.  Otherwise, it must set @var{ptr} to @code{NULL}.
-
 @end table
 
 @node Instruction Output
index 7734a5f1daeb655c90e73c6c37e894ea174005d7..79245740fb897760ad646b127e2848ea607aae16 100644 (file)
@@ -1,3 +1,9 @@
+2001-08-09  Richard Henderson  <rth@redhat.com>
+
+       * Make-lang.in (class.o): Depend on TARGET_H.
+       * class.c (emit_register_classes): Use target hooks instead of
+       assemble_constructor and assemble_destructor.
+
 2001-08-08  Alexandre Petit-Bianco  <apbianco@redhat.com>
 
        * check-init.c (flags.h): Include
index 57682253a1ce3c55c3fdd87093bedca6c23fc663..d0ae26c051697f12517bfc30340dd2bd7ebaf530 100644 (file)
@@ -245,7 +245,7 @@ java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h $(SYSTEM_H) toplev.h
 java/check-init.o: java/check-init.c $(CONFIG_H) \
   $(JAVA_TREE_H) $(SYSTEM_H) toplev.h
 java/class.o: java/class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
-  java/parse.h toplev.h $(SYSTEM_H) output.h $(GGC_H)
+  java/parse.h toplev.h $(SYSTEM_H) output.h $(GGC_H) $(TARGET_H) function.h
 java/constants.o: java/constants.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
   toplev.h $(SYSTEM_H) $(GGC_H)
 java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
index 7e153b5b8f5bedad1accf218838c55c55e638df9..0e46a7882a3ab217f5cd3b6c1ffe186700809fca 100644 (file)
@@ -36,6 +36,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #include "toplev.h"
 #include "output.h"
 #include "parse.h"
+#include "function.h"
 #include "ggc.h"
 #include "target.h"
 
@@ -1881,6 +1882,9 @@ register_class ()
 void
 emit_register_classes ()
 {
+  /* ??? This isn't quite the correct test.  We also have to know
+     that the target is using gcc's crtbegin/crtend objects rather
+     than the ones that come with the operating system.  */
   if (SUPPORTS_WEAK && targetm.have_named_sections)
     {
       tree t;
@@ -1902,29 +1906,37 @@ emit_register_classes ()
       SET_DECL_ASSEMBLER_NAME (init_decl, init_name);
       TREE_STATIC (init_decl) = 1;
       current_function_decl = init_decl;
-      DECL_RESULT (init_decl) = build_decl(RESULT_DECL, NULL_TREE, void_type_node);
-      /*  DECL_EXTERNAL (init_decl) = 1;*/
-      TREE_PUBLIC (init_decl) = 1;
+      DECL_RESULT (init_decl) = build_decl (RESULT_DECL, NULL_TREE,
+                                           void_type_node);
+
+      /* It can be a static function as long as collect2 does not have
+         to scan the object file to find its ctor/dtor routine.  */
+      TREE_PUBLIC (init_decl) = ! targetm.have_ctors_dtors;
+
+      /* Suppress spurious warnings.  */
+      TREE_USED (init_decl) = 1;
+
       pushlevel (0);
       make_decl_rtl (init_decl, NULL);
       init_function_start (init_decl, input_filename, 0);
       expand_function_start (init_decl, 0);
-      
+
+      /* Do not allow the function to be deferred.  */
+      current_function_cannot_inline
+       = "static constructors and destructors cannot be inlined";
+
       for ( t = registered_class; t; t = TREE_CHAIN (t))
        emit_library_call (registerClass_libfunc, 0, VOIDmode, 1,
                           XEXP (DECL_RTL (t), 0), Pmode);
       
       expand_function_end (input_filename, 0, 0);
       poplevel (1, 0, 1);
-      { 
-       /* Force generation, even with -O3 or deeper. Gross hack. FIXME */
-       int saved_flag = flag_inline_functions;
-       flag_inline_functions = 0;      
-       rest_of_compilation (init_decl);
-       flag_inline_functions = saved_flag;
-      }
+      rest_of_compilation (init_decl);
       current_function_decl = NULL_TREE;
-      assemble_constructor (XEXP (DECL_RTL (init_decl), 0), DEFAULT_INIT_PRIORITY);
+
+      if (targetm.have_ctors_dtors)
+       (* targetm.asm_out.constructor) (XEXP (DECL_RTL (init_decl), 0),
+                                        DEFAULT_INIT_PRIORITY);
     }
 }
 
index bd2437dacc77762c35bcfc8f055d90952502877d..824870be1323a662e6c52a300ce861e69ce7c480 100644 (file)
@@ -77,7 +77,7 @@ $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in
        $(SHELL) $(srcdir)/move-if-change tmp-objc-prs.y $(srcdir)/objc/objc-parse.y
 
 objc-act.o : $(srcdir)/objc/objc-act.c \
-   $(CONFIG_H) $(TREE_H) $(RTL_H) $(SYSTEM_H) $(EXPR_H) \
+   $(CONFIG_H) $(TREE_H) $(RTL_H) $(SYSTEM_H) $(EXPR_H) $(TARGET_H) \
    $(srcdir)/c-tree.h $(srcdir)/c-common.h $(srcdir)/c-lex.h \
    $(srcdir)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \
    $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h $(srcdir)/debug.h
index 67e4000252b85ed07109536109205dbf12a0d249..c0b14b5af296bd39fd5484899a4a48068ed5db27 100644 (file)
@@ -57,6 +57,7 @@ Boston, MA 02111-1307, USA.  */
 #include "ggc.h"
 #include "cpplib.h"
 #include "debug.h"
+#include "target.h"
 
 /* This is the default way of generating a method name.  */
 /* I am not sure it is really correct.
@@ -1913,60 +1914,51 @@ build_module_descriptor ()
     return NULL_RTX;
 
   {
-    tree parms, function_decl, decelerator, void_list_node_1;
-    tree function_type;
-    tree init_function_name = get_file_function_name ('I');
+    tree parms, execclass_decl, decelerator, void_list_node_1;
+    tree init_function_name, init_function_decl;
 
     /* Declare void __objc_execClass (void *); */
 
     void_list_node_1 = build_tree_list (NULL_TREE, void_type_node);
-    function_type
-      = build_function_type (void_type_node,
-                            tree_cons (NULL_TREE, ptr_type_node,
-                                       void_list_node_1));
-    function_decl = build_decl (FUNCTION_DECL,
-                               get_identifier (TAG_EXECCLASS),
-                               function_type);
-    DECL_EXTERNAL (function_decl) = 1;
-    DECL_ARTIFICIAL (function_decl) = 1;
-    TREE_PUBLIC (function_decl) = 1;
-
-    pushdecl (function_decl);
-    rest_of_decl_compilation (function_decl, 0, 0, 0);
-
-    parms
-      = build_tree_list (NULL_TREE,
-                        build_unary_op (ADDR_EXPR, UOBJC_MODULES_decl, 0));
-    decelerator = build_function_call (function_decl, parms);
+    execclass_decl = build_decl (FUNCTION_DECL,
+                                get_identifier (TAG_EXECCLASS),
+                                build_function_type (void_type_node,
+                                       tree_cons (NULL_TREE, ptr_type_node,
+                                                  void_list_node_1)));
+    DECL_EXTERNAL (execclass_decl) = 1;
+    DECL_ARTIFICIAL (execclass_decl) = 1;
+    TREE_PUBLIC (execclass_decl) = 1;
+    pushdecl (execclass_decl);
+    rest_of_decl_compilation (execclass_decl, 0, 0, 0);
+    assemble_external (execclass_decl);
 
     /* void _GLOBAL_$I$<gnyf> () {objc_execClass (&L_OBJC_MODULES);}  */
 
+    init_function_name = get_file_function_name ('I');
     start_function (void_list_node_1,
                    build_nt (CALL_EXPR, init_function_name,
-                             /* This has the format of the output
-                                of get_parm_info.  */
                              tree_cons (NULL_TREE, NULL_TREE,
                                         void_list_node_1),
                              NULL_TREE),
                    NULL_TREE);
-#if 0 /* This should be turned back on later
-        for the systems where collect is not needed.  */
-    /* Make these functions nonglobal
-       so each file can use the same name.  */
-    TREE_PUBLIC (current_function_decl) = 0;
-#endif
-    TREE_USED (current_function_decl) = 1;
     store_parm_decls ();
 
-    assemble_external (function_decl);
-    c_expand_expr_stmt (decelerator);
+    init_function_decl = current_function_decl;
+    TREE_PUBLIC (init_function_decl) = ! targetm.have_ctors_dtors;
+    TREE_USED (init_function_decl) = 1;
+    current_function_cannot_inline
+      = "static constructors and destructors cannot be inlined";
 
-    TREE_PUBLIC (current_function_decl) = 1;
+    parms
+      = build_tree_list (NULL_TREE,
+                        build_unary_op (ADDR_EXPR, UOBJC_MODULES_decl, 0));
+    decelerator = build_function_call (execclass_decl, parms);
+
+    c_expand_expr_stmt (decelerator);
 
-    function_decl = current_function_decl;
     finish_function (0);
 
-    return XEXP (DECL_RTL (function_decl), 0);
+    return XEXP (DECL_RTL (init_function_decl), 0);
   }
 }
 
@@ -8360,8 +8352,8 @@ finish_objc ()
     {
       /* Arrange for Objc data structures to be initialized at run time.  */
       rtx init_sym = build_module_descriptor ();
-      if (init_sym)
-       assemble_constructor (init_sym, DEFAULT_INIT_PRIORITY);
+      if (init_sym && targetm.have_ctors_dtors)
+       (* targetm.asm_out.constructor) (init_sym, DEFAULT_INIT_PRIORITY);
     }
 
   /* Dump the class references.  This forces the appropriate classes
index 1b4601eff0cba30f2f84b7dd5588cce9ad08daac..a72f80dbf31c6956d2372686957679626af75238 100644 (file)
@@ -257,15 +257,6 @@ extern void assemble_variable              PARAMS ((tree, int, int, int));
 extern void assemble_external          PARAMS ((tree));
 #endif /* TREE_CODE */
 
-#ifdef RTX_CODE
-/* Record an element in the table of global destructors.  The argument
-   should be a SYMBOL_REF of the function to be called.  */
-extern void assemble_destructor                PARAMS ((rtx, int));
-
-/* Likewise for global constructors.  */
-extern void assemble_constructor       PARAMS ((rtx, int));
-#endif
-
 /* Assemble code to leave SIZE bytes of zeros.  */
 extern void assemble_zeros             PARAMS ((int));
 
@@ -476,3 +467,13 @@ extern void default_coff_asm_named_section PARAMS ((const char *, unsigned int,
 extern void default_pe_asm_named_section PARAMS ((const char *, unsigned int,
                                              unsigned int));
 
+extern void default_stabs_asm_out_destructor PARAMS ((struct rtx_def *, int));
+extern void default_named_section_asm_out_destructor PARAMS ((struct rtx_def *,
+                                                             int));
+extern void default_dtor_section_asm_out_destructor PARAMS ((struct rtx_def *,
+                                                            int));
+extern void default_stabs_asm_out_constructor PARAMS ((struct rtx_def *, int));
+extern void default_named_section_asm_out_constructor PARAMS ((struct rtx_def *,
+                                                              int));
+extern void default_ctor_section_asm_out_constructor PARAMS ((struct rtx_def *,
+                                                             int));
index 983df4330a72ee4e253796c79ad77b6b47b3322e..dbde8923f78348a25d10a968508ef1c5632c9f78 100644 (file)
@@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA.  */
 #include "hard-reg-set.h"
 #include "basic-block.h"
 #include "gcov-io.h"
+#include "target.h"
 
 /* Additional information about the edges we need.  */
 struct edge_info
@@ -1122,13 +1123,11 @@ output_func_start_profiler ()
                       build_function_type (void_type_node, NULL_TREE));
   DECL_EXTERNAL (fndecl) = 0;
 
-#if defined(ASM_OUTPUT_CONSTRUCTOR) && defined(ASM_OUTPUT_DESTRUCTOR)
   /* It can be a static function as long as collect2 does not have
      to scan the object file to find its ctor/dtor routine.  */
-  TREE_PUBLIC (fndecl) = 0;
-#else
-  TREE_PUBLIC (fndecl) = 1;
-#endif
+  TREE_PUBLIC (fndecl) = ! targetm.have_ctors_dtors;
+
+  TREE_USED (fndecl) = 1;
 
   DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
 
@@ -1176,5 +1175,7 @@ output_func_start_profiler ()
     fflush (asm_out_file);
   current_function_decl = NULL_TREE;
 
-  assemble_constructor (XEXP (DECL_RTL (fndecl), 0), DEFAULT_INIT_PRIORITY);
+  if (targetm.have_ctors_dtors)
+    (* targetm.asm_out.constructor) (XEXP (DECL_RTL (fndecl), 0),
+                                    DEFAULT_INIT_PRIORITY);
 }
index 939ca8fcbd28b41ab6373ff6d1238ee9797061e6..94f8d10221c76531eddaf9a80e06e435e2d2a181 100644 (file)
@@ -33,6 +33,38 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_ASM_FUNCTION_END_PROLOGUE no_asm_to_stream
 #define TARGET_ASM_FUNCTION_BEGIN_EPILOGUE no_asm_to_stream
 
+#if !defined(TARGET_ASM_CONSTRUCTOR) && !defined(USE_COLLECT2)
+# ifdef CTORS_SECTION_ASM_OP
+#  define TARGET_ASM_CONSTRUCTOR default_ctor_section_asm_out_constructor
+# else
+#  ifdef TARGET_ASM_NAMED_SECTION
+#   define TARGET_ASM_CONSTRUCTOR default_named_section_asm_out_constructor
+#  else
+#   define TARGET_ASM_CONSTRUCTOR default_stabs_asm_out_constructor
+#  endif
+# endif
+#endif
+
+#if !defined(TARGET_ASM_DESTRUCTOR) && !defined(USE_COLLECT2)
+# ifdef DTORS_SECTION_ASM_OP
+#  define TARGET_ASM_DESTRUCTOR default_dtor_section_asm_out_destructor
+# else
+#  ifdef TARGET_ASM_NAMED_SECTION
+#   define TARGET_ASM_DESTRUCTOR default_named_section_asm_out_destructor
+#  else
+#   define TARGET_ASM_DESTRUCTOR default_stabs_asm_out_destructor
+#  endif
+# endif
+#endif
+
+#if defined(TARGET_ASM_CONSTRUCTOR) && defined(TARGET_ASM_DESTRUCTOR)
+#define TARGET_HAVE_CTORS_DTORS true
+#else
+#define TARGET_HAVE_CTORS_DTORS false
+#define TARGET_ASM_CONSTRUCTOR NULL
+#define TARGET_ASM_DESTRUCTOR NULL
+#endif
+
 #ifdef TARGET_ASM_NAMED_SECTION
 #define TARGET_HAVE_NAMED_SECTIONS true
 #else
@@ -46,7 +78,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
                        TARGET_ASM_FUNCTION_END_PROLOGUE,       \
                        TARGET_ASM_FUNCTION_BEGIN_EPILOGUE,     \
                        TARGET_ASM_FUNCTION_EPILOGUE,           \
-                       TARGET_ASM_NAMED_SECTION}
+                       TARGET_ASM_NAMED_SECTION,               \
+                       TARGET_ASM_CONSTRUCTOR,                 \
+                       TARGET_ASM_DESTRUCTOR}
 
 /* All in tree.c.  */
 #define TARGET_MERGE_DECL_ATTRIBUTES merge_decl_attributes
@@ -80,5 +114,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   TARGET_INIT_BUILTINS,                                \
   TARGET_EXPAND_BUILTIN,                       \
   TARGET_SECTION_TYPE_FLAGS,                   \
-  TARGET_HAVE_NAMED_SECTIONS                   \
+  TARGET_HAVE_NAMED_SECTIONS,                  \
+  TARGET_HAVE_CTORS_DTORS                      \
 }
index d3f32faf9c797e9d4d942fe7959a47053458448b..3e9b46cb9d0f13c0dc1bddb38a8c7410e117daf8 100644 (file)
@@ -72,6 +72,12 @@ struct gcc_target
        the section; 0 if the default should be used.  */
     void (* named_section) PARAMS ((const char *, unsigned int,
                                    unsigned int));
+
+    /* Output a constructor for a symbol with a given priority.  */
+    void (* constructor) PARAMS ((struct rtx_def *, int));
+
+    /* Output a destructor for a symbol with a given priority.  */
+    void (* destructor) PARAMS ((struct rtx_def *, int));
   } asm_out;
 
   /* Given two decls, merge their attributes and return the result.  */
@@ -120,6 +126,10 @@ struct gcc_target
 
   /* True if arbitrary sections are supported.  */
   bool have_named_sections;
+
+  /* True if "native" constructors and destructors are supported,
+     false if we're using collect2 for the job.  */
+  bool have_ctors_dtors;
 };
 
 extern struct gcc_target targetm;
index d031bd11124d486ed514870b41d016ed816957cc..7480cf68c7a8e51b72555e6bec547b2a9bf3abb0 100644 (file)
@@ -188,6 +188,12 @@ static enum in_section { no_section, in_text, in_data, in_named
 #ifdef BSS_SECTION_ASM_OP
   , in_bss
 #endif
+#ifdef CTORS_SECTION_ASM_OP
+  , in_ctors
+#endif
+#ifdef DTORS_SECTION_ASM_OP
+  , in_dtors
+#endif
 #ifdef EXTRA_SECTIONS
   , EXTRA_SECTIONS
 #endif
@@ -813,88 +819,127 @@ assemble_asm (string)
   fprintf (asm_out_file, "\t%s\n", TREE_STRING_POINTER (string));
 }
 
-/* Record an element in the table of global destructors.  The argument
-   should be a SYMBOL_REF of the function to be called.  */
+/* Record an element in the table of global destructors.  SYMBOL is
+   a SYMBOL_REF of the function to be called; PRIORITY is a number
+   between 0 and MAX_INIT_PRIORITY.  */
 
 void
-assemble_destructor (symbol, priority)
+default_stabs_asm_out_destructor (symbol, priority)
      rtx symbol;
-     int priority;
+     int priority ATTRIBUTE_UNUSED;
 {
-  const char *name;
+  /* Tell GNU LD that this is part of the static destructor set.
+     This will work for any system that uses stabs, most usefully
+     aout systems.  */
+  fprintf (asm_out_file, "%s\"___DTOR_LIST__\",22,0,0,", ASM_STABS_OP);
+  assemble_name (asm_out_file, XSTR (symbol, 0));
+  fputc ('\n', asm_out_file);
+}
 
-  if (GET_CODE (symbol) != SYMBOL_REF)
-    abort ();
-  name = XSTR (symbol, 0);
+void
+default_named_section_asm_out_destructor (symbol, priority)
+     rtx symbol;
+     int priority;
+{
+  const char *section = ".dtors";
+  char buf[16];
 
-  if (priority != DEFAULT_INIT_PRIORITY
-      && targetm.have_named_sections)
+  /* ??? This only works reliably with the GNU linker.   */
+  if (priority != DEFAULT_INIT_PRIORITY)
     {
-      char buf[15];
       sprintf (buf, ".dtors.%.5u",
               /* Invert the numbering so the linker puts us in the proper
                  order; constructors are run from right to left, and the
                  linker sorts in increasing order.  */
               MAX_INIT_PRIORITY - priority);
-      named_section_flags (buf, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
-      assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
-      return;
+      section = buf;
     }
 
-#ifdef ASM_OUTPUT_DESTRUCTOR
-  ASM_OUTPUT_DESTRUCTOR (asm_out_file, name);
-#else
-  if (flag_gnu_linker)
+  named_section_flags (section, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+}
+
+#ifdef DTORS_SECTION_ASM_OP
+void
+dtors_section ()
+{
+  if (in_section != in_dtors)
     {
-      /* Now tell GNU LD that this is part of the static destructor set.  */
-      /* This code works for any machine provided you use GNU as/ld.  */
-      fprintf (asm_out_file, "%s\"___DTOR_LIST__\",22,0,0,", ASM_STABS_OP);
-      assemble_name (asm_out_file, name);
+      in_section = in_dtors;
+      fputs (DTORS_SECTION_ASM_OP, asm_out_file);
       fputc ('\n', asm_out_file);
     }
-#endif
 }
 
+void
+default_dtor_section_asm_out_destructor (symbol, priority)
+     rtx symbol;
+     int priority ATTRIBUTE_UNUSED;
+{
+  dtors_section ();
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+}
+#endif
+
 /* Likewise for global constructors.  */
 
 void
-assemble_constructor (symbol, priority)
+default_stabs_asm_out_constructor (symbol, priority)
      rtx symbol;
-     int priority;
+     int priority ATTRIBUTE_UNUSED;
 {
-  const char *name;
+  /* Tell GNU LD that this is part of the static destructor set.
+     This will work for any system that uses stabs, most usefully
+     aout systems.  */
+  fprintf (asm_out_file, "%s\"___CTOR_LIST__\",22,0,0,", ASM_STABS_OP);
+  assemble_name (asm_out_file, XSTR (symbol, 0));
+  fputc ('\n', asm_out_file);
+}
 
-  if (GET_CODE (symbol) != SYMBOL_REF)
-    abort ();
-  name = XSTR (symbol, 0);
+void
+default_named_section_asm_out_constructor (symbol, priority)
+     rtx symbol;
+     int priority;
+{
+  const char *section = ".ctors";
+  char buf[16];
 
-  if (priority != DEFAULT_INIT_PRIORITY
-      && targetm.have_named_sections)
+  /* ??? This only works reliably with the GNU linker.   */
+  if (priority != DEFAULT_INIT_PRIORITY)
     {
-      char buf[15];
       sprintf (buf, ".ctors.%.5u",
               /* Invert the numbering so the linker puts us in the proper
                  order; constructors are run from right to left, and the
                  linker sorts in increasing order.  */
               MAX_INIT_PRIORITY - priority);
-      named_section_flags (buf, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
-      assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
-      return;
+      section = buf;
     }
 
-#ifdef ASM_OUTPUT_CONSTRUCTOR
-  ASM_OUTPUT_CONSTRUCTOR (asm_out_file, name);
-#else
-  if (flag_gnu_linker)
+  named_section_flags (section, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+}
+
+#ifdef CTORS_SECTION_ASM_OP
+void
+ctors_section ()
+{
+  if (in_section != in_ctors)
     {
-      /* Now tell GNU LD that this is part of the static constructor set.  */
-      /* This code works for any machine provided you use GNU as/ld.  */
-      fprintf (asm_out_file, "%s\"___CTOR_LIST__\",22,0,0,", ASM_STABS_OP);
-      assemble_name (asm_out_file, name);
+      in_section = in_ctors;
+      fputs (CTORS_SECTION_ASM_OP, asm_out_file);
       fputc ('\n', asm_out_file);
     }
-#endif
 }
+
+void
+default_ctor_section_asm_out_constructor (symbol, priority)
+     rtx symbol;
+     int priority ATTRIBUTE_UNUSED;
+{
+  ctors_section ();
+  assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+}
+#endif
 \f
 /* CONSTANT_POOL_BEFORE_FUNCTION may be defined as an expression with
    a non-zero value if the constant pool should be output before the