From: Geoffrey Keating Date: Fri, 31 Aug 2001 15:44:20 +0000 (+0000) Subject: stormy16.c (stormy16_asm_out_destructor): New function. X-Git-Tag: prereleases/libstdc++-3.0.95~2322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43898541b920dbcb8e3d24179cae3436a9c8b281;p=thirdparty%2Fgcc.git stormy16.c (stormy16_asm_out_destructor): New function. * config/stormy16/stormy16.c (stormy16_asm_out_destructor): New function. (stormy16_asm_out_constructor): New function. (TARGET_ASM_CONSTRUCTOR): Define. (TARGET_ASM_DESTRUCTOR): Define. From-SVN: r45322 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6993ca691dcb..a7ff0259117c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2001-08-31 Geoffrey Keating + + * config/stormy16/stormy16.c (stormy16_asm_out_destructor): New + function. + (stormy16_asm_out_constructor): New function. + (TARGET_ASM_CONSTRUCTOR): Define. + (TARGET_ASM_DESTRUCTOR): Define. + 2001-08-31 Andreas Jaeger * gcse.c (add_label_notes): REG_LABEL is an INSN_LIST. diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 758b97770b6f..ebb9be740649 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -45,6 +45,8 @@ Boston, MA 02111-1307, USA. */ #include "tm_p.h" static rtx emit_addhi3_postreload PARAMS ((rtx, rtx, rtx)); +static void stormy16_asm_out_constructor PARAMS ((rtx, int)); +static void stormy16_asm_out_destructor PARAMS ((rtx, int)); /* Define the information needed to generate branch and scc insns. This is stored from the compare operation. */ @@ -1324,6 +1326,61 @@ stormy16_encode_section_info (decl) if (TREE_CODE (decl) == FUNCTION_DECL) SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; } + +/* Output constructors and destructors. Just like + default_named_section_asm_out_* but don't set the sections writable. */ +#undef TARGET_ASM_CONSTRUCTOR +#define TARGET_ASM_CONSTRUCTOR stormy16_asm_out_constructor +#undef TARGET_ASM_DESTRUCTOR +#define TARGET_ASM_DESTRUCTOR stormy16_asm_out_destructor + +static void +stormy16_asm_out_destructor (symbol, priority) + rtx symbol; + int priority; +{ + const char *section = ".dtors"; + char buf[16]; + + /* ??? This only works reliably with the GNU linker. */ + if (priority != DEFAULT_INIT_PRIORITY) + { + sprintf (buf, ".dtors.%.5u", + /* Invert the numbering so the linker puts us in the proper + order; constructors are run from right to left, and the + linker sorts in increasing order. */ + MAX_INIT_PRIORITY - priority); + section = buf; + } + + named_section_flags (section, 0); + assemble_align (POINTER_SIZE); + assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1); +} + +static void +stormy16_asm_out_constructor (symbol, priority) + rtx symbol; + int priority; +{ + const char *section = ".ctors"; + char buf[16]; + + /* ??? This only works reliably with the GNU linker. */ + if (priority != DEFAULT_INIT_PRIORITY) + { + sprintf (buf, ".ctors.%.5u", + /* Invert the numbering so the linker puts us in the proper + order; constructors are run from right to left, and the + linker sorts in increasing order. */ + MAX_INIT_PRIORITY - priority); + section = buf; + } + + named_section_flags (section, 0); + assemble_align (POINTER_SIZE); + assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1); +} /* Print a memory address as an operand to reference that memory location. */ void