source: scripts/patches/gcc-3.4.3-linkonce-1.patch@ 2deb938

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 2deb938 was 7f65c0e, checked in by Jim Gifford <clfs@…>, 19 years ago

r625@server (orig r623): jim | 2005-10-31 12:43:24 -0800
Final Move

  • Property mode set to 100644
File size: 12.2 KB
RevLine 
[617118d]1Submitted By: Jim Gifford (patches at jg555 dot com)
2Date: 2004-11-05
3Initial Package Version: 3.4.3
4Origin: Jim Gifford
5Upstream Status: Delayed till 3.4.4
6Description: Fixes linkone/comdat issue
7
8diff -Naur gcc-3.4.3.orig/gcc/config/alpha/alpha.c gcc-3.4.3/gcc/config/alpha/alpha.c
9--- gcc-3.4.3.orig/gcc/config/alpha/alpha.c 2004-09-30 17:45:48.000000000 +0000
10+++ gcc-3.4.3/gcc/config/alpha/alpha.c 2004-11-05 17:08:46.220272104 +0000
11@@ -10169,6 +10169,8 @@
12 # define TARGET_SECTION_TYPE_FLAGS unicosmk_section_type_flags
13 # undef TARGET_ASM_UNIQUE_SECTION
14 # define TARGET_ASM_UNIQUE_SECTION unicosmk_unique_section
15+#undef TARGET_ASM_FUNCTION_RODATA_SECTION
16+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
17 # undef TARGET_ASM_GLOBALIZE_LABEL
18 # define TARGET_ASM_GLOBALIZE_LABEL hook_void_FILEptr_constcharptr
19 #endif
20diff -Naur gcc-3.4.3.orig/gcc/config/arm/pe.h gcc-3.4.3/gcc/config/arm/pe.h
21--- gcc-3.4.3.orig/gcc/config/arm/pe.h 2004-02-24 14:25:22.000000000 +0000
22+++ gcc-3.4.3/gcc/config/arm/pe.h 2004-11-05 17:08:46.225271344 +0000
23@@ -97,6 +97,7 @@
24 #define MULTIPLE_SYMBOL_SPACES
25
26 #define TARGET_ASM_UNIQUE_SECTION arm_pe_unique_section
27+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
28
29 #define SUPPORTS_ONE_ONLY 1
30
31diff -Naur gcc-3.4.3.orig/gcc/config/avr/avr.c gcc-3.4.3/gcc/config/avr/avr.c
32--- gcc-3.4.3.orig/gcc/config/avr/avr.c 2004-09-28 01:13:55.000000000 +0000
33+++ gcc-3.4.3/gcc/config/avr/avr.c 2004-11-05 17:56:54.764146688 +0000
34@@ -229,6 +229,8 @@
35 #define TARGET_ASM_FUNCTION_EPILOGUE avr_output_function_epilogue
36 #undef TARGET_ATTRIBUTE_TABLE
37 #define TARGET_ATTRIBUTE_TABLE avr_attribute_table
38+#undef TARGET_ASM_FUNCTION_RODATA_SECTION
39+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
40 #undef TARGET_INSERT_ATTRIBUTES
41 #define TARGET_INSERT_ATTRIBUTES avr_insert_attributes
42 #undef TARGET_SECTION_TYPE_FLAGS
43diff -Naur gcc-3.4.3.orig/gcc/config/darwin.h gcc-3.4.3/gcc/config/darwin.h
44--- gcc-3.4.3.orig/gcc/config/darwin.h 2004-09-11 20:32:17.000000000 +0000
45+++ gcc-3.4.3/gcc/config/darwin.h 2004-11-05 17:08:46.300259944 +0000
46@@ -686,6 +686,9 @@
47 #undef TARGET_ASM_SELECT_RTX_SECTION
48 #define TARGET_ASM_SELECT_RTX_SECTION machopic_select_rtx_section
49
50+#undef TARGET_ASM_FUNCTION_RODATA_SECTION
51+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
52+
53 #define ASM_DECLARE_UNRESOLVED_REFERENCE(FILE,NAME) \
54 do { \
55 if (FILE) { \
56diff -Naur gcc-3.4.3.orig/gcc/config/i386/cygming.h gcc-3.4.3/gcc/config/i386/cygming.h
57--- gcc-3.4.3.orig/gcc/config/i386/cygming.h 2004-06-08 06:30:13.000000000 +0000
58+++ gcc-3.4.3/gcc/config/i386/cygming.h 2004-11-05 17:08:46.304259336 +0000
59@@ -255,6 +255,7 @@
60
61 extern void i386_pe_unique_section (TREE, int);
62 #define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
63+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
64
65 #define SUPPORTS_ONE_ONLY 1
66
67diff -Naur gcc-3.4.3.orig/gcc/config/i386/i386-interix.h gcc-3.4.3/gcc/config/i386/i386-interix.h
68--- gcc-3.4.3.orig/gcc/config/i386/i386-interix.h 2004-01-31 06:18:20.000000000 +0000
69+++ gcc-3.4.3/gcc/config/i386/i386-interix.h 2004-11-05 17:08:46.307258880 +0000
70@@ -344,6 +344,7 @@
71
72 extern void i386_pe_unique_section (tree, int);
73 #define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
74+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
75
76 #define SUPPORTS_ONE_ONLY 1
77 #endif /* 0 */
78diff -Naur gcc-3.4.3.orig/gcc/config/ip2k/ip2k.c gcc-3.4.3/gcc/config/ip2k/ip2k.c
79--- gcc-3.4.3.orig/gcc/config/ip2k/ip2k.c 2004-01-31 06:18:25.000000000 +0000
80+++ gcc-3.4.3/gcc/config/ip2k/ip2k.c 2004-11-05 17:08:46.352252040 +0000
81@@ -98,6 +98,9 @@
82 #undef TARGET_ASM_UNIQUE_SECTION
83 #define TARGET_ASM_UNIQUE_SECTION unique_section
84
85+#undef TARGET_ASM_FUNCTION_RODATA_SECTION
86+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
87+
88 #undef TARGET_ATTRIBUTE_TABLE
89 #define TARGET_ATTRIBUTE_TABLE ip2k_attribute_table
90
91diff -Naur gcc-3.4.3.orig/gcc/config/mcore/mcore.c gcc-3.4.3/gcc/config/mcore/mcore.c
92--- gcc-3.4.3.orig/gcc/config/mcore/mcore.c 2004-01-31 06:18:29.000000000 +0000
93+++ gcc-3.4.3/gcc/config/mcore/mcore.c 2004-11-05 17:08:46.384247176 +0000
94@@ -165,6 +165,8 @@
95 #define TARGET_ATTRIBUTE_TABLE mcore_attribute_table
96 #undef TARGET_ASM_UNIQUE_SECTION
97 #define TARGET_ASM_UNIQUE_SECTION mcore_unique_section
98+#undef TARGET_ASM_FUNCTION_RODATA_SECTION
99+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
100 #undef TARGET_ENCODE_SECTION_INFO
101 #define TARGET_ENCODE_SECTION_INFO mcore_encode_section_info
102 #undef TARGET_STRIP_NAME_ENCODING
103diff -Naur gcc-3.4.3.orig/gcc/config/rs6000/xcoff.h gcc-3.4.3/gcc/config/rs6000/xcoff.h
104--- gcc-3.4.3.orig/gcc/config/rs6000/xcoff.h 2004-01-31 06:18:34.000000000 +0000
105+++ gcc-3.4.3/gcc/config/rs6000/xcoff.h 2004-11-05 17:08:46.000000000 +0000
106@@ -172,6 +172,7 @@
107 #define TARGET_ASM_SELECT_SECTION rs6000_xcoff_select_section
108 #define TARGET_ASM_SELECT_RTX_SECTION rs6000_xcoff_select_rtx_section
109 #define TARGET_ASM_UNIQUE_SECTION rs6000_xcoff_unique_section
110+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
111 #define TARGET_STRIP_NAME_ENCODING rs6000_xcoff_strip_name_encoding
112 #define TARGET_SECTION_TYPE_FLAGS rs6000_xcoff_section_type_flags
113
114diff -Naur gcc-3.4.3.orig/gcc/doc/tm.texi gcc-3.4.3/gcc/doc/tm.texi
115--- gcc-3.4.3.orig/gcc/doc/tm.texi 2004-10-13 14:16:27.000000000 +0000
116+++ gcc-3.4.3/gcc/doc/tm.texi 2004-11-05 17:08:46.503229088 +0000
117@@ -6003,6 +6003,15 @@
118 Whatever the actual target object format, this is often good enough.
119 @end deftypefn
120
121+@deftypefn {Target Hook} void TARGET_ASM_FUNCTION_RODATA_SECTION (tree @var{decl})
122+Switches to a readonly data section associated with
123+@samp{DECL_SECTION_NAME (@var{decl})}.
124+The default version of this function switches to @code{.gnu.linkonce.r.name}
125+section if function's section is @code{.gnu.linkonce.t.name}, to
126+@code{.rodata.name} if function is in @code{.text.name} section
127+and otherwise switches to the normal readonly data section.
128+@end deftypefn
129+
130 @deftypefn {Target Hook} void TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
131 Switches to the appropriate section for output of constant pool entry
132 @var{x} in @var{mode}. You can assume that @var{x} is some kind of
133diff -Naur gcc-3.4.3.orig/gcc/final.c gcc-3.4.3/gcc/final.c
134--- gcc-3.4.3.orig/gcc/final.c 2004-01-18 22:39:57.000000000 +0000
135+++ gcc-3.4.3/gcc/final.c 2004-11-05 17:08:46.542223160 +0000
136@@ -1881,7 +1881,7 @@
137 {
138 int log_align;
139
140- readonly_data_section ();
141+ targetm.asm_out.function_rodata_section (current_function_decl);
142
143 #ifdef ADDR_VEC_ALIGN
144 log_align = ADDR_VEC_ALIGN (NEXT_INSN (insn));
145diff -Naur gcc-3.4.3.orig/gcc/output.h gcc-3.4.3/gcc/output.h
146--- gcc-3.4.3.orig/gcc/output.h 2004-01-18 22:39:57.000000000 +0000
147+++ gcc-3.4.3/gcc/output.h 2004-11-05 17:08:46.549222096 +0000
148@@ -500,6 +500,8 @@
149 unsigned HOST_WIDE_INT, int);
150 extern void default_unique_section (tree, int);
151 extern void default_unique_section_1 (tree, int, int);
152+extern void default_function_rodata_section (tree);
153+extern void default_no_function_rodata_section (tree);
154 extern void default_select_rtx_section (enum machine_mode, rtx,
155 unsigned HOST_WIDE_INT);
156 extern void default_elf_select_rtx_section (enum machine_mode, rtx,
157diff -Naur gcc-3.4.3.orig/gcc/target-def.h gcc-3.4.3/gcc/target-def.h
158--- gcc-3.4.3.orig/gcc/target-def.h 2004-08-23 18:02:40.000000000 +0000
159+++ gcc-3.4.3/gcc/target-def.h 2004-11-05 17:08:46.553221488 +0000
160@@ -78,6 +78,10 @@
161 #define TARGET_ASM_UNIQUE_SECTION default_unique_section
162 #endif
163
164+#ifndef TARGET_ASM_FUNCTION_RODATA_SECTION
165+#define TARGET_ASM_FUNCTION_RODATA_SECTION default_function_rodata_section
166+#endif
167+
168 #ifndef TARGET_ASM_SELECT_RTX_SECTION
169 #define TARGET_ASM_SELECT_RTX_SECTION default_select_rtx_section
170 #endif
171@@ -201,6 +205,7 @@
172 TARGET_ASM_SELECT_SECTION, \
173 TARGET_ASM_SELECT_RTX_SECTION, \
174 TARGET_ASM_UNIQUE_SECTION, \
175+ TARGET_ASM_FUNCTION_RODATA_SECTION, \
176 TARGET_ASM_CONSTRUCTOR, \
177 TARGET_ASM_DESTRUCTOR, \
178 TARGET_ASM_OUTPUT_MI_THUNK, \
179diff -Naur gcc-3.4.3.orig/gcc/target.h gcc-3.4.3/gcc/target.h
180--- gcc-3.4.3.orig/gcc/target.h 2004-08-23 18:02:41.000000000 +0000
181+++ gcc-3.4.3/gcc/target.h 2004-11-05 17:08:46.558220728 +0000
182@@ -118,6 +118,10 @@
183 for SELECT_SECTION. */
184 void (* unique_section) (tree, int);
185
186+ /* Tell assembler to switch to the readonly data section associated
187+ with function DECL. */
188+ void (* function_rodata_section) (tree);
189+
190 /* Output a constructor for a symbol with a given priority. */
191 void (* constructor) (rtx, int);
192
193diff -Naur gcc-3.4.3.orig/gcc/testsuite/g++.old-deja/g++.other/comdat4-aux.cc gcc-3.4.3/gcc/testsuite/g++.old-deja/g++.other/comdat4-aux.cc
194--- gcc-3.4.3.orig/gcc/testsuite/g++.old-deja/g++.other/comdat4-aux.cc 1970-01-01 00:00:00.000000000 +0000
195+++ gcc-3.4.3/gcc/testsuite/g++.old-deja/g++.other/comdat4-aux.cc 2004-11-05 17:08:46.560220424 +0000
196@@ -0,0 +1,40 @@
197+extern void
198+bar (int x);
199+
200+inline void
201+foo (int i)
202+{
203+ switch (i)
204+ {
205+ case 3:
206+ case 5:
207+ case 6:
208+ case 9:
209+ case 15:
210+ bar (1);
211+ break;
212+ case 2:
213+ case 4:
214+ case 7:
215+ case 10:
216+ case 11:
217+ case 12:
218+ bar (2);
219+ break;
220+ case 0:
221+ case 1:
222+ case 8:
223+ case 13:
224+ case 16:
225+ bar (3);
226+ break;
227+ case 14:
228+ bar (4);
229+ break;
230+ default:
231+ bar (5);
232+ break;
233+ }
234+}
235+
236+void *fooaddr2 = (void *) foo;
237diff -Naur gcc-3.4.3.orig/gcc/testsuite/g++.old-deja/g++.other/comdat4.C gcc-3.4.3/gcc/testsuite/g++.old-deja/g++.other/comdat4.C
238--- gcc-3.4.3.orig/gcc/testsuite/g++.old-deja/g++.other/comdat4.C 1970-01-01 00:00:00.000000000 +0000
239+++ gcc-3.4.3/gcc/testsuite/g++.old-deja/g++.other/comdat4.C 2004-11-05 17:08:46.562220120 +0000
240@@ -0,0 +1,57 @@
241+// PR c++/16276
242+// { dg-do link }
243+// { dg-additional-sources " comdat4-aux.cc" }
244+// { dg-options "-O2" }
245+
246+extern void
247+bar (int x);
248+
249+inline void
250+foo (int i)
251+{
252+ switch (i)
253+ {
254+ case 3:
255+ case 5:
256+ case 6:
257+ case 9:
258+ case 15:
259+ bar (1);
260+ break;
261+ case 2:
262+ case 4:
263+ case 7:
264+ case 10:
265+ case 11:
266+ case 12:
267+ bar (2);
268+ break;
269+ case 0:
270+ case 1:
271+ case 8:
272+ case 13:
273+ case 16:
274+ bar (3);
275+ break;
276+ case 14:
277+ bar (4);
278+ break;
279+ default:
280+ bar (5);
281+ break;
282+ }
283+}
284+
285+void *fooaddr = (void *) foo;
286+
287+void
288+bar (int x)
289+{
290+ __asm __volatile ("" : : "r" (x));
291+}
292+
293+int
294+main (void)
295+{
296+ return 0;
297+}
298diff -Naur gcc-3.4.3.orig/gcc/varasm.c gcc-3.4.3/gcc/varasm.c
299--- gcc-3.4.3.orig/gcc/varasm.c 2004-10-31 09:10:03.000000000 +0000
300+++ gcc-3.4.3/gcc/varasm.c 2004-11-05 17:08:46.603213888 +0000
301@@ -535,6 +535,53 @@
302 text_section ();
303 }
304
305+/* Switch to read-only data section associated with function DECL. */
306+
307+void
308+default_function_rodata_section (tree decl)
309+{
310+ if (decl != NULL_TREE && DECL_SECTION_NAME (decl))
311+ {
312+ const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
313+
314+ /* For .gnu.linkonce.t.foo we want to use .gnu.linkonce.r.foo. */
315+ if (DECL_ONE_ONLY (decl) && strncmp (name, ".gnu.linkonce.t.", 16) == 0)
316+ {
317+ size_t len = strlen (name) + 1;
318+ char *rname = alloca (len);
319+
320+ memcpy (rname, name, len);
321+ rname[14] = 'r';
322+ named_section_flags (rname, SECTION_LINKONCE);
323+ return;
324+ }
325+ /* For .text.foo we want to use .rodata.foo. */
326+ else if (flag_function_sections && flag_data_sections
327+ && strncmp (name, ".text.", 6) == 0)
328+ {
329+ size_t len = strlen (name) + 1;
330+ char *rname = alloca (len + 2);
331+
332+ memcpy (rname, ".rodata", 7);
333+ memcpy (rname + 7, name + 5, len - 5);
334+ named_section_flags (rname, 0);
335+ return;
336+ }
337+ }
338+
339+ readonly_data_section ();
340+}
341+
342+/* Switch to read-only data section associated with function DECL
343+ for targets where that section should be always the single
344+ readonly data section. */
345+
346+void
347+default_no_function_rodata_section (tree decl ATTRIBUTE_UNUSED)
348+{
349+ readonly_data_section ();
350+}
351+
352 /* Switch to section for variable DECL. RELOC is the same as the
353 argument to SELECT_SECTION. */
354
Note: See TracBrowser for help on using the repository browser.