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.
# 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)
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= \
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= \
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
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
$(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)
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= \
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= \
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)
+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
#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);
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;
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*)
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'
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"
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
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
( (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.
#include "config.h"
#include "system.h"
#include "rtl.h"
+#include "tree.h"
#include "regs.h"
#include "hard-reg-set.h"
#include "real.h"
#include "function.h"
#include "expr.h"
#include "obstack.h"
-#include "tree.h"
#include "reload.h"
#include "tm_p.h"
#include "target.h"
+++ /dev/null
-/* 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)
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
#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 ()
} \
}
-#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
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
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
#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
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
#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)
/* 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
#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 \
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 ()
#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
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 \
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 \
} \
}
-#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 \
#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 \
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
#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
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
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
#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. */
#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. */
#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) \
/* 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"
#include "insn-attr.h"
#include "conditions.h"
#include "output.h"
-#include "tree.h"
#include "function.h"
#include "expr.h"
#include "flags.h"
#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"
#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 \
#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
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[];
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);
+}
#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.
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
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
}
}
}
+
+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");
+}
#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
/* 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. */
#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.
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
#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 ()
} \
}
-#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) \
} \
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
#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 () \
{ \
} \
}
-#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 \
{ \
}
#undef DO_GLOBAL_DTORS_BODY
-#define DO_GLOBAL_DTORS_BODY \
+#define DO_GLOBAL_DTORS_BODY \
{ \
typedef (*pfunc)(); \
extern pfunc __dtors[]; \
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
# 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
\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 () \
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. */
#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"
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. */
#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 */
#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
#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
#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 ()
} \
}
-#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
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. */
}
}
+#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)
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
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) \
((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 \
} \
}
-#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 : \
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"
/* 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. */
(*--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
} \
}
-/* 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
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)
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\""
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
#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)
-
-
#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).
#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 */
#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) \
}
#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
#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
#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
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;
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");
+}
/* 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. */
#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
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
#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
#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.
/* 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. */
#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 */
#include "tm_p.h"
#include "target.h"
#include "target-def.h"
+#include "debug.h"
/* Needed for use_return_insn. */
#include "flags.h"
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 */
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
#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. */
#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) \
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
#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
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
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);
}
}
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
#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. */
{ \
text_section(); \
}
-#define CTORS_SECTION_FUNCTION
-#define DTORS_SECTION_FUNCTION
#define INIT_SECTION_FUNCTION
#define FINI_SECTION_FUNCTION
} \
} \
\
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION \
INIT_SECTION_FUNCTION \
FINI_SECTION_FUNCTION
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 \
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
#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
#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.
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; \
} \
#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. */
/* 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
#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 () \
} \
}
-
-/* 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 ""
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. */
/* 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 () \
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 ""
#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
#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
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.
#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 */
#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
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
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
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 */
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 \
} \
}
-#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)
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");
+}
+
#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
#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) \
#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.
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
#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 ()
} \
}
-#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
} 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
/* 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
/* 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
#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
/* 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 \
} \
}
+/* 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
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*... */
#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
#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
#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)(); \
: /* 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)
#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
#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
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
} \
}
-/* 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
#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
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
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.
return;
}
#endif /* QSORT_WORKAROUND */
-
-#endif /* VMS */
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
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.
# 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=
# 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
# 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.
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
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
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
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
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
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
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
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
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
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
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
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"
-
-
# Echo that links are built
if test x$host = x$target
then
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
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
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.
# 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.
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)
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)
+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'.
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;
tree body;
{
tree fn;
- rtx fnsym;
/* Finish up. */
finish_compound_stmt (/*has_no_scope=*/0, 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
#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. */
#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
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
#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
#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
#endif /* CRT_END */
#endif /* OBJECT_FORMAT_MACHO */
-
#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
@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.