diff options
author | drow <drow@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-25 18:10:05 +0000 |
---|---|---|
committer | drow <drow@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-25 18:10:05 +0000 |
commit | e02a1225c1f626b4a5ab872777bd27c7d770abcd (patch) | |
tree | 5dbc183c09eb1a427c54aa5aeaf22fabec0f77cc /gcc/config/sol2.c | |
parent | 4d4d6e89b44f07f8fa616ffaa3f1ec04e64a9ed2 (diff) | |
download | gcc-e02a1225c1f626b4a5ab872777bd27c7d770abcd.tar.gz |
* config.gcc (i[34567]86-*-solaris2*, sparc64-*-solaris2*)
(sparc-*-solaris2*): Include sol2.o and sol2-protos.h.
* config/sol2-c.c: Include "tm.h", "tm_p.h", "toplev.h",
"cpplib.h", "c-pragma.h", "c-common.h".
(solaris_pragma_align, solaris_pragma_init, solaris_pragma_fini)
(solaris_register_pragmas): New functions.
* config/sol2-protos.h: New file.
* config/sol2.c: New file.
* config/sol2.h (SOLARIS_ATTRIBUTE_TABLE, ASM_DECLARE_FUNCTION_SIZE)
(REGISTER_TARGET_PRAGMAS): New macros.
(solaris_pending_aligns, solaris_pending_inits)
(solaris_pending_finis): New variables.
* config/t-sol2 (sol2-c.o): Update dependencies.
(sol2.o): New rule.
* config/i386/i386.c (TARGET_INSERT_ATTRIBUTES): Define in terms of
SUBTARGET_INSERT_ATTRIBUTES.
(ix86_attribute_table): Include SUBTARGET_ATTRIBUTE_TABLE.
* config/i386/sol2.h (SUBTARGET_INSERT_ATTRIBUTES)
(SUBTARGET_ATTRIBUTE_TABLE, ASM_OUTPUT_CALL): Define.
* config/sparc/elf.h (ASM_DECLARE_FUNCTION_SIZE): Redefine.
* config/sparc/sp64-elf.h (ASM_DECLARE_FUNCTION_SIZE): Redefine.
* config/sparc/sol2.h (SUBTARGET_INSERT_ATTRIBUTES)
(SUBTARGET_ATTRIBUTE_TABLE, ASM_OUTPUT_CALL): Define.
* config/sparc/sparc.c (sparc_attribute_table): New.
(TARGET_INSERT_ATTRIBUTES): Define in terms of
SUBTARGET_INSERT_ATTRIBUTES.
(TARGET_ATTRIBUTE_TABLE): Define if SUBTARGET_ATTRIBUTE_TABLE
is defined.
* doc/extend.texi (Solaris Pragmas): New section.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85155 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/sol2.c')
-rw-r--r-- | gcc/config/sol2.c | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c new file mode 100644 index 00000000000..edf0eee3b41 --- /dev/null +++ b/gcc/config/sol2.c @@ -0,0 +1,119 @@ +/* General Solaris system support. + Copyright (C) 2004 Free Software Foundation, Inc. + Contributed by CodeSourcery, LLC. + +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, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tree.h" +#include "tm.h" +#include "tm_p.h" +#include "toplev.h" +#include "ggc.h" + +tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis; + +/* Attach any pending attributes for DECL to the list in *ATTRIBUTES. + Pending attributes come from #pragma or _Pragma, so this code is + only useful in the C family front ends, but it is included in + all languages to avoid changing the target machine initializer + depending on the language. */ + +void +solaris_insert_attributes (tree decl, tree *attributes) +{ + tree *x, next; + + if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL) + for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x)) + { + tree name = TREE_PURPOSE (*x); + tree value = TREE_VALUE (*x); + if (DECL_NAME (decl) == name) + { + if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl)) + || lookup_attribute ("aligned", *attributes)) + warning ("%Jignoring %<#pragma align%> for explicitly " + "aligned %<%D%>", decl, decl); + else + *attributes = tree_cons (get_identifier ("aligned"), value, + *attributes); + next = TREE_CHAIN (*x); + ggc_free (*x); + *x = next; + break; + } + } + + if (solaris_pending_inits != NULL && TREE_CODE (decl) == FUNCTION_DECL) + for (x = &solaris_pending_inits; *x; x = &TREE_CHAIN (*x)) + { + tree name = TREE_PURPOSE (*x); + if (DECL_NAME (decl) == name) + { + *attributes = tree_cons (get_identifier ("init"), NULL, + *attributes); + *attributes = tree_cons (get_identifier ("used"), NULL, + *attributes); + next = TREE_CHAIN (*x); + ggc_free (*x); + *x = next; + break; + } + } + + if (solaris_pending_finis != NULL && TREE_CODE (decl) == FUNCTION_DECL) + for (x = &solaris_pending_finis; *x; x = &TREE_CHAIN (*x)) + { + tree name = TREE_PURPOSE (*x); + if (DECL_NAME (decl) == name) + { + *attributes = tree_cons (get_identifier ("fini"), NULL, + *attributes); + *attributes = tree_cons (get_identifier ("used"), NULL, + *attributes); + next = TREE_CHAIN (*x); + ggc_free (*x); + *x = next; + break; + } + } +} + +/* Output initializer or finalizer entries for DECL to FILE. */ + +void +solaris_output_init_fini (FILE *file, tree decl) +{ + if (lookup_attribute ("init", DECL_ATTRIBUTES (decl))) + { + fprintf (file, "\t.pushsection\t\".init\"\n"); + ASM_OUTPUT_CALL (file, IDENTIFIER_POINTER (DECL_NAME (decl))); + fprintf (file, "\t.popsection\n"); + } + + if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl))) + { + fprintf (file, "\t.pushsection\t\".fini\"\n"); + ASM_OUTPUT_CALL (file, IDENTIFIER_POINTER (DECL_NAME (decl))); + fprintf (file, "\t.popsection\n"); + } +} + |