]> git.pld-linux.org Git - packages/gcc4.git/blob - gcc4-pr20218.patch
- added from gcc/
[packages/gcc4.git] / gcc4-pr20218.patch
1 diff -uNrp gcc-4_1-branch/gcc.orig/config/elfos.h gcc-4_1-branch/gcc/config/elfos.h
2 --- gcc-4_1-branch/gcc.orig/config/elfos.h      2005-11-30 11:16:19.000000000 +0000
3 +++ gcc-4_1-branch/gcc/config/elfos.h   2005-12-06 17:42:34.002991368 +0000
4 @@ -487,3 +487,17 @@ Boston, MA 02110-1301, USA.  */
5          fprintf ((FILE), "\"\n");                                      \
6      }                                                                  \
7    while (0)
8 +
9 +/* A C statement (sans semicolon) to output to the stdio stream STREAM
10 +   any text necessary for declaring the name of an external symbol
11 +   named NAME whch is referenced in this compilation but not defined.
12 +   It is needed to properly support non-default visibility.  */
13 +
14 +#ifndef ASM_OUTPUT_EXTERNAL
15 +#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
16 +  default_elf_asm_output_external (FILE, DECL, NAME)
17 +#endif
18 +
19 +#ifndef TARGET_ASM_FILE_END
20 +#define TARGET_ASM_FILE_END default_elf_asm_file_end
21 +#endif
22 diff -uNrp gcc-4_1-branch/gcc.orig/config/i386/i386-protos.h gcc-4_1-branch/gcc/config/i386/i386-protos.h
23 --- gcc-4_1-branch/gcc.orig/config/i386/i386-protos.h   2005-11-30 11:15:19.000000000 +0000
24 +++ gcc-4_1-branch/gcc/config/i386/i386-protos.h        2005-12-06 17:42:34.002991368 +0000
25 @@ -28,6 +28,7 @@ extern int ix86_frame_pointer_required (
26  extern void ix86_setup_frame_addresses (void);
27  
28  extern void ix86_file_end (void);
29 +extern void ix86_elf_file_end (void);
30  extern HOST_WIDE_INT ix86_initial_elimination_offset (int, int);
31  extern void ix86_expand_prologue (void);
32  extern void ix86_expand_epilogue (int);
33 diff -uNrp gcc-4_1-branch/gcc.orig/config/i386/i386.c gcc-4_1-branch/gcc/config/i386/i386.c
34 --- gcc-4_1-branch/gcc.orig/config/i386/i386.c  2005-12-06 17:39:59.080543160 +0000
35 +++ gcc-4_1-branch/gcc/config/i386/i386.c       2005-12-06 17:42:34.010990152 +0000
36 @@ -4417,6 +4417,13 @@ ix86_file_end (void)
37      file_end_indicate_exec_stack ();
38  }
39  
40 +void
41 +ix86_elf_file_end (void)
42 +{
43 +  ix86_file_end ();
44 +  default_elf_asm_file_end ();
45 +}
46 +
47  /* Emit code for the SET_GOT patterns.  */
48  
49  const char *
50 diff -uNrp gcc-4_1-branch/gcc.orig/config/i386/i386.h gcc-4_1-branch/gcc/config/i386/i386.h
51 --- gcc-4_1-branch/gcc.orig/config/i386/i386.h  2005-11-30 11:15:19.000000000 +0000
52 +++ gcc-4_1-branch/gcc/config/i386/i386.h       2005-12-06 17:48:04.665722992 +0000
53 @@ -1513,7 +1513,7 @@ typedef struct ix86_args {
54  #define EXPAND_BUILTIN_VA_START(VALIST, NEXTARG) \
55    ix86_va_start (VALIST, NEXTARG)
56  
57 -#define TARGET_ASM_FILE_END ix86_file_end
58 +#define TARGET_ASM_FILE_END ix86_elf_file_end
59  #define NEED_INDICATE_EXEC_STACK 0
60  
61  /* Output assembler code to FILE to increment profiler label # LABELNO
62 diff -uNrp gcc-4_1-branch/gcc.orig/config/rs6000/linux.h gcc-4_1-branch/gcc/config/rs6000/linux.h
63 --- gcc-4_1-branch/gcc.orig/config/rs6000/linux.h       2005-11-30 11:15:31.000000000 +0000
64 +++ gcc-4_1-branch/gcc/config/rs6000/linux.h    2005-12-06 20:02:14.949860336 +0000
65 @@ -108,7 +108,8 @@
66  #define RELOCATABLE_NEEDS_FIXUP \
67    (target_flags & target_flags_explicit & MASK_RELOCATABLE)
68  
69 -#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
70 +#undef TARGET_ASM_FILE_END
71 +#define TARGET_ASM_FILE_END rs6000_elf_file_end
72  
73  #define TARGET_POSIX_IO
74  
75 diff -uNrp gcc-4_1-branch/gcc.orig/config/rs6000/linux64.h gcc-4_1-branch/gcc/config/rs6000/linux64.h
76 --- gcc-4_1-branch/gcc.orig/config/rs6000/linux64.h     2005-11-30 11:15:31.000000000 +0000
77 +++ gcc-4_1-branch/gcc/config/rs6000/linux64.h  2005-12-06 20:02:03.882542824 +0000
78 @@ -543,7 +543,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
83 +#undef TARGET_ASM_FILE_END
84 +#define TARGET_ASM_FILE_END rs6000_elf_file_end
85  
86  #define TARGET_POSIX_IO
87  
88 diff -uNrp gcc-4_1-branch/gcc.orig/config/rs6000/rs6000.c gcc-4_1-branch/gcc/config/rs6000/rs6000.c
89 --- gcc-4_1-branch/gcc.orig/config/rs6000/rs6000.c      2005-11-30 11:15:31.000000000 +0000
90 +++ gcc-4_1-branch/gcc/config/rs6000/rs6000.c   2005-12-06 20:17:39.014381176 +0000
91 @@ -611,7 +611,7 @@ static void rs6000_file_start (void);
92  static unsigned int rs6000_elf_section_type_flags (tree, const char *, int);
93  static void rs6000_elf_asm_out_constructor (rtx, int);
94  static void rs6000_elf_asm_out_destructor (rtx, int);
95 -static void rs6000_elf_end_indicate_exec_stack (void) ATTRIBUTE_UNUSED;
96 +static void rs6000_elf_file_end (void) ATTRIBUTE_UNUSED;
97  static void rs6000_elf_select_section (tree, int, unsigned HOST_WIDE_INT);
98  static void rs6000_elf_unique_section (tree, int);
99  static void rs6000_elf_select_rtx_section (enum machine_mode, rtx,
100 @@ -18060,10 +18060,11 @@ rs6000_elf_declare_function_name (FILE *
101  }
102  
103  static void
104 -rs6000_elf_end_indicate_exec_stack (void)
105 +rs6000_elf_file_end (void)
106  {
107    if (TARGET_32BIT)
108      file_end_indicate_exec_stack ();
109 +  default_elf_asm_file_end ();
110  }
111  #endif
112  
113 diff -uNrp gcc-4_1-branch/gcc.orig/output.h gcc-4_1-branch/gcc/output.h
114 --- gcc-4_1-branch/gcc.orig/output.h    2005-11-30 11:16:27.000000000 +0000
115 +++ gcc-4_1-branch/gcc/output.h 2005-12-06 17:42:34.018988936 +0000
116 @@ -586,6 +586,12 @@ extern void default_file_start (void);
117  extern void file_end_indicate_exec_stack (void);
118  extern bool default_valid_pointer_mode (enum machine_mode);
119  
120 +extern void default_elf_asm_output_external (FILE *file, tree,
121 +                                            const char *);
122 +extern void default_elf_asm_output_external_1 (tree);
123 +extern void default_elf_asm_file_end (void);
124 +extern int maybe_assemble_visibility (tree);
125 +
126  extern int default_address_cost (rtx);
127  
128  /* dbxout helper functions */
129 diff -uNrp gcc-4_1-branch/gcc.orig/tree.h gcc-4_1-branch/gcc/tree.h
130 --- gcc-4_1-branch/gcc.orig/tree.h      2005-11-30 11:16:27.000000000 +0000
131 +++ gcc-4_1-branch/gcc/tree.h   2005-12-06 17:42:34.022988328 +0000
132 @@ -4070,6 +4070,17 @@ extern void process_pending_assemble_ext
133  extern void finish_aliases_1 (void);
134  extern void finish_aliases_2 (void);
135  
136 +/* Linked list of all external symbols that are to be emitted by
137 +   GCC.  */
138 +
139 +struct extern_symbol_list GTY(())
140 +{
141 +  struct extern_symbol_list *next;
142 +  tree decl;
143 +};
144 +
145 +extern GTY(()) struct extern_symbol_list *extern_symbol_head;
146 +
147  /* In stmt.c */
148  extern void expand_computed_goto (tree);
149  extern bool parse_output_constraint (const char **, int, int, int,
150 diff -uNrp gcc-4_1-branch/gcc.orig/varasm.c gcc-4_1-branch/gcc/varasm.c
151 --- gcc-4_1-branch/gcc.orig/varasm.c    2005-11-30 11:16:27.000000000 +0000
152 +++ gcc-4_1-branch/gcc/varasm.c 2005-12-06 17:42:34.026987720 +0000
153 @@ -126,7 +126,6 @@ static unsigned HOST_WIDE_INT array_size
154  static unsigned min_align (unsigned, unsigned);
155  static void output_constructor (tree, unsigned HOST_WIDE_INT, unsigned int);
156  static void globalize_decl (tree);
157 -static void maybe_assemble_visibility (tree);
158  static int in_named_entry_eq (const void *, const void *);
159  static hashval_t in_named_entry_hash (const void *);
160  static void initialize_cold_section_name (void);
161 @@ -4952,13 +4951,18 @@ default_assemble_visibility (tree decl, 
162  
163  /* A helper function to call assemble_visibility when needed for a decl.  */
164  
165 -static void
166 +int
167  maybe_assemble_visibility (tree decl)
168  {
169    enum symbol_visibility vis = DECL_VISIBILITY (decl);
170  
171    if (vis != VISIBILITY_DEFAULT)
172 -    targetm.asm_out.visibility (decl, vis);
173 +    {
174 +      targetm.asm_out.visibility (decl, vis);
175 +      return 1;
176 +    }
177 +  else
178 +    return 0;
179  }
180  
181  /* Returns 1 if the target configuration supports defining public symbols
182 @@ -5725,4 +5729,64 @@ file_end_indicate_exec_stack (void)
183    named_section_flags (".note.GNU-stack", flags);
184  }
185  
186 +struct extern_symbol_list *extern_symbol_head;
187 +
188 +void
189 +default_elf_asm_output_external_1 (tree decl)
190 +{
191 +  struct extern_symbol_list *p
192 +    = ggc_alloc (sizeof (struct extern_symbol_list));
193 +
194 +  p->decl = decl;
195 +  p->next = extern_symbol_head;
196 +  extern_symbol_head = p;
197 +}
198 +
199 +/* Emit text to declare externally defined symbols. It is needed to
200 +   properly support non-default visibility.  */
201 +
202 +void
203 +default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED,
204 +                                tree decl,
205 +                                const char *name)
206 +{
207 +  /* Ignore builtin functions.  */
208 +  if (TREE_CODE (decl) == FUNCTION_DECL
209 +      && strstr (name, "__builtin_") == name)
210 +    return;
211 +  else 
212 +    default_elf_asm_output_external_1 (decl);
213 +}
214 +
215 +/* Print out the list of referenced global symbols with non-default
216 +   visibility.  */
217 +
218 +void
219 +default_elf_asm_file_end (void)
220 +{
221 +  struct extern_symbol_list *p;
222 +
223 +  for (p = extern_symbol_head; p; p = p->next)
224 +    {
225 +      tree decl = p->decl;
226 +      tree id = DECL_ASSEMBLER_NAME (decl);
227 +
228 +      if (!id)
229 +       abort ();
230 +
231 +      /* We output the name if and only if TREE_SYMBOL_REFERENCED is
232 +        set in order to avoid putting out names that are never really
233 +        used.  */
234 +      if (targetm.binds_local_p (decl)
235 +         && !TREE_ASM_WRITTEN (decl)
236 +         && TREE_SYMBOL_REFERENCED (id))
237 +       {
238 +         maybe_assemble_visibility (decl);
239 +         TREE_ASM_WRITTEN (decl) = 1;
240 +       }
241 +    }
242 +
243 +  extern_symbol_head = 0;
244 +}
245 +
246  #include "gt-varasm.h"
This page took 0.097282 seconds and 3 git commands to generate.