annotate gcc/config/sol2.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* General Solaris system support.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 2004-2018 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 Contributed by CodeSourcery, LLC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #include "config.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #include "system.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "coretypes.h"
111
kono
parents: 67
diff changeset
24 #include "target.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "rtl.h"
111
kono
parents: 67
diff changeset
26 #include "tree.h"
kono
parents: 67
diff changeset
27 #include "memmodel.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 #include "tm_p.h"
111
kono
parents: 67
diff changeset
29 #include "stringpool.h"
kono
parents: 67
diff changeset
30 #include "attribs.h"
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
31 #include "diagnostic-core.h"
111
kono
parents: 67
diff changeset
32 #include "varasm.h"
kono
parents: 67
diff changeset
33 #include "output.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 tree solaris_pending_aligns, solaris_pending_inits, solaris_pending_finis;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 /* Attach any pending attributes for DECL to the list in *ATTRIBUTES.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 Pending attributes come from #pragma or _Pragma, so this code is
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 only useful in the C family front ends, but it is included in
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 all languages to avoid changing the target machine initializer
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 depending on the language. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 solaris_insert_attributes (tree decl, tree *attributes)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 tree *x, next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 tree name = TREE_PURPOSE (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 tree value = TREE_VALUE (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 if (DECL_NAME (decl) == name)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 if (lookup_attribute ("aligned", DECL_ATTRIBUTES (decl))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 || lookup_attribute ("aligned", *attributes))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 warning (0, "ignoring %<#pragma align%> for explicitly "
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 "aligned %q+D", decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 else
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 *attributes = tree_cons (get_identifier ("aligned"), value,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 *attributes);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 next = TREE_CHAIN (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 ggc_free (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 *x = next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 if (solaris_pending_inits != NULL && TREE_CODE (decl) == FUNCTION_DECL)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 for (x = &solaris_pending_inits; *x; x = &TREE_CHAIN (*x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 tree name = TREE_PURPOSE (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 if (DECL_NAME (decl) == name)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 *attributes = tree_cons (get_identifier ("init"), NULL,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 *attributes);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
77 TREE_USED (decl) = 1;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
78 DECL_PRESERVE_P (decl) = 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 next = TREE_CHAIN (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 ggc_free (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 *x = next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 if (solaris_pending_finis != NULL && TREE_CODE (decl) == FUNCTION_DECL)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 for (x = &solaris_pending_finis; *x; x = &TREE_CHAIN (*x))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 tree name = TREE_PURPOSE (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 if (DECL_NAME (decl) == name)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 *attributes = tree_cons (get_identifier ("fini"), NULL,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 *attributes);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
94 TREE_USED (decl) = 1;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
95 DECL_PRESERVE_P (decl) = 1;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 next = TREE_CHAIN (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 ggc_free (*x);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 *x = next;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 break;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 /* Output initializer or finalizer entries for DECL to FILE. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 solaris_output_init_fini (FILE *file, tree decl)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 if (lookup_attribute ("init", DECL_ATTRIBUTES (decl)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 {
111
kono
parents: 67
diff changeset
111 fprintf (file, "\t.pushsection\t" SECTION_NAME_FORMAT "\n", ".init");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 ASM_OUTPUT_CALL (file, decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 fprintf (file, "\t.popsection\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl)))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 {
111
kono
parents: 67
diff changeset
118 fprintf (file, "\t.pushsection\t" SECTION_NAME_FORMAT "\n", ".fini");
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 ASM_OUTPUT_CALL (file, decl);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 fprintf (file, "\t.popsection\n");
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
124 /* Emit an assembler directive to set symbol for DECL visibility to
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
125 the visibility type VIS, which must not be VISIBILITY_DEFAULT. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
126
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
127 void
111
kono
parents: 67
diff changeset
128 solaris_assemble_visibility (tree decl, int vis ATTRIBUTE_UNUSED)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
129 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
130 #ifdef HAVE_GAS_HIDDEN
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
131 /* Sun as uses .symbolic for STV_PROTECTED. STV_INTERNAL is marked as
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
132 `currently reserved', but the linker treats it like STV_HIDDEN. Sun
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
133 Studio 12.1 cc emits .hidden instead.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
134
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
135 There are 3 Sun extensions GCC doesn't yet know about: STV_EXPORTED,
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
136 STV_SINGLETON, and STV_ELIMINATE.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
137
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
138 See Linker and Libraries Guide, Ch. 2, Link-Editor, Defining
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
139 Additional Symbols, and Ch. 7, Object-File Format, Symbol Table
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
140 Section. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
141
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
142 static const char * const visibility_types[] = {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
143 NULL, "symbolic", "hidden", "hidden"
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
144 };
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
145
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
146 const char *name, *type;
111
kono
parents: 67
diff changeset
147 tree id = DECL_ASSEMBLER_NAME (decl);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
148
111
kono
parents: 67
diff changeset
149 while (IDENTIFIER_TRANSPARENT_ALIAS (id))
kono
parents: 67
diff changeset
150 id = TREE_CHAIN (id);
kono
parents: 67
diff changeset
151 name = IDENTIFIER_POINTER (id);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
152 type = visibility_types[vis];
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
153
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
154 fprintf (asm_out_file, "\t.%s\t", type);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
155 assemble_name (asm_out_file, name);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
156 fprintf (asm_out_file, "\n");
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
157 #else
111
kono
parents: 67
diff changeset
158 if (!DECL_ARTIFICIAL (decl))
kono
parents: 67
diff changeset
159 warning (OPT_Wattributes, "visibility attribute not supported "
kono
parents: 67
diff changeset
160 "in this configuration; ignored");
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
161 #endif
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
162 }
111
kono
parents: 67
diff changeset
163
kono
parents: 67
diff changeset
164 /* Group section information entry stored in solaris_comdat_htab. */
kono
parents: 67
diff changeset
165
kono
parents: 67
diff changeset
166 typedef struct comdat_entry
kono
parents: 67
diff changeset
167 {
kono
parents: 67
diff changeset
168 const char *name;
kono
parents: 67
diff changeset
169 unsigned int flags;
kono
parents: 67
diff changeset
170 tree decl;
kono
parents: 67
diff changeset
171 const char *sig;
kono
parents: 67
diff changeset
172 } comdat_entry;
kono
parents: 67
diff changeset
173
kono
parents: 67
diff changeset
174 /* Helpers for maintaining solaris_comdat_htab. */
kono
parents: 67
diff changeset
175
kono
parents: 67
diff changeset
176 struct comdat_entry_hasher : nofree_ptr_hash <comdat_entry>
kono
parents: 67
diff changeset
177 {
kono
parents: 67
diff changeset
178 static inline hashval_t hash (const comdat_entry *);
kono
parents: 67
diff changeset
179 static inline bool equal (const comdat_entry *, const comdat_entry *);
kono
parents: 67
diff changeset
180 static inline void remove (comdat_entry *);
kono
parents: 67
diff changeset
181 };
kono
parents: 67
diff changeset
182
kono
parents: 67
diff changeset
183 inline hashval_t
kono
parents: 67
diff changeset
184 comdat_entry_hasher::hash (const comdat_entry *entry)
kono
parents: 67
diff changeset
185 {
kono
parents: 67
diff changeset
186 return htab_hash_string (entry->sig);
kono
parents: 67
diff changeset
187 }
kono
parents: 67
diff changeset
188
kono
parents: 67
diff changeset
189 inline bool
kono
parents: 67
diff changeset
190 comdat_entry_hasher::equal (const comdat_entry *entry1,
kono
parents: 67
diff changeset
191 const comdat_entry *entry2)
kono
parents: 67
diff changeset
192 {
kono
parents: 67
diff changeset
193 return strcmp (entry1->sig, entry2->sig) == 0;
kono
parents: 67
diff changeset
194 }
kono
parents: 67
diff changeset
195
kono
parents: 67
diff changeset
196 /* Hash table of group signature symbols. */
kono
parents: 67
diff changeset
197
kono
parents: 67
diff changeset
198 static hash_table<comdat_entry_hasher> *solaris_comdat_htab;
kono
parents: 67
diff changeset
199
kono
parents: 67
diff changeset
200 /* Output assembly to switch to COMDAT group section NAME with attributes
kono
parents: 67
diff changeset
201 FLAGS and group signature symbol DECL, using Sun as syntax. */
kono
parents: 67
diff changeset
202
kono
parents: 67
diff changeset
203 void
kono
parents: 67
diff changeset
204 solaris_elf_asm_comdat_section (const char *name, unsigned int flags, tree decl)
kono
parents: 67
diff changeset
205 {
kono
parents: 67
diff changeset
206 const char *signature;
kono
parents: 67
diff changeset
207 char *section;
kono
parents: 67
diff changeset
208 comdat_entry entry, **slot;
kono
parents: 67
diff changeset
209
kono
parents: 67
diff changeset
210 if (TREE_CODE (decl) == IDENTIFIER_NODE)
kono
parents: 67
diff changeset
211 signature = IDENTIFIER_POINTER (decl);
kono
parents: 67
diff changeset
212 else
kono
parents: 67
diff changeset
213 signature = IDENTIFIER_POINTER (DECL_COMDAT_GROUP (decl));
kono
parents: 67
diff changeset
214
kono
parents: 67
diff changeset
215 /* Sun as requires group sections to be fragmented, i.e. to have names of
kono
parents: 67
diff changeset
216 the form <section>%<fragment>. Strictly speaking this is only
kono
parents: 67
diff changeset
217 necessary to support cc -xF, but is enforced globally in violation of
kono
parents: 67
diff changeset
218 the ELF gABI. We keep the section names generated by GCC (generally
kono
parents: 67
diff changeset
219 of the form .text.<signature>) and append %<signature> to pacify as,
kono
parents: 67
diff changeset
220 despite the redundancy. */
kono
parents: 67
diff changeset
221 section = concat (name, "%", signature, NULL);
kono
parents: 67
diff changeset
222
kono
parents: 67
diff changeset
223 /* Clear SECTION_LINKONCE flag so targetm.asm_out.named_section only
kono
parents: 67
diff changeset
224 emits this as a regular section. Emit section before .group
kono
parents: 67
diff changeset
225 directive since Sun as treats undeclared sections as @progbits,
kono
parents: 67
diff changeset
226 which conflicts with .bss* sections which are @nobits. */
kono
parents: 67
diff changeset
227 targetm.asm_out.named_section (section, flags & ~SECTION_LINKONCE, decl);
kono
parents: 67
diff changeset
228
kono
parents: 67
diff changeset
229 /* Sun as separates declaration of a group section and of the group
kono
parents: 67
diff changeset
230 itself, using the .group directive and the #comdat flag. */
kono
parents: 67
diff changeset
231 fprintf (asm_out_file, "\t.group\t%s," SECTION_NAME_FORMAT ",#comdat\n",
kono
parents: 67
diff changeset
232 signature, section);
kono
parents: 67
diff changeset
233
kono
parents: 67
diff changeset
234 /* Unlike GNU as, group signature symbols need to be defined explicitly
kono
parents: 67
diff changeset
235 for Sun as. With a few exceptions, this is already the case. To
kono
parents: 67
diff changeset
236 identify the missing ones without changing the affected frontents,
kono
parents: 67
diff changeset
237 remember the signature symbols and emit those not marked
kono
parents: 67
diff changeset
238 TREE_SYMBOL_REFERENCED in solaris_file_end. */
kono
parents: 67
diff changeset
239 if (!solaris_comdat_htab)
kono
parents: 67
diff changeset
240 solaris_comdat_htab = new hash_table<comdat_entry_hasher> (37);
kono
parents: 67
diff changeset
241
kono
parents: 67
diff changeset
242 entry.sig = signature;
kono
parents: 67
diff changeset
243 slot = solaris_comdat_htab->find_slot (&entry, INSERT);
kono
parents: 67
diff changeset
244
kono
parents: 67
diff changeset
245 if (*slot == NULL)
kono
parents: 67
diff changeset
246 {
kono
parents: 67
diff changeset
247 *slot = XCNEW (comdat_entry);
kono
parents: 67
diff changeset
248 /* Remember fragmented section name. */
kono
parents: 67
diff changeset
249 (*slot)->name = section;
kono
parents: 67
diff changeset
250 /* Emit as regular section, .group declaration has already been done. */
kono
parents: 67
diff changeset
251 (*slot)->flags = flags & ~SECTION_LINKONCE;
kono
parents: 67
diff changeset
252 (*slot)->decl = decl;
kono
parents: 67
diff changeset
253 (*slot)->sig = signature;
kono
parents: 67
diff changeset
254 }
kono
parents: 67
diff changeset
255 }
kono
parents: 67
diff changeset
256
kono
parents: 67
diff changeset
257 /* Define unreferenced COMDAT group signature symbol corresponding to SLOT. */
kono
parents: 67
diff changeset
258
kono
parents: 67
diff changeset
259 int
kono
parents: 67
diff changeset
260 solaris_define_comdat_signature (comdat_entry **slot,
kono
parents: 67
diff changeset
261 void *aux ATTRIBUTE_UNUSED)
kono
parents: 67
diff changeset
262 {
kono
parents: 67
diff changeset
263 comdat_entry *entry = *slot;
kono
parents: 67
diff changeset
264 tree decl = entry->decl;
kono
parents: 67
diff changeset
265
kono
parents: 67
diff changeset
266 if (TREE_CODE (decl) != IDENTIFIER_NODE)
kono
parents: 67
diff changeset
267 decl = DECL_COMDAT_GROUP (decl);
kono
parents: 67
diff changeset
268
kono
parents: 67
diff changeset
269 if (!TREE_SYMBOL_REFERENCED (decl))
kono
parents: 67
diff changeset
270 {
kono
parents: 67
diff changeset
271 /* Switch to group section, otherwise Sun as complains
kono
parents: 67
diff changeset
272 `Group Id symbol defined outside of group'. */
kono
parents: 67
diff changeset
273 switch_to_section (get_section (entry->name, entry->flags, entry->decl));
kono
parents: 67
diff changeset
274
kono
parents: 67
diff changeset
275 ASM_OUTPUT_LABEL (asm_out_file, entry->sig);
kono
parents: 67
diff changeset
276 }
kono
parents: 67
diff changeset
277
kono
parents: 67
diff changeset
278 /* Continue with scan. */
kono
parents: 67
diff changeset
279 return 1;
kono
parents: 67
diff changeset
280 }
kono
parents: 67
diff changeset
281
kono
parents: 67
diff changeset
282 /* Emit unreferenced COMDAT group signature symbols for Sun as. */
kono
parents: 67
diff changeset
283
kono
parents: 67
diff changeset
284 void
kono
parents: 67
diff changeset
285 solaris_file_end (void)
kono
parents: 67
diff changeset
286 {
kono
parents: 67
diff changeset
287 if (!solaris_comdat_htab)
kono
parents: 67
diff changeset
288 return;
kono
parents: 67
diff changeset
289
kono
parents: 67
diff changeset
290 solaris_comdat_htab->traverse <void *, solaris_define_comdat_signature>
kono
parents: 67
diff changeset
291 (NULL);
kono
parents: 67
diff changeset
292 }
kono
parents: 67
diff changeset
293
kono
parents: 67
diff changeset
294 void
kono
parents: 67
diff changeset
295 solaris_override_options (void)
kono
parents: 67
diff changeset
296 {
kono
parents: 67
diff changeset
297 /* Older versions of Solaris ld cannot handle CIE version 3 in .eh_frame.
kono
parents: 67
diff changeset
298 Don't emit DWARF3/4 unless specifically selected if so. */
kono
parents: 67
diff changeset
299 if (!HAVE_LD_EH_FRAME_CIEV3 && !global_options_set.x_dwarf_version)
kono
parents: 67
diff changeset
300 dwarf_version = 2;
kono
parents: 67
diff changeset
301 }