]> git.pld-linux.org Git - packages/gcc.git/blame - gcc-pr20218.patch
This commit was manufactured by cvs2git to create branch 'GCC_4_1'.
[packages/gcc.git] / gcc-pr20218.patch
CommitLineData
04614261 1diff -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
22diff -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);
33diff -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 *
50diff -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
62diff -uNrp gcc-4_1-branch/gcc.orig/output.h gcc-4_1-branch/gcc/output.h
63--- gcc-4_1-branch/gcc.orig/output.h 2005-11-30 11:16:27.000000000 +0000
64+++ gcc-4_1-branch/gcc/output.h 2005-12-06 17:42:34.018988936 +0000
65@@ -586,6 +586,12 @@ extern void default_file_start (void);
66 extern void file_end_indicate_exec_stack (void);
67 extern bool default_valid_pointer_mode (enum machine_mode);
68
69+extern void default_elf_asm_output_external (FILE *file, tree,
70+ const char *);
71+extern void default_elf_asm_output_external_1 (tree);
72+extern void default_elf_asm_file_end (void);
73+extern int maybe_assemble_visibility (tree);
74+
75 extern int default_address_cost (rtx);
76
77 /* dbxout helper functions */
78diff -uNrp gcc-4_1-branch/gcc.orig/tree.h gcc-4_1-branch/gcc/tree.h
79--- gcc-4_1-branch/gcc.orig/tree.h 2005-11-30 11:16:27.000000000 +0000
80+++ gcc-4_1-branch/gcc/tree.h 2005-12-06 17:42:34.022988328 +0000
81@@ -4070,6 +4070,17 @@ extern void process_pending_assemble_ext
82 extern void finish_aliases_1 (void);
83 extern void finish_aliases_2 (void);
84
85+/* Linked list of all external symbols that are to be emitted by
86+ GCC. */
87+
88+struct extern_symbol_list GTY(())
89+{
90+ struct extern_symbol_list *next;
91+ tree decl;
92+};
93+
94+extern GTY(()) struct extern_symbol_list *extern_symbol_head;
95+
96 /* In stmt.c */
97 extern void expand_computed_goto (tree);
98 extern bool parse_output_constraint (const char **, int, int, int,
99diff -uNrp gcc-4_1-branch/gcc.orig/varasm.c gcc-4_1-branch/gcc/varasm.c
100--- gcc-4_1-branch/gcc.orig/varasm.c 2005-11-30 11:16:27.000000000 +0000
101+++ gcc-4_1-branch/gcc/varasm.c 2005-12-06 17:42:34.026987720 +0000
102@@ -126,7 +126,6 @@ static unsigned HOST_WIDE_INT array_size
103 static unsigned min_align (unsigned, unsigned);
104 static void output_constructor (tree, unsigned HOST_WIDE_INT, unsigned int);
105 static void globalize_decl (tree);
106-static void maybe_assemble_visibility (tree);
107 static int in_named_entry_eq (const void *, const void *);
108 static hashval_t in_named_entry_hash (const void *);
109 static void initialize_cold_section_name (void);
110@@ -4952,13 +4951,18 @@ default_assemble_visibility (tree decl,
111
112 /* A helper function to call assemble_visibility when needed for a decl. */
113
114-static void
115+int
116 maybe_assemble_visibility (tree decl)
117 {
118 enum symbol_visibility vis = DECL_VISIBILITY (decl);
119
120 if (vis != VISIBILITY_DEFAULT)
121- targetm.asm_out.visibility (decl, vis);
122+ {
123+ targetm.asm_out.visibility (decl, vis);
124+ return 1;
125+ }
126+ else
127+ return 0;
128 }
129
130 /* Returns 1 if the target configuration supports defining public symbols
131@@ -5725,4 +5729,64 @@ file_end_indicate_exec_stack (void)
132 named_section_flags (".note.GNU-stack", flags);
133 }
134
135+struct extern_symbol_list *extern_symbol_head;
136+
137+void
138+default_elf_asm_output_external_1 (tree decl)
139+{
140+ struct extern_symbol_list *p
141+ = ggc_alloc (sizeof (struct extern_symbol_list));
142+
143+ p->decl = decl;
144+ p->next = extern_symbol_head;
145+ extern_symbol_head = p;
146+}
147+
148+/* Emit text to declare externally defined symbols. It is needed to
149+ properly support non-default visibility. */
150+
151+void
152+default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED,
153+ tree decl,
154+ const char *name)
155+{
156+ /* Ignore builtin functions. */
157+ if (TREE_CODE (decl) == FUNCTION_DECL
158+ && strstr (name, "__builtin_") == name)
159+ return;
160+ else
161+ default_elf_asm_output_external_1 (decl);
162+}
163+
164+/* Print out the list of referenced global symbols with non-default
165+ visibility. */
166+
167+void
168+default_elf_asm_file_end (void)
169+{
170+ struct extern_symbol_list *p;
171+
172+ for (p = extern_symbol_head; p; p = p->next)
173+ {
174+ tree decl = p->decl;
175+ tree id = DECL_ASSEMBLER_NAME (decl);
176+
177+ if (!id)
178+ abort ();
179+
180+ /* We output the name if and only if TREE_SYMBOL_REFERENCED is
181+ set in order to avoid putting out names that are never really
182+ used. */
183+ if (targetm.binds_local_p (decl)
184+ && !TREE_ASM_WRITTEN (decl)
185+ && TREE_SYMBOL_REFERENCED (id))
186+ {
187+ maybe_assemble_visibility (decl);
188+ TREE_ASM_WRITTEN (decl) = 1;
189+ }
190+ }
191+
192+ extern_symbol_head = 0;
193+}
194+
195 #include "gt-varasm.h"
This page took 0.061839 seconds and 4 git commands to generate.