summaryrefslogtreecommitdiff
path: root/patches/gcc/3.4.0/pr15647-fix.patch
blob: 6a4265d6d66d816a0c01fd26314d28276534e1b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
Received: (qmail 11693 invoked from network); 26 May 2004 03:17:41 -0000
Received: from unknown (HELO r-rr.iij4u.or.jp) (210.130.0.76)
  by sourceware dot org with SMTP; 26 May 2004 03:17:41 -0000
Received: from localhost (frgw.3in.ne.jp [210.251.121.226])
	by r-rr dot iij4u dot or dot jp (8 dot 11 dot 6+IIJ/8 dot 11 dot 6) with ESMTP id i4Q3HbJ21421;
	Wed, 26 May 2004 12:17:37 +0900 (JST)
Date: Wed, 26 May 2004 12:13:58 +0900 (JST)
Message-Id: <20040526.121358.39460214.kkojima@rr.iij4u.or.jp>
To: gcc-patches at gcc dot gnu dot org
Cc: Mark Mitchell <mark at codesourcery dot com>
Subject: [PATCH] Fix PR target/15647 for sh-linux
From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

The appended patch is to fix PR target/15647
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15647
for linux.
__udivsi3 is exported from libgcc_s.so.1 and gcc generates the code
which assumes r1 will be not clobbered when calling __udivsi3 in SH3
case.  This is bad because r1 is clobbered by PLT.
The another functions listed in the standard libgcc-std.ver which
possively have similar problem are __ashlsi3, __ashrsi3 and __lshrsi3,
though these are used only by SH1/2.
The patch below simply uses an SH specific libgcc-std.ver which drops
these functions.  SH linux uses a linker script libgcc_s.so having
libgcc.a as a suppementary library, so these functions given by
libgcc.a when needed in the link time.
Although mainline has one failure in bulding zlib which can be avoided
with -fno-reorder-blocks for sh3-unknown-linux-gnu target, x86 cross
to sh3-unknown-linux-gnu can be build successfully on mainline with
this patch except the above failure.  3.4-branch successfully bootstraps
with it and there are no new failures on the native sh4-unknown-linux-gnu.
The patch is highly sh-linux specific and seems to be safe.  I'll check
it into mainline.
The original PR is also for sh3 netbsd.  I'd like to leave it for the
netbsd experts.

I think that it's too late for 3.3.4.  Mark, is it also late for
3.4.1?

Regards,
	kaz
--
2004-05-26  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/t-linux (SHLIB_MAPFILES): Use sh specific
	libgcc-std.ver.
	* config/sh/libgcc-std.ver: New file.

diff -u3prN ORIG-gcc/gcc/config/sh/t-linux LOCAL-gcc/gcc/config/sh/t-linux
--- ORIG-gcc/gcc/config/sh/t-linux	Mon Feb 16 20:13:25 2004
+++ LOCAL-gcc/gcc/config/sh/t-linux	Tue May 25 18:25:48 2004
@@ -11,8 +11,11 @@ MULTILIB_EXCEPTIONS=
 EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
 
 # Override t-slibgcc-elf-ver to export some libgcc symbols with
-# the symbol versions that glibc used.
-SHLIB_MAPFILES =  $(srcdir)/libgcc-std.ver $(srcdir)/config/sh/libgcc-glibc.ver
+# the symbol versions that glibc used.  Also use an sh specific
+# libgcc-std.ver to avoid to export some lib1func routines which
+# should not be called via PLT.
+SHLIB_MAPFILES =  $(srcdir)/config/sh/libgcc-std.ver \
+	$(srcdir)/config/sh/libgcc-glibc.ver
 
 # Override SHLIB_LINK and SHLIB_INSTALL to use linker script
 # libgcc_s.so.
