]>
Commit | Line | Data |
---|---|---|
c6390455 PS |
1 | |
2 | config/elfos.h | 14 +++++++++ | |
3 | config/i386/i386-protos.h | 1 | |
4 | config/i386/i386.c | 7 ++++ | |
5 | config/i386/i386.h | 2 - | |
6 | config/rs6000/linux.h | 3 + | |
7 | config/rs6000/linux64.h | 3 + | |
8 | config/rs6000/rs6000.c | 5 +-- | |
9 | output.h | 6 +++ | |
10 | tree.h | 11 +++++++ | |
11 | varasm.c | 70 ++++++++++++++++++++++++++++++++++++++++++++-- | |
12 | 10 files changed, 114 insertions(+), 8 deletions(-) | |
13 | ||
14 | diff -uNrp trunk/gcc.orig/config/elfos.h trunk/gcc/config/elfos.h | |
15 | --- trunk/gcc.orig/config/elfos.h 2006-03-22 00:17:54.000000000 +0100 | |
16 | +++ trunk/gcc/config/elfos.h 2006-03-22 14:28:10.000000000 +0100 | |
17 | @@ -489,3 +489,17 @@ Boston, MA 02110-1301, USA. */ | |
56a037cb PS |
18 | fprintf ((FILE), "\"\n"); \ |
19 | } \ | |
20 | while (0) | |
21 | + | |
22 | +/* A C statement (sans semicolon) to output to the stdio stream STREAM | |
23 | + any text necessary for declaring the name of an external symbol | |
24 | + named NAME whch is referenced in this compilation but not defined. | |
25 | + It is needed to properly support non-default visibility. */ | |
26 | + | |
27 | +#ifndef ASM_OUTPUT_EXTERNAL | |
28 | +#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ | |
29 | + default_elf_asm_output_external (FILE, DECL, NAME) | |
30 | +#endif | |
31 | + | |
32 | +#ifndef TARGET_ASM_FILE_END | |
33 | +#define TARGET_ASM_FILE_END default_elf_asm_file_end | |
34 | +#endif | |
c6390455 PS |
35 | diff -uNrp trunk/gcc.orig/config/i386/i386.c trunk/gcc/config/i386/i386.c |
36 | --- trunk/gcc.orig/config/i386/i386.c 2006-03-22 14:20:45.000000000 +0100 | |
37 | +++ trunk/gcc/config/i386/i386.c 2006-03-22 14:28:10.000000000 +0100 | |
38 | @@ -4751,6 +4751,13 @@ ix86_file_end (void) | |
56a037cb PS |
39 | file_end_indicate_exec_stack (); |
40 | } | |
41 | ||
42 | +void | |
43 | +ix86_elf_file_end (void) | |
44 | +{ | |
45 | + ix86_file_end (); | |
46 | + default_elf_asm_file_end (); | |
47 | +} | |
48 | + | |
49 | /* Emit code for the SET_GOT patterns. */ | |
50 | ||
51 | const char * | |
c6390455 PS |
52 | diff -uNrp trunk/gcc.orig/config/i386/i386.h trunk/gcc/config/i386/i386.h |
53 | --- trunk/gcc.orig/config/i386/i386.h 2006-03-22 00:17:11.000000000 +0100 | |
54 | +++ trunk/gcc/config/i386/i386.h 2006-03-22 14:28:10.000000000 +0100 | |
55 | @@ -1438,7 +1438,7 @@ typedef struct ix86_args { | |
56a037cb PS |
56 | #define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \ |
57 | ix86_va_start (VALIST, NEXTARG) | |
58 | ||
59 | -#define TARGET_ASM_FILE_END ix86_file_end | |
60 | +#define TARGET_ASM_FILE_END ix86_elf_file_end | |
61 | #define NEED_INDICATE_EXEC_STACK 0 | |
62 | ||
63 | /* Output assembler code to FILE to increment profiler label # LABELNO | |
c6390455 PS |
64 | diff -uNrp trunk/gcc.orig/config/i386/i386-protos.h trunk/gcc/config/i386/i386-protos.h |
65 | --- trunk/gcc.orig/config/i386/i386-protos.h 2006-03-22 00:17:11.000000000 +0100 | |
66 | +++ trunk/gcc/config/i386/i386-protos.h 2006-03-22 14:28:10.000000000 +0100 | |
67 | @@ -29,6 +29,7 @@ extern int ix86_frame_pointer_required ( | |
68 | extern void ix86_setup_frame_addresses (void); | |
66a9562d | 69 | |
c6390455 PS |
70 | extern void ix86_file_end (void); |
71 | +extern void ix86_elf_file_end (void); | |
72 | extern HOST_WIDE_INT ix86_initial_elimination_offset (int, int); | |
73 | extern void ix86_expand_prologue (void); | |
74 | extern void ix86_expand_epilogue (int); | |
75 | diff -uNrp trunk/gcc.orig/config/rs6000/linux64.h trunk/gcc/config/rs6000/linux64.h | |
76 | --- trunk/gcc.orig/config/rs6000/linux64.h 2006-03-22 00:17:37.000000000 +0100 | |
77 | +++ trunk/gcc/config/rs6000/linux64.h 2006-03-22 14:28:10.000000000 +0100 | |
78 | @@ -563,7 +563,8 @@ while (0) | |
79 | #undef DRAFT_V4_STRUCT_RET | |
80 | #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT) | |
81 | ||
82 | -#define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack | |
66a9562d PS |
83 | +#undef TARGET_ASM_FILE_END |
84 | +#define TARGET_ASM_FILE_END rs6000_elf_file_end | |
85 | ||
86 | #define TARGET_POSIX_IO | |
87 | ||
c6390455 PS |
88 | diff -uNrp trunk/gcc.orig/config/rs6000/linux.h trunk/gcc/config/rs6000/linux.h |
89 | --- trunk/gcc.orig/config/rs6000/linux.h 2006-03-22 00:17:37.000000000 +0100 | |
90 | +++ trunk/gcc/config/rs6000/linux.h 2006-03-22 14:28:10.000000000 +0100 | |
91 | @@ -108,7 +108,8 @@ | |
92 | #define RELOCATABLE_NEEDS_FIXUP \ | |
93 | (target_flags & target_flags_explicit & MASK_RELOCATABLE) | |
66a9562d | 94 | |
c6390455 | 95 | -#define TARGET_ASM_FILE_END file_end_indicate_exec_stack |
66a9562d PS |
96 | +#undef TARGET_ASM_FILE_END |
97 | +#define TARGET_ASM_FILE_END rs6000_elf_file_end | |
98 | ||
99 | #define TARGET_POSIX_IO | |
100 | ||
c6390455 PS |
101 | diff -uNrp trunk/gcc.orig/config/rs6000/rs6000.c trunk/gcc/config/rs6000/rs6000.c |
102 | --- trunk/gcc.orig/config/rs6000/rs6000.c 2006-03-22 00:17:37.000000000 +0100 | |
103 | +++ trunk/gcc/config/rs6000/rs6000.c 2006-03-22 14:28:10.000000000 +0100 | |
104 | @@ -614,7 +614,7 @@ static void rs6000_file_start (void); | |
66a9562d PS |
105 | static unsigned int rs6000_elf_section_type_flags (tree, const char *, int); |
106 | static void rs6000_elf_asm_out_constructor (rtx, int); | |
107 | static void rs6000_elf_asm_out_destructor (rtx, int); | |
108 | -static void rs6000_elf_end_indicate_exec_stack (void) ATTRIBUTE_UNUSED; | |
109 | +static void rs6000_elf_file_end (void) ATTRIBUTE_UNUSED; | |
c6390455 PS |
110 | static void rs6000_elf_asm_init_sections (void); |
111 | static section *rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT); | |
66a9562d | 112 | static void rs6000_elf_unique_section (tree, int); |
c6390455 | 113 | @@ -18221,10 +18221,11 @@ rs6000_elf_declare_function_name (FILE * |
66a9562d PS |
114 | } |
115 | ||
116 | static void | |
117 | -rs6000_elf_end_indicate_exec_stack (void) | |
118 | +rs6000_elf_file_end (void) | |
119 | { | |
120 | if (TARGET_32BIT) | |
121 | file_end_indicate_exec_stack (); | |
122 | + default_elf_asm_file_end (); | |
123 | } | |
124 | #endif | |
125 | ||
c6390455 PS |
126 | diff -uNrp trunk/gcc.orig/output.h trunk/gcc/output.h |
127 | --- trunk/gcc.orig/output.h 2006-03-22 00:17:58.000000000 +0100 | |
128 | +++ trunk/gcc/output.h 2006-03-22 14:28:10.000000000 +0100 | |
129 | @@ -608,6 +608,12 @@ extern void default_file_start (void); | |
56a037cb PS |
130 | extern void file_end_indicate_exec_stack (void); |
131 | extern bool default_valid_pointer_mode (enum machine_mode); | |
132 | ||
133 | +extern void default_elf_asm_output_external (FILE *file, tree, | |
134 | + const char *); | |
135 | +extern void default_elf_asm_output_external_1 (tree); | |
136 | +extern void default_elf_asm_file_end (void); | |
137 | +extern int maybe_assemble_visibility (tree); | |
138 | + | |
139 | extern int default_address_cost (rtx); | |
140 | ||
141 | /* dbxout helper functions */ | |
c6390455 PS |
142 | diff -uNrp trunk/gcc.orig/tree.h trunk/gcc/tree.h |
143 | --- trunk/gcc.orig/tree.h 2006-03-22 00:17:58.000000000 +0100 | |
144 | +++ trunk/gcc/tree.h 2006-03-22 14:28:10.000000000 +0100 | |
145 | @@ -4388,6 +4388,17 @@ extern void process_pending_assemble_ext | |
56a037cb PS |
146 | extern void finish_aliases_1 (void); |
147 | extern void finish_aliases_2 (void); | |
148 | ||
149 | +/* Linked list of all external symbols that are to be emitted by | |
150 | + GCC. */ | |
151 | + | |
152 | +struct extern_symbol_list GTY(()) | |
153 | +{ | |
154 | + struct extern_symbol_list *next; | |
155 | + tree decl; | |
156 | +}; | |
157 | + | |
158 | +extern GTY(()) struct extern_symbol_list *extern_symbol_head; | |
159 | + | |
160 | /* In stmt.c */ | |
161 | extern void expand_computed_goto (tree); | |
162 | extern bool parse_output_constraint (const char **, int, int, int, | |
c6390455 PS |
163 | diff -uNrp trunk/gcc.orig/varasm.c trunk/gcc/varasm.c |
164 | --- trunk/gcc.orig/varasm.c 2006-03-22 00:17:58.000000000 +0100 | |
165 | +++ trunk/gcc/varasm.c 2006-03-22 14:28:10.000000000 +0100 | |
56a037cb PS |
166 | @@ -126,7 +126,6 @@ static unsigned HOST_WIDE_INT array_size |
167 | static unsigned min_align (unsigned, unsigned); | |
168 | static void output_constructor (tree, unsigned HOST_WIDE_INT, unsigned int); | |
169 | static void globalize_decl (tree); | |
170 | -static void maybe_assemble_visibility (tree); | |
c6390455 PS |
171 | #ifdef BSS_SECTION_ASM_OP |
172 | #ifdef ASM_OUTPUT_BSS | |
173 | static void asm_output_bss (FILE *, tree, const char *, | |
174 | @@ -5039,13 +5038,18 @@ default_assemble_visibility (tree decl, | |
56a037cb PS |
175 | |
176 | /* A helper function to call assemble_visibility when needed for a decl. */ | |
177 | ||
178 | -static void | |
179 | +int | |
180 | maybe_assemble_visibility (tree decl) | |
181 | { | |
182 | enum symbol_visibility vis = DECL_VISIBILITY (decl); | |
183 | ||
184 | if (vis != VISIBILITY_DEFAULT) | |
185 | - targetm.asm_out.visibility (decl, vis); | |
186 | + { | |
187 | + targetm.asm_out.visibility (decl, vis); | |
188 | + return 1; | |
189 | + } | |
190 | + else | |
191 | + return 0; | |
192 | } | |
193 | ||
194 | /* Returns 1 if the target configuration supports defining public symbols | |
c6390455 PS |
195 | @@ -6194,4 +6198,64 @@ output_object_blocks (void) |
196 | htab_traverse (object_block_htab, output_object_block_htab, NULL); | |
56a037cb PS |
197 | } |
198 | ||
199 | +struct extern_symbol_list *extern_symbol_head; | |
200 | + | |
201 | +void | |
202 | +default_elf_asm_output_external_1 (tree decl) | |
203 | +{ | |
204 | + struct extern_symbol_list *p | |
205 | + = ggc_alloc (sizeof (struct extern_symbol_list)); | |
206 | + | |
207 | + p->decl = decl; | |
208 | + p->next = extern_symbol_head; | |
209 | + extern_symbol_head = p; | |
210 | +} | |
211 | + | |
212 | +/* Emit text to declare externally defined symbols. It is needed to | |
213 | + properly support non-default visibility. */ | |
214 | + | |
215 | +void | |
216 | +default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED, | |
217 | + tree decl, | |
218 | + const char *name) | |
219 | +{ | |
220 | + /* Ignore builtin functions. */ | |
221 | + if (TREE_CODE (decl) == FUNCTION_DECL | |
222 | + && strstr (name, "__builtin_") == name) | |
223 | + return; | |
224 | + else | |
225 | + default_elf_asm_output_external_1 (decl); | |
226 | +} | |
227 | + | |
228 | +/* Print out the list of referenced global symbols with non-default | |
229 | + visibility. */ | |
230 | + | |
231 | +void | |
232 | +default_elf_asm_file_end (void) | |
233 | +{ | |
234 | + struct extern_symbol_list *p; | |
235 | + | |
236 | + for (p = extern_symbol_head; p; p = p->next) | |
237 | + { | |
238 | + tree decl = p->decl; | |
239 | + tree id = DECL_ASSEMBLER_NAME (decl); | |
240 | + | |
241 | + if (!id) | |
242 | + abort (); | |
243 | + | |
244 | + /* We output the name if and only if TREE_SYMBOL_REFERENCED is | |
245 | + set in order to avoid putting out names that are never really | |
246 | + used. */ | |
247 | + if (targetm.binds_local_p (decl) | |
248 | + && !TREE_ASM_WRITTEN (decl) | |
249 | + && TREE_SYMBOL_REFERENCED (id)) | |
250 | + { | |
251 | + maybe_assemble_visibility (decl); | |
252 | + TREE_ASM_WRITTEN (decl) = 1; | |
253 | + } | |
254 | + } | |
255 | + | |
256 | + extern_symbol_head = 0; | |
257 | +} | |
258 | + | |
259 | #include "gt-varasm.h" |