patches/gcc/3.4.0/pr15647-fix.patch
changeset 301 2be7232a73ac
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/3.4.0/pr15647-fix.patch	Sat Jul 28 21:34:41 2007 +0000
     1.3 @@ -0,0 +1,288 @@
     1.4 +Received: (qmail 11693 invoked from network); 26 May 2004 03:17:41 -0000
     1.5 +Received: from unknown (HELO r-rr.iij4u.or.jp) (210.130.0.76)
     1.6 +  by sourceware dot org with SMTP; 26 May 2004 03:17:41 -0000
     1.7 +Received: from localhost (frgw.3in.ne.jp [210.251.121.226])
     1.8 +	by r-rr dot iij4u dot or dot jp (8 dot 11 dot 6+IIJ/8 dot 11 dot 6) with ESMTP id i4Q3HbJ21421;
     1.9 +	Wed, 26 May 2004 12:17:37 +0900 (JST)
    1.10 +Date: Wed, 26 May 2004 12:13:58 +0900 (JST)
    1.11 +Message-Id: <20040526.121358.39460214.kkojima@rr.iij4u.or.jp>
    1.12 +To: gcc-patches at gcc dot gnu dot org
    1.13 +Cc: Mark Mitchell <mark at codesourcery dot com>
    1.14 +Subject: [PATCH] Fix PR target/15647 for sh-linux
    1.15 +From: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
    1.16 +Mime-Version: 1.0
    1.17 +Content-Type: Text/Plain; charset=us-ascii
    1.18 +Content-Transfer-Encoding: 7bit
    1.19 +
    1.20 +Hi,
    1.21 +
    1.22 +The appended patch is to fix PR target/15647
    1.23 +  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15647
    1.24 +for linux.
    1.25 +__udivsi3 is exported from libgcc_s.so.1 and gcc generates the code
    1.26 +which assumes r1 will be not clobbered when calling __udivsi3 in SH3
    1.27 +case.  This is bad because r1 is clobbered by PLT.
    1.28 +The another functions listed in the standard libgcc-std.ver which
    1.29 +possively have similar problem are __ashlsi3, __ashrsi3 and __lshrsi3,
    1.30 +though these are used only by SH1/2.
    1.31 +The patch below simply uses an SH specific libgcc-std.ver which drops
    1.32 +these functions.  SH linux uses a linker script libgcc_s.so having
    1.33 +libgcc.a as a suppementary library, so these functions given by
    1.34 +libgcc.a when needed in the link time.
    1.35 +Although mainline has one failure in bulding zlib which can be avoided
    1.36 +with -fno-reorder-blocks for sh3-unknown-linux-gnu target, x86 cross
    1.37 +to sh3-unknown-linux-gnu can be build successfully on mainline with
    1.38 +this patch except the above failure.  3.4-branch successfully bootstraps
    1.39 +with it and there are no new failures on the native sh4-unknown-linux-gnu.
    1.40 +The patch is highly sh-linux specific and seems to be safe.  I'll check
    1.41 +it into mainline.
    1.42 +The original PR is also for sh3 netbsd.  I'd like to leave it for the
    1.43 +netbsd experts.
    1.44 +
    1.45 +I think that it's too late for 3.3.4.  Mark, is it also late for
    1.46 +3.4.1?
    1.47 +
    1.48 +Regards,
    1.49 +	kaz
    1.50 +--
    1.51 +2004-05-26  Kaz Kojima  <kkojima@gcc.gnu.org>
    1.52 +
    1.53 +	* config/sh/t-linux (SHLIB_MAPFILES): Use sh specific
    1.54 +	libgcc-std.ver.
    1.55 +	* config/sh/libgcc-std.ver: New file.
    1.56 +
    1.57 +diff -u3prN ORIG-gcc/gcc/config/sh/t-linux LOCAL-gcc/gcc/config/sh/t-linux
    1.58 +--- ORIG-gcc/gcc/config/sh/t-linux	Mon Feb 16 20:13:25 2004
    1.59 ++++ LOCAL-gcc/gcc/config/sh/t-linux	Tue May 25 18:25:48 2004
    1.60 +@@ -11,8 +11,11 @@ MULTILIB_EXCEPTIONS=
    1.61 + EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
    1.62 + 
    1.63 + # Override t-slibgcc-elf-ver to export some libgcc symbols with
    1.64 +-# the symbol versions that glibc used.
    1.65 +-SHLIB_MAPFILES =  $(srcdir)/libgcc-std.ver $(srcdir)/config/sh/libgcc-glibc.ver
    1.66 ++# the symbol versions that glibc used.  Also use an sh specific
    1.67 ++# libgcc-std.ver to avoid to export some lib1func routines which
    1.68 ++# should not be called via PLT.
    1.69 ++SHLIB_MAPFILES =  $(srcdir)/config/sh/libgcc-std.ver \
    1.70 ++	$(srcdir)/config/sh/libgcc-glibc.ver
    1.71 + 
    1.72 + # Override SHLIB_LINK and SHLIB_INSTALL to use linker script
    1.73 + # libgcc_s.so.
    1.74 +diff -u3prN ORIG-gcc/gcc/config/sh/libgcc-std.ver LOCAL-gcc/gcc/config/sh/libgcc-std.ver
    1.75 +--- ORIG-gcc/gcc/config/sh/libgcc-std.ver	Thu Jan  1 09:00:00 1970
    1.76 ++++ LOCAL-gcc/gcc/config/sh/libgcc-std.ver	Tue May 25 18:50:54 2004
    1.77 +@@ -0,0 +1,213 @@
    1.78 ++GCC_3.0 {
    1.79 ++  # libgcc1 integer symbols
    1.80 ++  __absvsi2
    1.81 ++  __addvsi3
    1.82 ++  # __ashlsi3
    1.83 ++  # __ashrsi3
    1.84 ++  __divsi3
    1.85 ++  # __lshrsi3
    1.86 ++  __modsi3
    1.87 ++  __mulsi3
    1.88 ++  __mulvsi3
    1.89 ++  __negvsi2
    1.90 ++  __subvsi3
    1.91 ++  # __udivsi3
    1.92 ++  __umodsi3
    1.93 ++
    1.94 ++  # libgcc1 floating point symbols
    1.95 ++  __addsf3
    1.96 ++  __adddf3
    1.97 ++  __addxf3
    1.98 ++  __addtf3
    1.99 ++  __divsf3
   1.100 ++  __divdf3
   1.101 ++  __divxf3
   1.102 ++  __divtf3
   1.103 ++  __eqsf2
   1.104 ++  __eqdf2
   1.105 ++  __eqxf2
   1.106 ++  __eqtf2
   1.107 ++  __extenddfxf2
   1.108 ++  __extenddftf2
   1.109 ++  __extendsfdf2
   1.110 ++  __extendsfxf2
   1.111 ++  __extendsftf2
   1.112 ++  __fixsfsi
   1.113 ++  __fixdfsi
   1.114 ++  __fixxfsi
   1.115 ++  __fixtfsi
   1.116 ++  __floatsisf
   1.117 ++  __floatsidf
   1.118 ++  __floatsixf
   1.119 ++  __floatsitf
   1.120 ++  __gesf2
   1.121 ++  __gedf2
   1.122 ++  __gexf2
   1.123 ++  __getf2
   1.124 ++  __gtsf2
   1.125 ++  __gtdf2
   1.126 ++  __gtxf2
   1.127 ++  __gttf2
   1.128 ++  __lesf2
   1.129 ++  __ledf2
   1.130 ++  __lexf2
   1.131 ++  __letf2
   1.132 ++  __ltsf2
   1.133 ++  __ltdf2
   1.134 ++  __ltxf2
   1.135 ++  __lttf2
   1.136 ++  __mulsf3
   1.137 ++  __muldf3
   1.138 ++  __mulxf3
   1.139 ++  __multf3
   1.140 ++  __negsf2
   1.141 ++  __negdf2
   1.142 ++  __negxf2
   1.143 ++  __negtf2
   1.144 ++  __nesf2
   1.145 ++  __nedf2
   1.146 ++  __nexf2
   1.147 ++  __netf2
   1.148 ++  __subsf3
   1.149 ++  __subdf3
   1.150 ++  __subxf3
   1.151 ++  __subtf3
   1.152 ++  __truncdfsf2
   1.153 ++  __truncxfsf2
   1.154 ++  __trunctfsf2
   1.155 ++  __truncxfdf2
   1.156 ++  __trunctfdf2
   1.157 ++
   1.158 ++  # libgcc2 DImode arithmetic (for 32-bit targets).
   1.159 ++  __absvdi2
   1.160 ++  __addvdi3
   1.161 ++  __ashldi3
   1.162 ++  __ashrdi3
   1.163 ++  __cmpdi2
   1.164 ++  __divdi3
   1.165 ++  __ffsdi2
   1.166 ++  __fixdfdi
   1.167 ++  __fixsfdi
   1.168 ++  __fixtfdi
   1.169 ++  __fixxfdi
   1.170 ++  __fixunsdfdi
   1.171 ++  __fixunsdfsi
   1.172 ++  __fixunssfsi
   1.173 ++  __fixunssfdi
   1.174 ++  __fixunstfdi
   1.175 ++  __fixunstfsi
   1.176 ++  __fixunsxfdi
   1.177 ++  __fixunsxfsi
   1.178 ++  __floatdidf
   1.179 ++  __floatdisf
   1.180 ++  __floatdixf
   1.181 ++  __floatditf
   1.182 ++  __lshrdi3
   1.183 ++  __moddi3
   1.184 ++  __muldi3
   1.185 ++  __mulvdi3
   1.186 ++  __negdi2
   1.187 ++  __negvdi2
   1.188 ++  __subvdi3
   1.189 ++  __ucmpdi2
   1.190 ++  __udivdi3
   1.191 ++  __udivmoddi4
   1.192 ++  __umoddi3
   1.193 ++
   1.194 ++  # libgcc2 TImode arithmetic (for 64-bit targets).
   1.195 ++  __ashlti3
   1.196 ++  __ashrti3
   1.197 ++  __cmpti2
   1.198 ++  __divti3
   1.199 ++  __ffsti2
   1.200 ++  __fixdfti
   1.201 ++  __fixsfti
   1.202 ++  __fixtfti
   1.203 ++  __fixxfti
   1.204 ++  __lshrti3
   1.205 ++  __modti3
   1.206 ++  __multi3
   1.207 ++  __negti2
   1.208 ++  __ucmpti2
   1.209 ++  __udivmodti4
   1.210 ++  __udivti3
   1.211 ++  __umodti3
   1.212 ++  __fixunsdfti
   1.213 ++  __fixunssfti
   1.214 ++  __fixunstfti
   1.215 ++  __fixunsxfti
   1.216 ++  __floattidf
   1.217 ++  __floattisf
   1.218 ++  __floattixf
   1.219 ++  __floattitf
   1.220 ++
   1.221 ++  # Used to deal with trampoline initialization on some platforms
   1.222 ++  __clear_cache
   1.223 ++
   1.224 ++  # EH symbols
   1.225 ++  _Unwind_DeleteException
   1.226 ++  _Unwind_Find_FDE
   1.227 ++  _Unwind_ForcedUnwind
   1.228 ++  _Unwind_GetGR
   1.229 ++  _Unwind_GetIP
   1.230 ++  _Unwind_GetLanguageSpecificData
   1.231 ++  _Unwind_GetRegionStart
   1.232 ++  _Unwind_GetTextRelBase
   1.233 ++  _Unwind_GetDataRelBase
   1.234 ++  _Unwind_RaiseException
   1.235 ++  _Unwind_Resume
   1.236 ++  _Unwind_SetGR
   1.237 ++  _Unwind_SetIP
   1.238 ++  __deregister_frame
   1.239 ++  __deregister_frame_info
   1.240 ++  __deregister_frame_info_bases
   1.241 ++  __register_frame
   1.242 ++  __register_frame_info
   1.243 ++  __register_frame_info_bases
   1.244 ++  __register_frame_info_table
   1.245 ++  __register_frame_info_table_bases
   1.246 ++  __register_frame_table
   1.247 ++
   1.248 ++  # SjLj EH symbols
   1.249 ++  _Unwind_SjLj_Register
   1.250 ++  _Unwind_SjLj_Unregister
   1.251 ++  _Unwind_SjLj_RaiseException
   1.252 ++  _Unwind_SjLj_ForcedUnwind
   1.253 ++  _Unwind_SjLj_Resume
   1.254 ++}
   1.255 ++
   1.256 ++%inherit GCC_3.3 GCC_3.0
   1.257 ++GCC_3.3 {
   1.258 ++  _Unwind_FindEnclosingFunction
   1.259 ++  _Unwind_GetCFA
   1.260 ++  _Unwind_Backtrace
   1.261 ++  _Unwind_Resume_or_Rethrow
   1.262 ++  _Unwind_SjLj_Resume_or_Rethrow
   1.263 ++}
   1.264 ++
   1.265 ++%inherit GCC_3.3.1 GCC_3.3
   1.266 ++GCC_3.3.1 {
   1.267 ++  __gcc_personality_sj0
   1.268 ++  __gcc_personality_v0
   1.269 ++}
   1.270 ++
   1.271 ++%inherit GCC_3.3.2 GCC_3.3.1
   1.272 ++GCC_3.3.2 {
   1.273 ++}
   1.274 ++
   1.275 ++%inherit GCC_3.4 GCC_3.3.2
   1.276 ++GCC_3.4 {
   1.277 ++  # bit scanning and counting built-ins
   1.278 ++  __clzsi2
   1.279 ++  __clzdi2
   1.280 ++  __clzti2
   1.281 ++  __ctzsi2
   1.282 ++  __ctzdi2
   1.283 ++  __ctzti2
   1.284 ++  __popcountsi2
   1.285 ++  __popcountdi2
   1.286 ++  __popcountti2
   1.287 ++  __paritysi2
   1.288 ++  __paritydi2
   1.289 ++  __parityti2
   1.290 ++}
   1.291 +