OSDN Git Service

Move constructor/destructor handling into target hooks.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Aug 2001 22:33:35 +0000 (22:33 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Aug 2001 22:33:35 +0000 (22:33 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44747 138bc75d-0d04-0410-961f-82ee72b054a4

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 92b4352..2ebe5cd 100644 (file)
@@ -1,5 +1,165 @@
 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.
        (__do_global_dtors_aux): Use gp-relative static data to avoid
        one dynamic relocation.
index bfa3a84..fb490f9 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 6c5056f..490d96c 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 b1c048b..f8fe135 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 c10eb99..806c944 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 087101d..433e77c 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 72ee543..ac6e7ee 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 a4905e6..8d816b2 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 4bbd988..b396c86 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 345d95e..ef65d72 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 a8e8900..c8e7667 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 bc7e1e6..506223c 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 9a7b270..07507a1 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 3b0baf5..2721b8b 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 11cb9bb..db057b9 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 102b53a..0c8cd03 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 da2f90d..add05c7 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 dba5e47..607bc48 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 1e3118e..d92030d 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 6aedd6e..bce6979 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 44e2e27..e39f37c 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 6eb5bfd..f911076 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 65311a3..f2bd5bd 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 5cebd58..193a523 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 82dde08..d813678 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 f419ba4..735a423 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 a9115ad..f085c42 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 02f9502..445d333 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 9ea367f..71b8468 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 f5e79c2..0bde498 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 69839e1..c1ae670 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 864f520..5b11410 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 6508625..aae281c 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 b7a7cdb..a818427 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 db4be5d..8733ba7 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 9d73502..8eb4bec 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 e9479ef..1bb897d 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 7e03383..d2ab075 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 b1fed12..7f46215 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 ea9eb2f..3902072 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 7769be5..a0594d8 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 119d8ee..04516fe 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 777fb88..5697a6a 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 c3c7635..28d9f9e 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 8a63c6c..946f196 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 886a34b..bb1c498 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 ea5cd13..ecf00fc 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 b18c07c..b03c29e 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 fd91481..5cfe659 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 bb03b05..4679738 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 4ece2d6..f77aa47 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 81358f7..1f7304c 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 9986f62..bd9f4a1 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 2d0c195..2362b52 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 3cd595e..5974ab8 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 4b88363..aa094b6 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 782c62b..c9bcd3e 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 4e3a227..ee33487 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 b917a78..c441198 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 ccec732..7a455e5 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 7d48662..ec6e13b 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 a28a9d0..2438a56 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 f15ae04..94492d4 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 d32675c..7bb9681 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 aa2c443..40004d1 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 bc2cc92..2df1615 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 6f67f35..26be5ef 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 f5b39e5..428ab43 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 646c987..8b755fc 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 2851d70..f52efa6 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 183fa96..761b1fb 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 1377610..9a2c347 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 3481c4b..d72f57f 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 c662eb3..e2340c3 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 9179635..21545f2 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 5e732af..6f26fde 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 e8a13dc..df4f76e 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 ccc1715..52f4d27 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 cd03812..640e5c2 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"
@@ -7844,8 +7835,6 @@ ${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xma
 
 
 
-
-
 # Echo that links are built
 if test x$host = x$target
 then
@@ -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 b4a8ba7..6d10583 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 50a96b6..02f3415 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 a649e23..0a9e5ad 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 c74377e..402ab01 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 0939d07..b069c57 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 4bcf827..0de3768 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.