comparison gcc/config/sol2.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents a06113de4d67
children f6334be47118
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
1 /* General Solaris system support. 1 /* General Solaris system support.
2 Copyright (C) 2004, 2005 , 2007 Free Software Foundation, Inc. 2 Copyright (C) 2004, 2005 , 2007, 2010 Free Software Foundation, Inc.
3 Contributed by CodeSourcery, LLC. 3 Contributed by CodeSourcery, LLC.
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify 7 GCC is free software; you can redistribute it and/or modify
20 20
21 #include "config.h" 21 #include "config.h"
22 #include "system.h" 22 #include "system.h"
23 #include "coretypes.h" 23 #include "coretypes.h"
24 #include "tree.h" 24 #include "tree.h"
25 #include "output.h"
25 #include "tm.h" 26 #include "tm.h"
26 #include "rtl.h" 27 #include "rtl.h"
27 #include "tm_p.h" 28 #include "tm_p.h"
28 #include "toplev.h" 29 #include "toplev.h"
29 #include "ggc.h" 30 #include "ggc.h"
68 tree name = TREE_PURPOSE (*x); 69 tree name = TREE_PURPOSE (*x);
69 if (DECL_NAME (decl) == name) 70 if (DECL_NAME (decl) == name)
70 { 71 {
71 *attributes = tree_cons (get_identifier ("init"), NULL, 72 *attributes = tree_cons (get_identifier ("init"), NULL,
72 *attributes); 73 *attributes);
73 *attributes = tree_cons (get_identifier ("used"), NULL, 74 TREE_USED (decl) = 1;
74 *attributes); 75 DECL_PRESERVE_P (decl) = 1;
75 next = TREE_CHAIN (*x); 76 next = TREE_CHAIN (*x);
76 ggc_free (*x); 77 ggc_free (*x);
77 *x = next; 78 *x = next;
78 break; 79 break;
79 } 80 }
85 tree name = TREE_PURPOSE (*x); 86 tree name = TREE_PURPOSE (*x);
86 if (DECL_NAME (decl) == name) 87 if (DECL_NAME (decl) == name)
87 { 88 {
88 *attributes = tree_cons (get_identifier ("fini"), NULL, 89 *attributes = tree_cons (get_identifier ("fini"), NULL,
89 *attributes); 90 *attributes);
90 *attributes = tree_cons (get_identifier ("used"), NULL, 91 TREE_USED (decl) = 1;
91 *attributes); 92 DECL_PRESERVE_P (decl) = 1;
92 next = TREE_CHAIN (*x); 93 next = TREE_CHAIN (*x);
93 ggc_free (*x); 94 ggc_free (*x);
94 *x = next; 95 *x = next;
95 break; 96 break;
96 } 97 }
102 void 103 void
103 solaris_output_init_fini (FILE *file, tree decl) 104 solaris_output_init_fini (FILE *file, tree decl)
104 { 105 {
105 if (lookup_attribute ("init", DECL_ATTRIBUTES (decl))) 106 if (lookup_attribute ("init", DECL_ATTRIBUTES (decl)))
106 { 107 {
107 fprintf (file, "\t.pushsection\t\".init\"\n"); 108 fprintf (file, PUSHSECTION_FORMAT, ".init");
108 ASM_OUTPUT_CALL (file, decl); 109 ASM_OUTPUT_CALL (file, decl);
109 fprintf (file, "\t.popsection\n"); 110 fprintf (file, "\t.popsection\n");
110 } 111 }
111 112
112 if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl))) 113 if (lookup_attribute ("fini", DECL_ATTRIBUTES (decl)))
113 { 114 {
114 fprintf (file, "\t.pushsection\t\".fini\"\n"); 115 fprintf (file, PUSHSECTION_FORMAT, ".fini");
115 ASM_OUTPUT_CALL (file, decl); 116 ASM_OUTPUT_CALL (file, decl);
116 fprintf (file, "\t.popsection\n"); 117 fprintf (file, "\t.popsection\n");
117 } 118 }
118 } 119 }
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 }