summaryrefslogtreecommitdiff
path: root/gcc/config/vxworks.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2007-02-26 15:53:51 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2007-02-26 15:53:51 +0000
commitb2f4bed8376bb0fd12110ca1eb25d6d5e5b6fb24 (patch)
treebc456dae4427f9afc91988189cd6ee26800382a0 /gcc/config/vxworks.c
parent6f7f72f999c4084fb561ad6f0f729e73173a5aa8 (diff)
output.h (assemble_addr_to_section): Declare.
* output.h (assemble_addr_to_section): Declare. (get_cdtor_priority_section): Likewise. * varasm.c (assemble_addr_to_section): New function. (get_cdtor_priority_section): Likewise. (default_named_section_asm_out_destructor): Use them. (destor_dtor_section_asm_out_destructor): Likewise. (default_named_section_asm_out_constructor): Likewise. (default_ctor_section_asm_out_constructor): Likewise. * config.gcc (*-*-vxworks*): Include vxworks.o. * config/t-vxworks (vxworks.o): New target. * config/vxworks.h (ALWAYS_NUMBER_CTORS_SECTIONS): Remove. (TARGET_ASM_CONSTRUCTOR): Define. (TARGET_ASM_DESTRUCTOR): Likewise. (vxworks_asm_out_constructor): Declare. (vxworks_asm_out_destructor): Likewise. * c-common.c (get_priority): Check that we have not just an INTEGER_CST, but an integer constant with integeral type. * gcc.dg/vxworks/vxworks.exp: New file. * gcc.dg/vxworks/initpri1.c: Likewise. * gcc.dg/vxworks/initpri2.c: Likewise. * gcc.dg/initpri2.c: Add more tests. * g++.dg/special/initpri2.C: Likewise. From-SVN: r122335
Diffstat (limited to 'gcc/config/vxworks.c')
-rw-r--r--gcc/config/vxworks.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/config/vxworks.c b/gcc/config/vxworks.c
new file mode 100644
index 00000000000..4ac33ab6c3e
--- /dev/null
+++ b/gcc/config/vxworks.c
@@ -0,0 +1,56 @@
+/* Common VxWorks target definitions for GNU compiler.
+ Copyright (C) 2007
+ Free Software Foundation, Inc.
+ Contributed by CodeSourcery, Inc.
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "output.h"
+#include "tm.h"
+
+/* Like default_named_section_asm_out_constructor, except that even
+ constructors with DEFAULT_INIT_PRIORITY must go in a numbered
+ section on VxWorks. The VxWorks runtime uses a clever trick to get
+ the sentinel entry (-1) inserted at the beginning of the .ctors
+ segment. This trick will not work if we ever generate any entries
+ in plain .ctors sections; we must always use .ctors.PRIORITY. */
+
+void
+vxworks_asm_out_constructor (rtx symbol, int priority)
+{
+ section *sec;
+
+ sec = get_cdtor_priority_section (priority,
+ /*constructor_p=*/true);
+ assemble_addr_to_section (symbol, sec);
+}
+
+/* See comment for vxworks_asm_out_constructor. */
+
+void
+vxworks_asm_out_destructor (rtx symbol, int priority)
+{
+ section *sec;
+
+ sec = get_cdtor_priority_section (priority,
+ /*constructor_p=*/false);
+ assemble_addr_to_section (symbol, sec);
+}