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

Subversion Repositories openrisc_me

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 282 jeremybenn
/* General Solaris system support.
2
   Copyright (C) 2004, 2005 , 2007, 2010 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 "output.h"
26
#include "tm.h"
27
#include "rtl.h"
28
#include "tm_p.h"
29
#include "toplev.h"
30
#include "ggc.h"
31
 
32
tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis;
33
 
34
/* Attach any pending attributes for DECL to the list in *ATTRIBUTES.
35
   Pending attributes come from #pragma or _Pragma, so this code is
36
   only useful in the C family front ends, but it is included in
37
   all languages to avoid changing the target machine initializer
38
   depending on the language.  */
39
 
40
void
41
solaris_insert_attributes (tree decl, tree *attributes)
42
{
43
  tree *x, next;
44
 
45
  if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL)
46
    for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x))
47
      {
48
        tree name = TREE_PURPOSE (*x);
49
        tree value = TREE_VALUE (*x);
50
        if (DECL_NAME (decl) == name)
51
          {
52
            if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl))
53
                || lookup_attribute ("aligned", *attributes))
54
              warning (0, "ignoring %<#pragma align%> for explicitly "
55
                       "aligned %q+D", decl);
56
            else
57
              *attributes = tree_cons (get_identifier ("aligned"), value,
58
                                       *attributes);
59
            next = TREE_CHAIN (*x);
60
            ggc_free (*x);
61
            *x = next;
62
            break;
63
          }
64
      }
65
 
66
  if (solaris_pending_inits != NULL && TREE_CODE (decl) == FUNCTION_DECL)
67
    for (x = &solaris_pending_inits; *x; x = &TREE_CHAIN (*x))
68
      {
69
        tree name = TREE_PURPOSE (*x);
70
        if (DECL_NAME (decl) == name)
71
          {
72
            *attributes = tree_cons (get_identifier ("init"), NULL,
73
                                     *attributes);
74
            TREE_USED (decl) = 1;
75
            DECL_PRESERVE_P (decl) = 1;
76
            next = TREE_CHAIN (*x);
77
            ggc_free (*x);
78
            *x = next;
79
            break;
80
          }
81
      }
82
 
83
  if (solaris_pending_finis != NULL && TREE_CODE (decl) == FUNCTION_DECL)
84
    for (x = &solaris_pending_finis; *x; x = &TREE_CHAIN (*x))
85
      {
86
        tree name = TREE_PURPOSE (*x);
87
        if (DECL_NAME (decl) == name)
88
          {
89
            *attributes = tree_cons (get_identifier ("fini"), NULL,
90
                                     *attributes);
91
            TREE_USED (decl) = 1;
92
            DECL_PRESERVE_P (decl) = 1;
93
            next = TREE_CHAIN (*x);
94
            ggc_free (*x);
95
            *x = next;
96
            break;
97
          }
98
      }
99
}
100
 
101
/* Output initializer or finalizer entries for DECL to FILE.  */
102
 
103
void
104
solaris_output_init_fini (FILE *file, tree decl)
105
{
106
  if (lookup_attribute ("init", DECL_ATTRIBUTES (decl)))
107
    {
108
      fprintf (file, PUSHSECTION_FORMAT, ".init");
109
      ASM_OUTPUT_CALL (file, decl);
110
      fprintf (file, "\t.popsection\n");
111
    }
112
 
113
  if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl)))
114
    {
115
      fprintf (file, PUSHSECTION_FORMAT, ".fini");
116
      ASM_OUTPUT_CALL (file, decl);
117
      fprintf (file, "\t.popsection\n");
118
    }
119
}
120
 
121
/* Emit an assembler directive to set symbol for DECL visibility to
122
   the visibility type VIS, which must not be VISIBILITY_DEFAULT.  */
123
 
124
void
125
solaris_assemble_visibility (tree decl ATTRIBUTE_UNUSED,
126
                             int vis ATTRIBUTE_UNUSED)
127
{
128
#ifdef HAVE_GAS_HIDDEN
129
  /* Sun as uses .symbolic for STV_PROTECTED.  STV_INTERNAL is marked as
130
     `currently reserved', but the linker treats it like STV_HIDDEN.  Sun
131
     Studio 12.1 cc emits .hidden instead.
132
 
133
     There are 3 Sun extensions GCC doesn't yet know about: STV_EXPORTED,
134
     STV_SINGLETON, and STV_ELIMINATE.
135
 
136
     See Linker and Libraries Guide, Ch. 2, Link-Editor, Defining
137
     Additional Symbols with a mapfile,
138
     http://docs.sun.com/app/docs/doc/819-0690/gdzmc?a=view
139
     and Ch. 7, Object-File Format, Symbol Table Section,
140
     http://docs.sun.com/app/docs/doc/819-0690/chapter6-79797?a=view  */
141
 
142
  static const char * const visibility_types[] = {
143
    NULL, "symbolic", "hidden", "hidden"
144
  };
145
 
146
  const char *name, *type;
147
 
148
  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
149
  type = visibility_types[vis];
150
 
151
  fprintf (asm_out_file, "\t.%s\t", type);
152
  assemble_name (asm_out_file, name);
153
  fprintf (asm_out_file, "\n");
154
#else
155
  warning (OPT_Wattributes, "visibility attribute not supported "
156
           "in this configuration; ignored");
157
#endif
158
}

powered by: WebSVN 2.1.0

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