diff -u3prN ORIG-gcc/gcc/config/sh/libgcc-std.ver LOCAL-gcc/gcc/config/sh/libgcc-std.ver
--- ORIG-gcc/gcc/config/sh/libgcc-std.ver	Thu Jan  1 09:00:00 1970
+++ LOCAL-gcc/gcc/config/sh/libgcc-std.ver	Tue May 25 18:50:54 2004
@@ -0,0 +1,213 @@
+GCC_3.0 {
+  # libgcc1 integer symbols
+  __absvsi2
+  __addvsi3
+  # __ashlsi3
+  # __ashrsi3
+  __divsi3
+  # __lshrsi3
+  __modsi3
+  __mulsi3
+  __mulvsi3
+  __negvsi2
+  __subvsi3
+  # __udivsi3
+  __umodsi3
+
+  # libgcc1 floating point symbols
+  __addsf3
+  __adddf3
+  __addxf3
+  __addtf3
+  __divsf3
+  __divdf3
+  __divxf3
+  __divtf3
+  __eqsf2
+  __eqdf2
+  __eqxf2
+  __eqtf2
+  __extenddfxf2
+  __extenddftf2
+  __extendsfdf2
+  __extendsfxf2
+  __extendsftf2
+  __fixsfsi
+  __fixdfsi
+  __fixxfsi
+  __fixtfsi
+  __floatsisf
+  __floatsidf
+  __floatsixf
+  __floatsitf
+  __gesf2
+  __gedf2
+  __gexf2
+  __getf2
+  __gtsf2
+  __gtdf2
+  __gtxf2
+  __gttf2
+  __lesf2
+  __ledf2
+  __lexf2
+  __letf2
+  __ltsf2
+  __ltdf2
+  __ltxf2
+  __lttf2
+  __mulsf3
+  __muldf3
+  __mulxf3
+  __multf3
+  __negsf2
+  __negdf2
+  __negxf2
+  __negtf2
+  __nesf2
+  __nedf2
+  __nexf2
+  __netf2
+  __subsf3
+  __subdf3
+  __subxf3
+  __subtf3
+  __truncdfsf2
+  __truncxfsf2
+  __trunctfsf2
+  __truncxfdf2
+  __trunctfdf2
+
+  # libgcc2 DImode arithmetic (for 32-bit targets).
+  __absvdi2
+  __addvdi3
+  __ashldi3
+  __ashrdi3
+  __cmpdi2
+  __divdi3
+  __ffsdi2
+  __fixdfdi
+  __fixsfdi
+  __fixtfdi
+  __fixxfdi
+  __fixunsdfdi
+  __fixunsdfsi
+  __fixunssfsi
+  __fixunssfdi
+  __fixunstfdi
+  __fixunstfsi
+  __fixunsxfdi
+  __fixunsxfsi
+  __floatdidf
+  __floatdisf
+  __floatdixf
+  __floatditf
+  __lshrdi3
+  __moddi3
+  __muldi3
+  __mulvdi3
+  __negdi2
+  __negvdi2
+  __subvdi3
+  __ucmpdi2
+  __udivdi3
+  __udivmoddi4
+  __umoddi3
+
+  # libgcc2 TImode arithmetic (for 64-bit targets).
+  __ashlti3
+  __ashrti3
+  __cmpti2
+  __divti3
+  __ffsti2
+  __fixdfti
+  __fixsfti
+  __fixtfti
+  __fixxfti
+  __lshrti3
+  __modti3
+  __multi3
+  __negti2
+  __ucmpti2
+  __udivmodti4
+  __udivti3
+  __umodti3
+  __fixunsdfti
+  __fixunssfti
+  __fixunstfti
+  __fixunsxfti
+  __floattidf
+  __floattisf
+  __floattixf
+  __floattitf
+
+  # Used to deal with trampoline initialization on some platforms
+  __clear_cache
+
+  # EH symbols
+  _Unwind_DeleteException
+  _Unwind_Find_FDE
+  _Unwind_ForcedUnwind
+  _Unwind_GetGR
+  _Unwind_GetIP
+  _Unwind_GetLanguageSpecificData
+  _Unwind_GetRegionStart
+  _Unwind_GetTextRelBase
+  _Unwind_GetDataRelBase
+  _Unwind_RaiseException
+  _Unwind_Resume
+  _Unwind_SetGR
+  _Unwind_SetIP
+  __deregister_frame
+  __deregister_frame_info
+  __deregister_frame_info_bases
+  __register_frame
+  __register_frame_info
+  __register_frame_info_bases
+  __register_frame_info_table
+  __register_frame_info_table_bases
+  __register_frame_table
+
+  # SjLj EH symbols
+  _Unwind_SjLj_Register
+  _Unwind_SjLj_Unregister
+  _Unwind_SjLj_RaiseException
+  _Unwind_SjLj_ForcedUnwind
+  _Unwind_SjLj_Resume
+}
+
+%inherit GCC_3.3 GCC_3.0
+GCC_3.3 {
+  _Unwind_FindEnclosingFunction
+  _Unwind_GetCFA
+  _Unwind_Backtrace
+  _Unwind_Resume_or_Rethrow
+  _Unwind_SjLj_Resume_or_Rethrow
+}
+
+%inherit GCC_3.3.1 GCC_3.3
+GCC_3.3.1 {
+  __gcc_personality_sj0
+  __gcc_personality_v0
+}
+
+%inherit GCC_3.3.2 GCC_3.3.1
+GCC_3.3.2 {
+}
+
+%inherit GCC_3.4 GCC_3.3.2
+GCC_3.4 {
+  # bit scanning and counting built-ins
+  __clzsi2
+  __clzdi2
+  __clzti2
+  __ctzsi2
+  __ctzdi2
+  __ctzti2
+  __popcountsi2
+  __popcountdi2
+  __popcountti2
+  __paritysi2
+  __paritydi2
+  __parityti2
+}