OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [sol2.c] - Blame information for rev 455

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* General Solaris system support.
2
   Copyright (C) 2004, 2005 , 2007 Free Software Foundation, Inc.
3
   Contributed by CodeSourcery, LLC.
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3, or (at your option)
10
any later version.
11
 
12
GCC is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING3.  If not see
19
<http://www.gnu.org/licenses/>.  */
20
 
21
#include "config.h"
22
#include "system.h"
23
#include "coretypes.h"
24
#include "tree.h"
25
#include "tm.h"
26
#include "rtl.h"
27
#include "tm_p.h"
28
#include "toplev.h"
29
#include "ggc.h"
30
 
31
tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis;
32
 
33
/* Attach any pending attributes for DECL to the list in *ATTRIBUTES.
34
   Pending attributes come from #pragma or _Pragma, so this code is
35
   only useful in the C family front ends, but it is included in
36
   all languages to avoid changing the target machine initializer
37
   depending on the language.  */
38
 
39
void
40
solaris_insert_attributes (tree decl, tree *attributes)
41
{
42
  tree *x, next;
43
 
44
  if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL)
45
    for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x))
46
      {
47
        tree name = TREE_PURPOSE (*x);
48
        tree value = TREE_VALUE (*x);
49
        if (DECL_NAME (decl) == name)
50
          {
51
            if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl))
52
                || lookup_attribute ("aligned", *attributes))
53
              warning (0, "ignoring %<#pragma align%> for explicitly "
54
                       "aligned %q+D", decl);
55
            else
56
              *attributes = tree_cons (get_identifier ("aligned"), value,
57
                                       *attributes);
58
            next = TREE_CHAIN (*x);
59
            ggc_free (*x);
60
            *x = next;
61
            break;
62
          }
63
      }
64
 
65
  if (solaris_pending_inits != NULL && TREE_CODE (decl) == FUNCTION_DECL)
66
    for (x = &solaris_pending_inits; *x; x = &TREE_CHAIN (*x))
67
      {
68
        tree name = TREE_PURPOSE (*x);
69
        if (DECL_NAME (decl) == name)
70
          {
71
            *attributes = tree_cons (get_identifier ("init"), NULL,
72
                                     *attributes);
73
            *attributes = tree_cons (get_identifier ("used"), NULL,
74
                                     *attributes);
75
            next = TREE_CHAIN (*x);
76
            ggc_free (*x);
77
            *x = next;
78
            break;
79
          }
80
      }
81
 
82
  if (solaris_pending_finis != NULL && TREE_CODE (decl) == FUNCTION_DECL)
83
    for (x = &solaris_pending_finis; *x; x = &TREE_CHAIN (*x))
84
      {
85
        tree name = TREE_PURPOSE (*x);
86
        if (DECL_NAME (decl) == name)
87
          {
88
            *attributes = tree_cons (get_identifier ("fini"), NULL,
89
                                     *attributes);
90
            *attributes = tree_cons (get_identifier ("used"), NULL,
91
                                     *attributes);
92
            next = TREE_CHAIN (*x);
93
            ggc_free (*x);
94
            *x = next;
95
            break;
96
          }
97
      }
98
}
99
 
100
/* Output initializer or finalizer entries for DECL to FILE.  */
101
 
102
void
103
solaris_output_init_fini (FILE *file, tree decl)
104
{
105
  if (lookup_attribute ("init", DECL_ATTRIBUTES (decl)))
106
    {
107
      fprintf (file, "\t.pushsection\t\".init\"\n");
108
      ASM_OUTPUT_CALL (file, decl);
109
      fprintf (file, "\t.popsection\n");
110
    }
111
 
112
  if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl)))
113
    {
114
      fprintf (file, "\t.pushsection\t\".fini\"\n");
115
      ASM_OUTPUT_CALL (file, decl);
116
      fprintf (file, "\t.popsection\n");
117
    }
118
}
119
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.