patches/gcc/3.2.3/gcc-20030210-sh-linux-1.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     1 diff -ruN gcc-20030210.orig/boehm-gc/configure gcc-20030210/boehm-gc/configure
     2 --- gcc-20030210.orig/boehm-gc/configure	Fri Jan 31 19:17:00 2003
     3 +++ gcc-20030210/boehm-gc/configure	Sat Feb 22 01:40:14 2003
     4 @@ -1922,7 +1922,7 @@
     5  # This must be Linux ELF.
     6  linux-gnu*)
     7    case $host_cpu in
     8 -  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
     9 +  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* )
    10      lt_cv_deplibs_check_method=pass_all ;;
    11    *)
    12      # glibc up to 2.1.1 does not perform some relocations on ARM
    13 diff -ruN gcc-20030210.orig/config-ml.in gcc-20030210/config-ml.in
    14 --- gcc-20030210.orig/config-ml.in	Fri Jan 31 19:16:59 2003
    15 +++ gcc-20030210/config-ml.in	Sat Feb 22 01:40:14 2003
    16 @@ -545,6 +545,7 @@
    17  	      if [ -d ../$${dir}/$${lib} ]; then \
    18  		flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
    19  		if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
    20 +				DESTDIR="$(DESTDIR)" \
    21  				CFLAGS="$(CFLAGS) $${flags}" \
    22  				prefix="$(prefix)" \
    23  				exec_prefix="$(exec_prefix)" \
    24 diff -ruN gcc-20030210.orig/debian/edit-specs.in gcc-20030210/debian/edit-specs.in
    25 --- gcc-20030210.orig/debian/edit-specs.in	Thu Jan  1 09:00:00 1970
    26 +++ gcc-20030210/debian/edit-specs.in	Sat Feb 22 01:40:14 2003
    27 @@ -0,0 +1,45 @@
    28 +/^*asm:$/ {
    29 +n
    30 +c\
    31 +@AS_ENDIAN_FLAG@ %{mrelax:-relax}
    32 +}
    33 +/^*cpp:$/ {
    34 +n
    35 +c\
    36 +%(cpp_default_cpu_spec)    %(subtarget_cpp_spec)    %(subtarget_cpp_ptr_spec)    %(subtarget_cpp_endian_spec)
    37 +}
    38 +/^*cc1:$/ {
    39 +n
    40 +c\
    41 +-musermode @CC1_CPU_ENDIAN_FLAGS@  %{profile:-p}
    42 +}
    43 +/^*link:$/ {
    44 +n
    45 +c\
    46 +%{!static:--eh-frame-hdr} @LINKER_CPU_ENDIAN_FLAGS@  @LINKER_RPATH_LINK_FLAG@ %{mrelax:-relax}  %{shared:-shared}  %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} %{static:-static}
    47 +}
    48 +/^*multilib:$/ {
    49 +n
    50 +c\
    51 +. ;
    52 +}
    53 +/^*multilib_matches:$/ {
    54 +n
    55 +c\
    56 +
    57 +}
    58 +/^*multilib_options:$/ {
    59 +n
    60 +c\
    61 +
    62 +}
    63 +/^*subtarget_cpp_endian_spec:$/ {
    64 +n
    65 +c\
    66 +@CPP_ENDIAN_DEF@
    67 +}
    68 +/^*cpp_default_cpu_spec:$/ {
    69 +n
    70 +c\
    71 +@CPP_CPU_DEFS@
    72 +}
    73 diff -ruN gcc-20030210.orig/debian/install-CPU-linux gcc-20030210/debian/install-CPU-linux
    74 --- gcc-20030210.orig/debian/install-CPU-linux	Thu Jan  1 09:00:00 1970
    75 +++ gcc-20030210/debian/install-CPU-linux	Sat Feb 22 01:40:14 2003
    76 @@ -0,0 +1,111 @@
    77 +#! /bin/sh
    78 +
    79 +VERSION=$1; shift
    80 +CPU=$1
    81 +
    82 +# literally (binary-ly) same
    83 +PROGS_C="cpp gcc"
    84 +PROGS_ADDITIONAL="c++ g++ g77 gcj"
    85 +
    86 +DRIVERS_C="cc1 cpp0 tradcpp0"
    87 +DRIVERS_ADDITIONAL="cc1obj cc1plus collect2 f771 jc1 jvgenmain"
    88 +if [ -z "$STEP1_COMPILER_BUILD" ]; then
    89 +  PROGS="$PROGS_C $PROGS_ADDITIONAL"
    90 +  DRIVERS="$DRIVERS_C $DRIVERSADDITIONAL"
    91 +  INITIAL=""
    92 +else
    93 +  PROGS=$PROGS_C
    94 +  DRIVERS=$DRIVERS_C
    95 +  INITIAL="-initial"
    96 +fi
    97 +
    98 +OBJS="crtbegin.o crtbeginS.o crtend.o crtendS.o"
    99 +LIBS_C="libgcc.a"
   100 +LIBS_1="libgcc_s.so libgcc_s.so.1 libstdc++.so libstdc++.so.3 libstdc++.so.3.0.2"
   101 +LIBS_2="libobjc.a libstdc++.a libsupc++.a"
   102 +INCLUDE="include"
   103 +
   104 +cd debian/gcc-sh-linux-others${INITIAL} || exit 1
   105 +
   106 +# Make directories.
   107 +mkdir -p usr/bin usr/share usr/share/man usr/share/man/man1 usr/lib \
   108 +	 usr/lib/gcc-lib usr/lib/gcc-lib/${CPU}-linux \
   109 +	 usr/lib/gcc-lib/${CPU}-linux/${VERSION} \
   110 +	 usr/${CPU}-linux usr/${CPU}-linux/lib
   111 +
   112 +# Make symbolic links for include dir.
   113 +(cd usr/${CPU}-linux; ln -s ../sh-linux/include .)
   114 +
   115 +# Make symbolic links for executables.
   116 +(cd usr/bin;
   117 +  for p in ${PROGS}; do
   118 +    ln -s shCPU-linux-GCC ${CPU}-linux-$p
   119 +  done)
   120 +
   121 +case "${CPU}" in
   122 +    sh3)
   123 +	MULTILIBDIR=
   124 +	AS_ENDIAN_FLAG="-little"
   125 +	CPP_ENDIAN_DEF="-D__LITTLE_ENDIAN__"
   126 +	CPP_CPU_DEFS="-D__SH3__ -D__sh3__"
   127 +	CC1_CPU_ENDIAN_FLAGS="-ml -m3"
   128 +	LINKER_CPU_ENDIAN_FLAGS="-m shlelf_linux -EL --architecture sh3"
   129 +	LINKER_RPATH_LINK_FLAG="-rpath-link /usr/sh3-linux/lib"
   130 +    ;;
   131 +    sh3eb)
   132 +	MULTILIBDIR=/mb
   133 +	AS_ENDIAN_FLAG="-big"
   134 +	CPP_ENDIAN_DEF="-D__BIG_ENDIAN__"
   135 +	CPP_CPU_DEFS="-D__SH3__ -D__sh3__"
   136 +	CC1_CPU_ENDIAN_FLAGS="-mb -m3"
   137 +	LINKER_CPU_ENDIAN_FLAGS="-m shelf_linux -EB --architecture sh3"
   138 +	LINKER_RPATH_LINK_FLAG="-rpath-link /usr/sh3eb-linux/lib"
   139 +    ;;
   140 +    sh4)
   141 +	MULTILIBDIR=/m4
   142 +	AS_ENDIAN_FLAG="-little"
   143 +	CPP_ENDIAN_DEF="-D__LITTLE_ENDIAN__"
   144 +	CPP_CPU_DEFS="-D__SH4__"
   145 +	CC1_CPU_ENDIAN_FLAGS="-ml -m4"
   146 +	LINKER_CPU_ENDIAN_FLAGS="-m shlelf_linux -EL --architecture sh4"
   147 +	LINKER_RPATH_LINK_FLAG="-rpath-link /usr/sh4-linux/lib"
   148 +    ;;
   149 +    sh4eb)
   150 +	MULTILIBDIR=/mb/m4
   151 +	AS_ENDIAN_FLAG="-big"
   152 +	CPP_ENDIAN_DEF="-D__BIG_ENDIAN__"
   153 +	CPP_CPU_DEFS="-D__SH4__"
   154 +	CC1_CPU_ENDIAN_FLAGS="-mb -m4"
   155 +	LINKER_CPU_ENDIAN_FLAGS="-m shelf_linux -EB --architecture sh4"
   156 +	LINKER_RPATH_LINK_FLAG="-rpath-link /usr/sh4eb-linux/lib"
   157 +    ;;
   158 +esac
   159 +
   160 +# Make symbolic links for GCC drivers, objects, libraries, and include dir.
   161 +(cd usr/lib/gcc-lib/${CPU}-linux/${VERSION};
   162 + for f in ${DRIVERS} ${INCLUDE}; do
   163 +    ln -s ../../sh-linux/${VERSION}/$f $f;
   164 + done
   165 + for f in ${OBJS} ${LIBS_C}; do
   166 +    ln -s ../../sh-linux/${VERSION}${MULTILIBDIR}/$f $f;
   167 + done)
   168 +
   169 +if [ -z "$STEP1_COMPILER_BUILD" ]; then
   170 +  for f in ${LIBS_1} ${LIBS_2}; do
   171 +    mv ../gcc-sh-linux/usr/sh-linux/lib${MULTILIBDIR}/$f usr/${CPU}-linux/lib/;
   172 +  done
   173 +fi
   174 +
   175 +sed -e "s+@AS_ENDIAN_FLAG@+${AS_ENDIAN_FLAG}+" \
   176 +    -e "s+@CPP_ENDIAN_DEF@+${CPP_ENDIAN_DEF}+" \
   177 +    -e "s+@CPP_CPU_DEFS@+${CPP_CPU_DEFS}+" \
   178 +    -e "s+@CC1_CPU_ENDIAN_FLAGS@+${CC1_CPU_ENDIAN_FLAGS}+" \
   179 +    -e "s+@LINKER_CPU_ENDIAN_FLAGS@+${LINKER_CPU_ENDIAN_FLAGS}+" \
   180 +    -e "s+@LINKER_RPATH_LINK_FLAG@+${LINKER_RPATH_LINK_FLAG}+" \
   181 +    ../edit-specs.in >../edit-specs-${CPU}.sed
   182 +
   183 +sed -f ../edit-specs-${CPU}.sed \
   184 +    ../gcc-sh-linux${INITIAL}/usr/lib/gcc-lib/sh-linux/${VERSION}/specs \
   185 +    > usr/lib/gcc-lib/${CPU}-linux/${VERSION}/specs
   186 +
   187 +exit 0
   188 diff -ruN gcc-20030210.orig/debian/multilib-symlink gcc-20030210/debian/multilib-symlink
   189 --- gcc-20030210.orig/debian/multilib-symlink	Thu Jan  1 09:00:00 1970
   190 +++ gcc-20030210/debian/multilib-symlink	Sat Feb 22 01:40:14 2003
   191 @@ -0,0 +1,10 @@
   192 +#! /bin/sh
   193 +
   194 +cd /usr/sh-linux/lib
   195 +ln -s ../../sh3-linux/lib/{*.a,*.so*,*.o} .
   196 +cd m4
   197 +ln -s ../../../sh4-linux/lib/{*.a,*.so*,*.o} .
   198 +cd ../mb
   199 +ln -s ../../../sh3eb-linux/lib/{*.a,*.so*,*.o} .
   200 +cd m4
   201 +ln -s ../../../../sh4eb-linux/lib/{*.a,*.so*,*.o} .
   202 diff -ruN gcc-20030210.orig/debian/shCPU-linux-GCC gcc-20030210/debian/shCPU-linux-GCC
   203 --- gcc-20030210.orig/debian/shCPU-linux-GCC	Thu Jan  1 09:00:00 1970
   204 +++ gcc-20030210/debian/shCPU-linux-GCC	Sat Feb 22 01:40:14 2003
   205 @@ -0,0 +1,59 @@
   206 +#! /bin/bash
   207 +
   208 +BASENAME=${0##*/}
   209 +PROG=${BASENAME##*-}
   210 +CPU=${BASENAME%%-*}
   211 +
   212 +if [ "$PROG" = gcc ]; then
   213 +    if [ "$1" = "-b" -a "$2" = "i386-linux" ]; then
   214 +	shift 2
   215 +	exec /usr/bin/gcc "$@"
   216 +    elif [ "$1" = "-print-multi-lib" -o "$1" = "--print-multi-lib" ]; then
   217 +	echo ".;"
   218 +	exit 0
   219 +    elif [ "$1" = "-print-multi-os-directory" -o "$1" = "--print-multi-os-directory" ]; then
   220 +	echo "."
   221 +	exit 0
   222 +    elif [ "$1" = "-dumpspecs" ]; then
   223 +	cat /usr/lib/gcc-lib/${CPU}-linux/@@VERSION@@/specs
   224 +	exit 0
   225 +    fi
   226 +fi
   227 +
   228 +case "${CPU}" in
   229 +    sh3)
   230 +	ARCH=m3
   231 +	DEFINES="-D__sh3__ -D__SH3__ -D__LITTLE_ENDIAN__"
   232 +	ENDIAN=ml
   233 +    ;;
   234 +    sh3eb)
   235 +	ARCH=m3
   236 +	DEFINES="-D__sh3__ -D__SH3__ -D__BIG_ENDIAN__"
   237 +	ENDIAN=mb
   238 +    ;;
   239 +    sh4)
   240 +	ARCH=m4
   241 +	DEFINES="-D__SH4__ -D__LITTLE_ENDIAN__"
   242 +	ENDIAN=ml
   243 +    ;;
   244 +    sh4eb)
   245 +	ARCH=m4
   246 +	DEFINES="-D__SH4__ -D__BIG_ENDIAN__"
   247 +	ENDIAN=mb
   248 +    ;;
   249 +esac
   250 +
   251 +# Prepend the appropriate options
   252 +# If user specifies some options, it will be overridden
   253 +
   254 +case "${PROG}" in
   255 +    cpp)
   256 +	exec sh-linux-${PROG} $DEFINES "$@"
   257 +    ;;
   258 +    c++|g++|g77|gcc|gcj)
   259 +	exec sh-linux-${PROG} -$ARCH -$ENDIAN "$@"
   260 +    ;;
   261 +esac
   262 +
   263 +echo "Something wrong..."
   264 +exit 1
   265 diff -ruN gcc-20030210.orig/gcc/config/sh/elf.h gcc-20030210/gcc/config/sh/elf.h
   266 --- gcc-20030210.orig/gcc/config/sh/elf.h	Fri Feb 22 01:42:28 2002
   267 +++ gcc-20030210/gcc/config/sh/elf.h	Sat Feb 22 01:40:14 2003
   268 @@ -170,3 +170,7 @@
   269  #undef ENDFILE_SPEC
   270  #define ENDFILE_SPEC \
   271    "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
   272 +
   273 +/* ASM_OUTPUT_CASE_LABEL is defined in elfos.h.  With it, 
   274 +   redundant .align will be generated.  */
   275 +#undef  ASM_OUTPUT_CASE_LABEL
   276 diff -ruN gcc-20030210.orig/gcc/config/sh/lib1funcs.asm gcc-20030210/gcc/config/sh/lib1funcs.asm
   277 --- gcc-20030210.orig/gcc/config/sh/lib1funcs.asm	Fri Feb 22 01:42:28 2002
   278 +++ gcc-20030210/gcc/config/sh/lib1funcs.asm	Sat Feb 22 01:40:14 2003
   279 @@ -39,8 +39,13 @@
   280  
   281  #ifdef __ELF__
   282  #define LOCAL(X) .L_##X
   283 +#define FUNC(X) .type X,@function; .hidden X
   284 +#define _ENDFUNC(X) .Lfe_##X: .size X,.Lfe_##X-X
   285 +#define ENDFUNC(X) _ENDFUNC(X)
   286  #else
   287  #define LOCAL(X) L_##X
   288 +#define FUNC(X)
   289 +#define ENDFUNC(X)
   290  #endif
   291  
   292  #ifdef __linux__
   293 @@ -91,6 +96,40 @@
   294  	.global	GLOBAL(ashiftrt_r4_31)
   295  	.global	GLOBAL(ashiftrt_r4_32)
   296  
   297 +	FUNC(GLOBAL(ashiftrt_r4_0))
   298 +	FUNC(GLOBAL(ashiftrt_r4_1))
   299 +	FUNC(GLOBAL(ashiftrt_r4_2))
   300 +	FUNC(GLOBAL(ashiftrt_r4_3))
   301 +	FUNC(GLOBAL(ashiftrt_r4_4))
   302 +	FUNC(GLOBAL(ashiftrt_r4_5))
   303 +	FUNC(GLOBAL(ashiftrt_r4_6))
   304 +	FUNC(GLOBAL(ashiftrt_r4_7))
   305 +	FUNC(GLOBAL(ashiftrt_r4_8))
   306 +	FUNC(GLOBAL(ashiftrt_r4_9))
   307 +	FUNC(GLOBAL(ashiftrt_r4_10))
   308 +	FUNC(GLOBAL(ashiftrt_r4_11))
   309 +	FUNC(GLOBAL(ashiftrt_r4_12))
   310 +	FUNC(GLOBAL(ashiftrt_r4_13))
   311 +	FUNC(GLOBAL(ashiftrt_r4_14))
   312 +	FUNC(GLOBAL(ashiftrt_r4_15))
   313 +	FUNC(GLOBAL(ashiftrt_r4_16))
   314 +	FUNC(GLOBAL(ashiftrt_r4_17))
   315 +	FUNC(GLOBAL(ashiftrt_r4_18))
   316 +	FUNC(GLOBAL(ashiftrt_r4_19))
   317 +	FUNC(GLOBAL(ashiftrt_r4_20))
   318 +	FUNC(GLOBAL(ashiftrt_r4_21))
   319 +	FUNC(GLOBAL(ashiftrt_r4_22))
   320 +	FUNC(GLOBAL(ashiftrt_r4_23))
   321 +	FUNC(GLOBAL(ashiftrt_r4_24))
   322 +	FUNC(GLOBAL(ashiftrt_r4_25))
   323 +	FUNC(GLOBAL(ashiftrt_r4_26))
   324 +	FUNC(GLOBAL(ashiftrt_r4_27))
   325 +	FUNC(GLOBAL(ashiftrt_r4_28))
   326 +	FUNC(GLOBAL(ashiftrt_r4_29))
   327 +	FUNC(GLOBAL(ashiftrt_r4_30))
   328 +	FUNC(GLOBAL(ashiftrt_r4_31))
   329 +	FUNC(GLOBAL(ashiftrt_r4_32))
   330 +
   331  	.align	1
   332  GLOBAL(ashiftrt_r4_32):
   333  GLOBAL(ashiftrt_r4_31):
   334 @@ -170,6 +209,41 @@
   335  GLOBAL(ashiftrt_r4_0):
   336  	rts
   337  	nop
   338 +
   339 +	ENDFUNC(GLOBAL(ashiftrt_r4_0))
   340 +	ENDFUNC(GLOBAL(ashiftrt_r4_1))
   341 +	ENDFUNC(GLOBAL(ashiftrt_r4_2))
   342 +	ENDFUNC(GLOBAL(ashiftrt_r4_3))
   343 +	ENDFUNC(GLOBAL(ashiftrt_r4_4))
   344 +	ENDFUNC(GLOBAL(ashiftrt_r4_5))
   345 +	ENDFUNC(GLOBAL(ashiftrt_r4_6))
   346 +	ENDFUNC(GLOBAL(ashiftrt_r4_7))
   347 +	ENDFUNC(GLOBAL(ashiftrt_r4_8))
   348 +	ENDFUNC(GLOBAL(ashiftrt_r4_9))
   349 +	ENDFUNC(GLOBAL(ashiftrt_r4_10))
   350 +	ENDFUNC(GLOBAL(ashiftrt_r4_11))
   351 +	ENDFUNC(GLOBAL(ashiftrt_r4_12))
   352 +	ENDFUNC(GLOBAL(ashiftrt_r4_13))
   353 +	ENDFUNC(GLOBAL(ashiftrt_r4_14))
   354 +	ENDFUNC(GLOBAL(ashiftrt_r4_15))
   355 +	ENDFUNC(GLOBAL(ashiftrt_r4_16))
   356 +	ENDFUNC(GLOBAL(ashiftrt_r4_17))
   357 +	ENDFUNC(GLOBAL(ashiftrt_r4_18))
   358 +	ENDFUNC(GLOBAL(ashiftrt_r4_19))
   359 +	ENDFUNC(GLOBAL(ashiftrt_r4_20))
   360 +	ENDFUNC(GLOBAL(ashiftrt_r4_21))
   361 +	ENDFUNC(GLOBAL(ashiftrt_r4_22))
   362 +	ENDFUNC(GLOBAL(ashiftrt_r4_23))
   363 +	ENDFUNC(GLOBAL(ashiftrt_r4_24))
   364 +	ENDFUNC(GLOBAL(ashiftrt_r4_25))
   365 +	ENDFUNC(GLOBAL(ashiftrt_r4_26))
   366 +	ENDFUNC(GLOBAL(ashiftrt_r4_27))
   367 +	ENDFUNC(GLOBAL(ashiftrt_r4_28))
   368 +	ENDFUNC(GLOBAL(ashiftrt_r4_29))
   369 +	ENDFUNC(GLOBAL(ashiftrt_r4_30))
   370 +	ENDFUNC(GLOBAL(ashiftrt_r4_31))
   371 +	ENDFUNC(GLOBAL(ashiftrt_r4_32))
   372 +
   373  #endif
   374  
   375  #ifdef L_ashiftrt_n
   376 @@ -192,6 +266,7 @@
   377  !
   378  
   379  	.global	GLOBAL(ashrsi3)
   380 +	FUNC(GLOBAL(ashrsi3))
   381  	.align	2
   382  GLOBAL(ashrsi3):
   383  	mov	#31,r0
   384 @@ -319,6 +394,8 @@
   385  	rts
   386  	nop
   387  
   388 +	ENDFUNC(GLOBAL(ashrsi3))
   389 +
   390  #endif
   391  
   392  #ifdef L_ashiftlt
   393 @@ -340,6 +417,7 @@
   394  ! (none)
   395  !
   396  	.global	GLOBAL(ashlsi3)
   397 +	FUNC(GLOBAL(ashlsi3))
   398  	.align	2
   399  GLOBAL(ashlsi3):
   400  	mov	#31,r0
   401 @@ -476,6 +554,8 @@
   402  	rts
   403  	nop
   404  
   405 +	ENDFUNC(GLOBAL(ashlsi3))
   406 +
   407  #endif
   408  
   409  #ifdef L_lshiftrt
   410 @@ -497,6 +577,7 @@
   411  ! (none)
   412  !
   413  	.global	GLOBAL(lshrsi3)
   414 +	FUNC(GLOBAL(lshrsi3))
   415  	.align	2
   416  GLOBAL(lshrsi3):
   417  	mov	#31,r0
   418 @@ -633,6 +714,8 @@
   419  	rts
   420  	nop
   421  
   422 +	ENDFUNC(GLOBAL(lshrsi3))
   423 +
   424  #endif
   425  
   426  #ifdef L_movstr
   427 @@ -649,76 +732,113 @@
   428  	add	#64,r4
   429  	.align	4
   430  	.global	GLOBAL(movstrSI64)
   431 +	FUNC(GLOBAL(movstrSI64))
   432  GLOBAL(movstrSI64):
   433  	mov.l	@(60,r5),r0
   434  	mov.l	r0,@(60,r4)
   435  	.global	GLOBAL(movstrSI60)
   436 +	FUNC(GLOBAL(movstrSI60))
   437  GLOBAL(movstrSI60):
   438  	mov.l	@(56,r5),r0
   439  	mov.l	r0,@(56,r4)
   440  	.global	GLOBAL(movstrSI56)
   441 +	FUNC(GLOBAL(movstrSI56))
   442  GLOBAL(movstrSI56):
   443  	mov.l	@(52,r5),r0
   444  	mov.l	r0,@(52,r4)
   445  	.global	GLOBAL(movstrSI52)
   446 +	FUNC(GLOBAL(movstrSI52))
   447  GLOBAL(movstrSI52):
   448  	mov.l	@(48,r5),r0
   449  	mov.l	r0,@(48,r4)
   450  	.global	GLOBAL(movstrSI48)
   451 +	FUNC(GLOBAL(movstrSI48))
   452  GLOBAL(movstrSI48):
   453  	mov.l	@(44,r5),r0
   454  	mov.l	r0,@(44,r4)
   455  	.global	GLOBAL(movstrSI44)
   456 +	FUNC(GLOBAL(movstrSI44))
   457  GLOBAL(movstrSI44):
   458  	mov.l	@(40,r5),r0
   459  	mov.l	r0,@(40,r4)
   460  	.global	GLOBAL(movstrSI40)
   461 +	FUNC(GLOBAL(movstrSI40))
   462  GLOBAL(movstrSI40):
   463  	mov.l	@(36,r5),r0
   464  	mov.l	r0,@(36,r4)
   465  	.global	GLOBAL(movstrSI36)
   466 +	FUNC(GLOBAL(movstrSI36))
   467  GLOBAL(movstrSI36):
   468  	mov.l	@(32,r5),r0
   469  	mov.l	r0,@(32,r4)
   470  	.global	GLOBAL(movstrSI32)
   471 +	FUNC(GLOBAL(movstrSI32))
   472  GLOBAL(movstrSI32):
   473  	mov.l	@(28,r5),r0
   474  	mov.l	r0,@(28,r4)
   475  	.global	GLOBAL(movstrSI28)
   476 +	FUNC(GLOBAL(movstrSI28))
   477  GLOBAL(movstrSI28):
   478  	mov.l	@(24,r5),r0
   479  	mov.l	r0,@(24,r4)
   480  	.global	GLOBAL(movstrSI24)
   481 +	FUNC(GLOBAL(movstrSI24))
   482  GLOBAL(movstrSI24):
   483  	mov.l	@(20,r5),r0
   484  	mov.l	r0,@(20,r4)
   485  	.global	GLOBAL(movstrSI20)
   486 +	FUNC(GLOBAL(movstrSI20))
   487  GLOBAL(movstrSI20):
   488  	mov.l	@(16,r5),r0
   489  	mov.l	r0,@(16,r4)
   490  	.global	GLOBAL(movstrSI16)
   491 +	FUNC(GLOBAL(movstrSI16))
   492  GLOBAL(movstrSI16):
   493  	mov.l	@(12,r5),r0
   494  	mov.l	r0,@(12,r4)
   495  	.global	GLOBAL(movstrSI12)
   496 +	FUNC(GLOBAL(movstrSI12))
   497  GLOBAL(movstrSI12):
   498  	mov.l	@(8,r5),r0
   499  	mov.l	r0,@(8,r4)
   500  	.global	GLOBAL(movstrSI8)
   501 +	FUNC(GLOBAL(movstrSI8))
   502  GLOBAL(movstrSI8):
   503  	mov.l	@(4,r5),r0
   504  	mov.l	r0,@(4,r4)
   505  	.global	GLOBAL(movstrSI4)
   506 +	FUNC(GLOBAL(movstrSI4))
   507  GLOBAL(movstrSI4):
   508  	mov.l	@(0,r5),r0
   509  	mov.l	r0,@(0,r4)
   510 +	.global	GLOBAL(movstrSI0)
   511 +	FUNC(GLOBAL(movstrSI0))
   512  GLOBAL(movstrSI0):
   513  	rts
   514  	nop
   515  
   516 +	ENDFUNC(GLOBAL(movstrSI64))
   517 +	ENDFUNC(GLOBAL(movstrSI60))
   518 +	ENDFUNC(GLOBAL(movstrSI56))
   519 +	ENDFUNC(GLOBAL(movstrSI52))
   520 +	ENDFUNC(GLOBAL(movstrSI48))
   521 +	ENDFUNC(GLOBAL(movstrSI44))
   522 +	ENDFUNC(GLOBAL(movstrSI40))
   523 +	ENDFUNC(GLOBAL(movstrSI36))
   524 +	ENDFUNC(GLOBAL(movstrSI32))
   525 +	ENDFUNC(GLOBAL(movstrSI28))
   526 +	ENDFUNC(GLOBAL(movstrSI24))
   527 +	ENDFUNC(GLOBAL(movstrSI20))
   528 +	ENDFUNC(GLOBAL(movstrSI16))
   529 +	ENDFUNC(GLOBAL(movstrSI12))
   530 +	ENDFUNC(GLOBAL(movstrSI8))
   531 +	ENDFUNC(GLOBAL(movstrSI4))
   532 +	ENDFUNC(GLOBAL(movstrSI0))
   533 +
   534  	.align	4
   535  
   536  	.global	GLOBAL(movstr)
   537 +	FUNC(GLOBAL(movstr))
   538  GLOBAL(movstr):
   539  	mov.l	@(60,r5),r0
   540  	mov.l	r0,@(60,r4)
   541 @@ -775,6 +895,8 @@
   542  	add	#64,r5
   543  	bra	GLOBAL(movstr)
   544  	add	#64,r4
   545 +
   546 +	FUNC(GLOBAL(movstr))
   547  #endif
   548  
   549  #ifdef L_movstr_i4
   550 @@ -783,6 +905,10 @@
   551  	.global	GLOBAL(movstr_i4_odd)
   552  	.global	GLOBAL(movstrSI12_i4)
   553  
   554 +	FUNC(GLOBAL(movstr_i4_even))
   555 +	FUNC(GLOBAL(movstr_i4_odd))
   556 +	FUNC(GLOBAL(movstrSI12_i4))
   557 +
   558  	.p2align	5
   559  L_movstr_2mod4_end:
   560  	mov.l	r0,@(16,r4)
   561 @@ -791,6 +917,11 @@
   562  
   563  	.p2align	2
   564  
   565 +GLOBAL(movstr_i4_even):
   566 +	mov.l	@r5+,r0
   567 +	bra	L_movstr_start_even
   568 +	mov.l	@r5+,r1
   569 +
   570  GLOBAL(movstr_i4_odd):
   571  	mov.l	@r5+,r1
   572  	add	#-4,r4
   573 @@ -817,10 +948,8 @@
   574  	rts
   575  	mov.l	r3,@(12,r4)
   576  
   577 -GLOBAL(movstr_i4_even):
   578 -	mov.l	@r5+,r0
   579 -	bra	L_movstr_start_even
   580 -	mov.l	@r5+,r1
   581 +	ENDFUNC(GLOBAL(movstr_i4_even))
   582 +	ENDFUNC(GLOBAL(movstr_i4_odd))
   583  
   584  	.p2align	4
   585  GLOBAL(movstrSI12_i4):
   586 @@ -831,12 +960,16 @@
   587  	mov.l	r1,@(4,r4)
   588  	rts
   589  	mov.l	r2,@(8,r4)
   590 +
   591 +	ENDFUNC(GLOBAL(movstrSI12_i4))
   592 +
   593  #endif
   594  
   595  #ifdef L_mulsi3
   596  
   597  
   598  	.global	GLOBAL(mulsi3)
   599 +	FUNC(GLOBAL(mulsi3))
   600  
   601  ! r4 =       aabb
   602  ! r5 =       ccdd
   603 @@ -869,7 +1002,7 @@
   604  	rts
   605  	add	r2,r0
   606  
   607 -
   608 +	FUNC(GLOBAL(mulsi3))
   609  #endif
   610  #endif /* ! __SH5__ */
   611  #ifdef L_sdivsi3_i4
   612 @@ -879,6 +1012,7 @@
   613  !! args in r4 and r5, result in fpul, clobber dr0, dr2
   614  
   615  	.global	GLOBAL(sdivsi3_i4)
   616 +	FUNC(GLOBAL(sdivsi3_i4))
   617  GLOBAL(sdivsi3_i4):
   618  	lds r4,fpul
   619  	float fpul,dr0
   620 @@ -888,6 +1022,8 @@
   621  	rts
   622  	ftrc dr0,fpul
   623  
   624 +	ENDFUNC(GLOBAL(sdivsi3_i4))
   625 +
   626  #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__)
   627  !! args in r4 and r5, result in fpul, clobber r2, dr0, dr2
   628  
   629 @@ -896,6 +1032,7 @@
   630  	.mode	SHcompact
   631  #endif
   632  	.global	GLOBAL(sdivsi3_i4)
   633 +	FUNC(GLOBAL(sdivsi3_i4))
   634  GLOBAL(sdivsi3_i4):
   635  	sts.l fpscr,@-r15
   636  	mov #8,r2
   637 @@ -910,6 +1047,8 @@
   638  	rts
   639  	lds.l @r15+,fpscr
   640  
   641 +	ENDFUNC(GLOBAL(sdivsi3_i4))
   642 +
   643  #endif /* ! __SH5__ || __SH5__ == 32 */
   644  #endif /* ! __SH4__ */
   645  #endif
   646 @@ -924,9 +1063,10 @@
   647  !!
   648  !!
   649  
   650 -!! args in r4 and r5, result in r0 clobber r1,r2,r3
   651 +!! args in r4 and r5, result in r0 clobber r1, r2, r3, and t bit
   652  
   653  	.global	GLOBAL(sdivsi3)
   654 +	FUNC(GLOBAL(sdivsi3))
   655  #if __SHMEDIA__
   656  #if __SH5__ == 32
   657  	.section	.text..SHmedia32,"ax"
   658 @@ -1076,6 +1216,7 @@
   659  div0:	rts
   660  	mov	#0,r0
   661  
   662 +	ENDFUNC(GLOBAL(sdivsi3))
   663  #endif /* ! __SHMEDIA__ */
   664  #endif /* ! __SH4__ */
   665  #endif
   666 @@ -1084,9 +1225,11 @@
   667  	.title "SH DIVIDE"
   668  !! 4 byte integer Divide code for the Hitachi SH
   669  #ifdef __SH4__
   670 -!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
   671 +!! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4,
   672 +!! and t bit
   673  
   674  	.global	GLOBAL(udivsi3_i4)
   675 +	FUNC(GLOBAL(udivsi3_i4))
   676  GLOBAL(udivsi3_i4):
   677  	mov #1,r1
   678  	cmp/hi r1,r5
   679 @@ -1127,6 +1270,8 @@
   680  L1:
   681  	.double 2147483648
   682  
   683 +	ENDFUNC(GLOBAL(udivsi3_i4))
   684 +
   685  #elif defined(__SH4_SINGLE__) || defined(__SH4_SINGLE_ONLY__) || (defined (__SH5__) && ! defined __SH4_NOFPU__)
   686  !! args in r4 and r5, result in fpul, clobber r0, r1, r4, r5, dr0, dr2, dr4
   687  
   688 @@ -1135,6 +1280,7 @@
   689  	.mode	SHcompact
   690  #endif
   691  	.global	GLOBAL(udivsi3_i4)
   692 +	FUNC(GLOBAL(udivsi3_i4))
   693  GLOBAL(udivsi3_i4):
   694  	mov #1,r1
   695  	cmp/hi r1,r5
   696 @@ -1183,6 +1329,8 @@
   697  #endif
   698  	.double 2147483648
   699  
   700 +	ENDFUNC(GLOBAL(udivsi3_i4))
   701 +
   702  #endif /* ! __SH5__ || __SH5__ == 32 */
   703  #endif /* ! __SH4__ */
   704  #endif
   705 @@ -1199,6 +1347,7 @@
   706  
   707  !! args in r4 and r5, result in r0, clobbers r4, pr, and t bit
   708  	.global	GLOBAL(udivsi3)
   709 +	FUNC(GLOBAL(udivsi3))
   710  
   711  #if __SHMEDIA__
   712  #if __SH5__ == 32
   713 @@ -1299,6 +1448,8 @@
   714  ret:	rts
   715  	mov	r4,r0
   716  
   717 +	ENDFUNC(GLOBAL(udivsi3))
   718 +
   719  #endif /* ! __SHMEDIA__ */
   720  #endif /* __SH4__ */
   721  #endif
   722 @@ -1308,6 +1459,7 @@
   723  	.mode	SHcompact
   724  #endif
   725  	.global GLOBAL(set_fpscr)
   726 +	FUNC(GLOBAL(set_fpscr))
   727  GLOBAL(set_fpscr):
   728  	lds r4,fpscr
   729  	mov.l LOCAL(set_fpscr_L1),r1
   730 @@ -1340,11 +1492,16 @@
   731  	.align 2
   732  LOCAL(set_fpscr_L1):
   733  	.long GLOBAL(fpscr_values)
   734 +
   735 +	ENDFUNC(GLOBAL(set_fpscr))
   736 +
   737 +#ifndef NO_FPSCR_VALUES
   738  #ifdef __ELF__
   739          .comm   GLOBAL(fpscr_values),8,4
   740  #else
   741          .comm   GLOBAL(fpscr_values),8
   742  #endif /* ELF */
   743 +#endif /* NO_FPSCR_VALUES */
   744  #endif /* SH3E / SH4 */
   745  #endif /* L_set_fpscr */
   746  #ifdef L_ic_invalidate
   747 @@ -1360,6 +1517,7 @@
   748  	blink	tr0, r63
   749  #elif defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
   750  	.global GLOBAL(ic_invalidate)
   751 +	FUNC(GLOBAL(ic_invalidate))
   752  GLOBAL(ic_invalidate):
   753  	ocbwb	@r4
   754  	mova	0f,r0
   755 @@ -1382,6 +1540,9 @@
   756  	nop
   757  	.endr
   758  	.endr
   759 +
   760 +	ENDFUNC(GLOBAL(ic_invalidate))
   761 +
   762  #endif /* SH4 */
   763  #endif /* L_ic_invalidate */
   764  
   765 diff -ruN gcc-20030210.orig/gcc/config/sh/libgcc-glibc.ver gcc-20030210/gcc/config/sh/libgcc-glibc.ver
   766 --- gcc-20030210.orig/gcc/config/sh/libgcc-glibc.ver	Thu Jan  1 09:00:00 1970
   767 +++ gcc-20030210/gcc/config/sh/libgcc-glibc.ver	Sat Feb 22 01:40:14 2003
   768 @@ -0,0 +1,21 @@
   769 +# In order to work around the very problems that force us to now generally
   770 +# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
   771 +# By now choosing the same version tags for these specific routines, we
   772 +# maintain enough binary compatibility to allow future versions of glibc
   773 +# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
   774 +
   775 +# Note that we cannot use the default libgcc-glibc.ver file on sh,
   776 +# because GLIBC_2.0 does not exist on this architecture, as the first 
   777 +# ever glibc release on the platform was GLIBC_2.2.
   778 +
   779 +%inherit GCC_3.0 GLIBC_2.2
   780 +GLIBC_2.2 {
   781 +  __register_frame
   782 +  __register_frame_table
   783 +  __deregister_frame
   784 +  __register_frame_info
   785 +  __deregister_frame_info
   786 +  __frame_state_for
   787 +  __register_frame_info_table
   788 +}
   789 +
   790 diff -ruN gcc-20030210.orig/gcc/config/sh/linux.h gcc-20030210/gcc/config/sh/linux.h
   791 --- gcc-20030210.orig/gcc/config/sh/linux.h	Tue Apr 16 05:27:42 2002
   792 +++ gcc-20030210/gcc/config/sh/linux.h	Sat Feb 22 01:40:14 2003
   793 @@ -19,6 +19,10 @@
   794  the Free Software Foundation, 59 Temple Place - Suite 330,
   795  Boston, MA 02111-1307, USA.  */
   796  
   797 +/* We're not SYSVR4, not having /usr/ccs */
   798 +#undef MD_EXEC_PREFIX
   799 +#undef MD_STARTFILE_PREFIX
   800 +
   801  /* Run-time Target Specification.  */
   802  #undef TARGET_VERSION
   803  #define TARGET_VERSION  fputs (" (SH GNU/Linux with ELF)", stderr);
   804 @@ -39,6 +43,28 @@
   805  #undef WCHAR_TYPE_SIZE
   806  #define WCHAR_TYPE_SIZE BITS_PER_WORD
   807  
   808 +/* This was defined in linux.h.  Define it here also. */
   809 +#undef  DEFAULT_VTABLE_THUNKS
   810 +#define DEFAULT_VTABLE_THUNKS   1
   811 +
   812 +/* Likewise.  */
   813 +#define HANDLE_PRAGMA_PACK_PUSH_POP
   814 +
   815 +/* Pick up the return address upon entry to a procedure. Used for
   816 +   dwarf2 unwind information.  This also enables the table driven
   817 +   mechanism.  */
   818 +
   819 +#define INCOMING_RETURN_ADDR_RTX	gen_rtx_REG (Pmode, PR_REG)
   820 +#define DWARF_FRAME_RETURN_COLUMN	DWARF_FRAME_REGNUM (PR_REG)
   821 +
   822 +#undef CPP_SPEC
   823 +#define CPP_SPEC "\
   824 +   %{m4:-D__SH4__} \
   825 +   %{!m4:%(cpp_default_cpu_spec)} \
   826 +   %(subtarget_cpp_spec) \
   827 +   %(subtarget_cpp_ptr_spec) \
   828 +   %(subtarget_cpp_endian_spec) "
   829 +
   830  #undef SUBTARGET_CPP_SPEC
   831  #define SUBTARGET_CPP_SPEC "\
   832     %{fPIC:-D__PIC__ -D__pic__} \
   833 @@ -55,36 +81,45 @@
   834  #undef CPP_DEFAULT_CPU_SPEC
   835  #define CPP_DEFAULT_CPU_SPEC "-D__SH3__ -D__sh3__"
   836  
   837 -
   838  #undef CPP_PREDEFINES
   839  #define CPP_PREDEFINES "-D__ELF__ -Dunix -D__sh__ -D__gnu_linux__ -Dlinux -Asystem=posix"
   840  
   841 +/* The GNU C++ standard library requires that these macros be defined.  */
   842 +#undef CPLUSPLUS_CPP_SPEC
   843 +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
   844 +
   845  #undef ASM_SPEC
   846 -#define ASM_SPEC  "%{!mb:-little} %{mrelax:-relax}"
   847 +#define ASM_SPEC  "%{mb:-big} %{!mb:-little} %{mrelax:-relax}"
   848  
   849  #undef CC1_SPEC
   850  #define CC1_SPEC \
   851 -  "-musermode %{!mb:-ml} %{!m3e:%{!m4:-m3}}"
   852 -
   853 -#undef CC1PLUS_SPEC
   854 -#define CC1PLUS_SPEC \
   855 -  "-musermode %{!mb:-ml} %{!m3e:%{!m4:-m3}}"
   856 +  "-musermode %{!mb:-ml} %{!m4:-m3} %{profile:-p}"
   857  
   858 +/* XXX: It's wrong if prefix != /usr */
   859  #undef LINK_SPEC
   860  #define LINK_SPEC \
   861 -  "%{!mb:-m shlelf_linux} %{mrelax:-relax} \
   862 +  "%{!mb:-m shlelf_linux -EL} %{mb:-m shelf_linux -EB} %{mrelax:-relax} \
   863     %{shared:-shared} \
   864     %{!static: \
   865       %{rdynamic:-export-dynamic} \
   866       %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
   867 -     %{!rpath:-rpath /lib}} \
   868 +     %{!mb:%{!m4:-rpath-link /usr/sh-linux/lib }} \
   869 +     %{!mb:%{m4:-rpath-link /usr/sh-linux/lib/m4 }} \
   870 +     %{mb:%{!m4:-rpath-link /usr/sh-linux/lib/mb }} \
   871 +     %{mb:%{m4:-rpath-link /usr/sh-linux/lib/mb/m4 }}} \
   872     %{static:-static}"
   873  
   874  #undef LIB_SPEC
   875 +#undef LIB_SPEC
   876  #define LIB_SPEC \
   877    "%{shared: -lc} \
   878 -   %{!shared: %{pthread:-lthread} \
   879 -     %{profile:-lc_p} %{!profile: -lc}}"
   880 +   %{!shared: %{mieee:-lieee} %{pthread:-lpthread} \
   881 +	%{profile:-lc_p} %{!profile: -lc}}"
   882 +
   883 +#if defined(HAVE_LD_EH_FRAME_HDR)
   884 +#undef LINK_EH_SPEC
   885 +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
   886 +#endif
   887  
   888  #undef STARTFILE_SPEC
   889  #define STARTFILE_SPEC \
   890 @@ -92,4 +127,40 @@
   891       %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
   892  		       %{!p:%{profile:gcrt1.o%s} \
   893  			 %{!profile:crt1.o%s}}}} \
   894 -   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
   895 +   crti.o%s %{static:crtbeginT.o%s}\
   896 +   %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}"
   897 +
   898 +#undef FUNCTION_PROFILER
   899 +#define FUNCTION_PROFILER(STREAM,LABELNO)				\
   900 +do									\
   901 +{									\
   902 +  if (flag_pic)								\
   903 +    {									\
   904 +      fprintf (STREAM, "	mov.l	3f,r1\n");			\
   905 +      fprintf (STREAM, "	mova	3f,r0\n");			\
   906 +      fprintf (STREAM, "	add	r1,r0\n");			\
   907 +      fprintf (STREAM, "	mov.l	1f,r1\n");			\
   908 +      fprintf (STREAM, "	mov.l	@(r0,r1),r1\n");		\
   909 +    }									\
   910 +  else									\
   911 +    {									\
   912 +      fprintf (STREAM, "	mov.l	1f,r1\n");			\
   913 +    }									\
   914 +  fprintf (STREAM, "	sts.l	pr,@-r15\n");				\
   915 +  fprintf (STREAM, "	mova	2f,r0\n");				\
   916 +  fprintf (STREAM, "	jmp	@r1\n");				\
   917 +  fprintf (STREAM, "	lds	r0,pr\n");				\
   918 +  fprintf (STREAM, "	.align	2\n");					\
   919 +  if (flag_pic)								\
   920 +    {									\
   921 +      fprintf (STREAM, "1:	.long	mcount@GOT\n");			\
   922 +      fprintf (STREAM, "3:	.long	_GLOBAL_OFFSET_TABLE_\n");	\
   923 +    }									\
   924 +  else									\
   925 +    {									\
   926 +      fprintf (STREAM, "1:	.long	mcount\n");			\
   927 +    }									\
   928 +  fprintf (STREAM, "2:	lds.l	@r15+,pr\n");				\
   929 +} while (0)
   930 +
   931 +#define NO_SHARED_LIBGCC_MULTILIB
   932 diff -ruN gcc-20030210.orig/gcc/config/sh/sh-protos.h gcc-20030210/gcc/config/sh/sh-protos.h
   933 --- gcc-20030210.orig/gcc/config/sh/sh-protos.h	Fri Feb 22 01:42:28 2002
   934 +++ gcc-20030210/gcc/config/sh/sh-protos.h	Sat Feb 22 01:40:14 2003
   935 @@ -74,6 +74,7 @@
   936  extern int shl_sext_length PARAMS ((rtx));
   937  extern int gen_shl_sext PARAMS ((rtx, rtx, rtx, rtx));
   938  extern rtx gen_datalabel_ref PARAMS ((rtx));
   939 +extern int shl_casesi_worker_length PARAMS ((rtx));
   940  extern int regs_used PARAMS ((rtx, int));
   941  extern void fixup_addr_diff_vecs PARAMS ((rtx));
   942  extern int get_dest_uid PARAMS ((rtx, int));
   943 diff -ruN gcc-20030210.orig/gcc/config/sh/sh.c gcc-20030210/gcc/config/sh/sh.c
   944 --- gcc-20030210.orig/gcc/config/sh/sh.c	Fri Feb 22 01:42:28 2002
   945 +++ gcc-20030210/gcc/config/sh/sh.c	Sat Feb 22 01:40:14 2003
   946 @@ -2143,6 +2143,48 @@
   947    return sym;
   948  }
   949  
   950 +
   951 +/* Function to be used in the length attribute of the casesi_worker
   952 +   instruction.  Returns number of instructions, which is half of the
   953 +   length of bytes. */
   954 +
   955 +int
   956 +shl_casesi_worker_length (insn)
   957 +     rtx insn;
   958 +{
   959 +  rtx set_src, label;
   960 +  rtx diff_vec;
   961 +
   962 +  set_src = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
   963 +  if (!(GET_CODE (set_src) == UNSPEC
   964 +	&& XINT (set_src, 1) == UNSPEC_CASESI))
   965 +    abort ();
   966 +
   967 +  label = XVECEXP (set_src, 0, 2);
   968 +  if (GET_CODE (label) != LABEL_REF)
   969 +    abort ();
   970 +
   971 +  diff_vec = PATTERN (next_real_insn (XEXP (label, 0)));
   972 +
   973 +  if (GET_CODE (diff_vec) != ADDR_DIFF_VEC)
   974 +    abort ();
   975 +
   976 +  switch (GET_MODE (diff_vec))
   977 +    {
   978 +    case SImode:
   979 +      return 2;
   980 +    case HImode:
   981 +      if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
   982 +	return 3;
   983 +      return 2;
   984 +    case QImode:
   985 +      if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
   986 +	return 2;
   987 +      return 1;
   988 +    default:
   989 +      abort ();
   990 +    }
   991 +}
   992  
   993  /* The SH cannot load a large constant into a register, constants have to
   994     come from a pc relative load.  The reference of a pc relative load
   995 @@ -3190,7 +3232,7 @@
   996        vec_lab = XEXP (XEXP (pat, 0), 0);
   997  
   998        /* Search the matching casesi_jump_2.  */
   999 -      for (prev = vec_lab; ; prev = PREV_INSN (prev))
  1000 +      for (prev = vec_lab; prev; prev = PREV_INSN (prev))
  1001  	{
  1002  	  if (GET_CODE (prev) != JUMP_INSN)
  1003  	    continue;
  1004 @@ -3205,6 +3247,13 @@
  1005  	    break;
  1006  	}
  1007  
  1008 +      if (prev == NULL)
  1009 +	{			/* Switch statement has been optimized out.  */
  1010 +	  delete_insn (PREV_INSN (insn));
  1011 +	  delete_insn (insn);
  1012 +	  continue;
  1013 +	}
  1014 +
  1015        /* Emit the reference label of the braf where it belongs, right after
  1016  	 the casesi_jump_2 (i.e. braf).  */
  1017        braf_label = XEXP (XEXP (SET_SRC (XVECEXP (prevpat, 0, 0)), 1), 0);
  1018 @@ -3223,7 +3272,7 @@
  1019       rtx barrier_or_label;
  1020  {
  1021    rtx next = next_real_insn (barrier_or_label), pat, prev;
  1022 -  int slot, credit, jump_to_next;
  1023 +  int slot, credit, jump_to_next = 0;
  1024   
  1025    if (! next)
  1026      return 0;
  1027 @@ -4507,7 +4556,8 @@
  1028    if (current_function_varargs || current_function_stdarg)
  1029      {
  1030        /* This is not used by the SH3E calling convention  */
  1031 -      if (TARGET_SH1 && ! TARGET_SH3E && ! TARGET_SH5 && ! TARGET_HITACHI)
  1032 +      if (TARGET_SH1 && ! TARGET_SH3E && ! TARGET_SH5 && ! TARGET_HITACHI
  1033 +	  || TARGET_NO_IMPLICIT_FP)
  1034  	{
  1035  	  /* Push arg regs as if they'd been provided by caller in stack.  */
  1036  	  for (i = 0; i < NPARM_REGS(SImode); i++)
  1037 @@ -5149,7 +5199,8 @@
  1038    tree f_next_o, f_next_o_limit, f_next_fp, f_next_fp_limit, f_next_stack;
  1039    tree record;
  1040  
  1041 -  if (TARGET_SH5 || (! TARGET_SH3E && ! TARGET_SH4) || TARGET_HITACHI)
  1042 +  if (TARGET_SH5 || (! TARGET_SH3E && ! TARGET_SH4) || TARGET_HITACHI
  1043 +      || TARGET_NO_IMPLICIT_FP)
  1044      return ptr_type_node;
  1045  
  1046    record = make_node (RECORD_TYPE);
  1047 @@ -5211,7 +5262,8 @@
  1048        return;
  1049      }
  1050  
  1051 -  if ((! TARGET_SH3E && ! TARGET_SH4) || TARGET_HITACHI)
  1052 +  if ((! TARGET_SH3E && ! TARGET_SH4)
  1053 +      || TARGET_HITACHI || TARGET_NO_IMPLICIT_FP)
  1054      {
  1055        std_expand_builtin_va_start (stdarg_p, valist, nextarg);
  1056        return;
  1057 @@ -5289,7 +5341,8 @@
  1058    rsize = (size + UNITS_PER_WORD - 1) & -UNITS_PER_WORD;
  1059    pptr_type_node = build_pointer_type (ptr_type_node);
  1060  
  1061 -  if (! TARGET_SH5 && (TARGET_SH3E || TARGET_SH4) && ! TARGET_HITACHI)
  1062 +  if (! TARGET_SH5 && (TARGET_SH3E || TARGET_SH4)
  1063 +      && ! TARGET_HITACHI && ! TARGET_NO_IMPLICIT_FP)
  1064      {
  1065        tree f_next_o, f_next_o_limit, f_next_fp, f_next_fp_limit, f_next_stack;
  1066        tree next_o, next_o_limit, next_fp, next_fp_limit, next_stack;
  1067 diff -ruN gcc-20030210.orig/gcc/config/sh/sh.h gcc-20030210/gcc/config/sh/sh.h
  1068 --- gcc-20030210.orig/gcc/config/sh/sh.h	Fri Feb 22 01:42:28 2002
  1069 +++ gcc-20030210/gcc/config/sh/sh.h	Sat Feb 22 01:40:14 2003
  1070 @@ -147,10 +147,10 @@
  1071  #define HARD_SH4_BIT	(1<<5)
  1072  #define FPU_SINGLE_BIT	(1<<7)
  1073  #define SH4_BIT	       	(1<<12)
  1074 +#define NO_IMPLICIT_FP_BIT	(1<<3)
  1075  #define FMOVD_BIT	(1<<4)
  1076  #define SH5_BIT		(1<<0)
  1077  #define SPACE_BIT 	(1<<13)
  1078 -#define BIGTABLE_BIT  	(1<<14)
  1079  #define RELAX_BIT	(1<<15)
  1080  #define USERMODE_BIT	(1<<16)
  1081  #define HITACHI_BIT     (1<<22)
  1082 @@ -205,6 +205,9 @@
  1083  /* Nonzero if we should generate code for a SH5 CPU (either ISA).  */
  1084  #define TARGET_SH5 (target_flags & SH5_BIT)
  1085  
  1086 +/* Nonzero if we should not use FPU implicitly.  */
  1087 +#define TARGET_NO_IMPLICIT_FP (target_flags & NO_IMPLICIT_FP_BIT)
  1088 +
  1089  /* Nonzero if we should generate code using the SHcompact instruction
  1090     set and 32-bit ABI.  */
  1091  #define TARGET_SHCOMPACT (TARGET_SH5 && TARGET_SH1)
  1092 @@ -225,6 +228,7 @@
  1093  
  1094  /* Nonzero if we should generate code using SHmedia FPU instructions.  */
  1095  #define TARGET_SHMEDIA_FPU (TARGET_SHMEDIA && TARGET_FPU_DOUBLE)
  1096 +
  1097  /* Nonzero if we should generate fmovd.  */
  1098  #define TARGET_FMOVD (target_flags & FMOVD_BIT)
  1099  
  1100 @@ -234,9 +238,6 @@
  1101  /* Nonzero if we should generate smaller code rather than faster code.  */
  1102  #define TARGET_SMALLCODE   (target_flags & SPACE_BIT)
  1103  
  1104 -/* Nonzero to use long jump tables.  */
  1105 -#define TARGET_BIGTABLE     (target_flags & BIGTABLE_BIT)
  1106 -
  1107  /* Nonzero to generate pseudo-ops needed by the assembler and linker
  1108     to do function call relaxing.  */
  1109  #define TARGET_RELAX (target_flags & RELAX_BIT)
  1110 @@ -297,7 +298,6 @@
  1111    {"5-compact-nofpu", TARGET_NONE, "" },	\
  1112    {"5-compact-nofpu", SH5_BIT|SH3_BIT|SH2_BIT|SH1_BIT, "Generate FPU-less SHcompact code" }, \
  1113    {"b",		-LITTLE_ENDIAN_BIT, "" },  	\
  1114 -  {"bigtable", 	BIGTABLE_BIT, "" },		\
  1115    {"dalign",  	DALIGN_BIT, "" },		\
  1116    {"fmovd",  	FMOVD_BIT, "" },		\
  1117    {"hitachi",	HITACHI_BIT, "" },		\
  1118 @@ -306,6 +306,7 @@
  1119    {"isize", 	ISIZE_BIT, "" },		\
  1120    {"l",		LITTLE_ENDIAN_BIT, "" },  	\
  1121    {"no-ieee",  	-IEEE_BIT, "" },		\
  1122 +  {"no-implicit-fp", NO_IMPLICIT_FP_BIT, "" },	\
  1123    {"padstruct", PADSTRUCT_BIT, "" },    	\
  1124    {"prefergot",	PREFERGOT_BIT, "" },		\
  1125    {"relax",	RELAX_BIT, "" },		\
  1126 @@ -2493,16 +2494,22 @@
  1127      goto LABEL;								\
  1128  }
  1129  
  1130 +extern int optimize; /* needed for gen_casesi.  */
  1131 +extern int optimize_size;
  1132 +
  1133  /* Specify the machine mode that this machine uses
  1134     for the index in the tablejump instruction.  */
  1135 -#define CASE_VECTOR_MODE (TARGET_BIGTABLE ? SImode : HImode)
  1136 +#define CASE_VECTOR_MODE SImode
  1137  
  1138  #define CASE_VECTOR_SHORTEN_MODE(MIN_OFFSET, MAX_OFFSET, BODY) \
  1139  ((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 127 \
  1140   ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, QImode) \
  1141   : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 255 \
  1142   ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, QImode) \
  1143 - : (MIN_OFFSET) >= -32768 && (MAX_OFFSET) <= 32767 ? HImode \
  1144 + : (MIN_OFFSET) >= -32768 && (MAX_OFFSET) <= 32767 \
  1145 + ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, HImode) \
  1146 + : optimize_size && (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 65535 \
  1147 + ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, HImode) \
  1148   : SImode)
  1149  
  1150  /* Define as C expression which evaluates to nonzero if the tablejump
  1151 @@ -3038,10 +3045,7 @@
  1152  /* Output an absolute table element.  */
  1153  
  1154  #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE)  				\
  1155 -  if (TARGET_BIGTABLE) 							\
  1156 -    asm_fprintf ((STREAM), "\t.long\t%LL%d\n", (VALUE)); 			\
  1157 -  else									\
  1158 -    asm_fprintf ((STREAM), "\t.word\t%LL%d\n", (VALUE)); 			\
  1159 +    asm_fprintf ((STREAM), "\t.long\t%LL%d\n", (VALUE))
  1160  
  1161  /* Output various types of constants.  */
  1162  
  1163 @@ -3167,8 +3171,6 @@
  1164  #define sh_cpu_attr ((enum attr_cpu)sh_cpu)
  1165  extern enum processor_type sh_cpu;
  1166  
  1167 -extern int optimize; /* needed for gen_casesi.  */
  1168 -
  1169  enum mdep_reorg_phase_e
  1170  {
  1171    SH_BEFORE_MDEP_REORG,
  1172 diff -ruN gcc-20030210.orig/gcc/config/sh/sh.md gcc-20030210/gcc/config/sh/sh.md
  1173 --- gcc-20030210.orig/gcc/config/sh/sh.md	Sat Nov 23 04:58:06 2002
  1174 +++ gcc-20030210/gcc/config/sh/sh.md	Sat Feb 22 01:40:14 2003
  1175 @@ -1242,7 +1242,7 @@
  1176     (clobber (reg:SI PR_REG))
  1177     (clobber (reg:SI R4_REG))
  1178     (use (match_operand:SI 1 "arith_reg_operand" "r"))]
  1179 -  "TARGET_SH1 && ! TARGET_SH4"
  1180 +  "TARGET_SH1 && ! TARGET_SH4 || TARGET_NO_IMPLICIT_FP"
  1181    "jsr	@%1%#"
  1182    [(set_attr "type" "sfunc")
  1183     (set_attr "needs_delay_slot" "yes")])
  1184 @@ -1336,7 +1336,7 @@
  1185  
  1186    operands[3] = gen_reg_rtx (Pmode);
  1187    /* Emit the move of the address to a pseudo outside of the libcall.  */
  1188 -  if (TARGET_HARD_SH4 && TARGET_SH3E)
  1189 +  if (TARGET_HARD_SH4 && TARGET_SH3E && !TARGET_NO_IMPLICIT_FP)
  1190      {
  1191        emit_move_insn (operands[3],
  1192  		      gen_rtx_SYMBOL_REF (SImode, \"__udivsi3_i4\"));
  1193 @@ -1391,7 +1391,7 @@
  1194     (clobber (reg:SI R2_REG))
  1195     (clobber (reg:SI R3_REG))
  1196     (use (match_operand:SI 1 "arith_reg_operand" "r"))]
  1197 -  "TARGET_SH1 && ! TARGET_SH4"
  1198 +  "TARGET_SH1 && ! TARGET_SH4 || TARGET_NO_IMPLICIT_FP"
  1199    "jsr	@%1%#"
  1200    [(set_attr "type" "sfunc")
  1201     (set_attr "needs_delay_slot" "yes")])
  1202 @@ -1476,7 +1476,7 @@
  1203  
  1204    operands[3] = gen_reg_rtx (Pmode);
  1205    /* Emit the move of the address to a pseudo outside of the libcall.  */
  1206 -  if (TARGET_HARD_SH4 && TARGET_SH3E)
  1207 +  if (TARGET_HARD_SH4 && TARGET_SH3E && !TARGET_NO_IMPLICIT_FP)
  1208      {
  1209        emit_move_insn (operands[3],
  1210  		      gen_rtx_SYMBOL_REF (SImode, \"__sdivsi3_i4\"));
  1211 @@ -6446,6 +6446,8 @@
  1212      case SImode:
  1213        return \"shll2	%1\;mov.l	@(r0,%1),%0\";
  1214      case HImode:
  1215 +      if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
  1216 +	return \"add	%1,%1\;mov.w	@(r0,%1),%0\;extu.w	%0,%0\";
  1217        return \"add	%1,%1\;mov.w	@(r0,%1),%0\";
  1218      case QImode:
  1219        if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned)
  1220 @@ -6455,7 +6457,15 @@
  1221        abort ();
  1222      }
  1223  }"
  1224 -  [(set_attr "length" "4")])
  1225 +  [(set (attr "length")
  1226 +	(cond [(eq (symbol_ref "shl_casesi_worker_length (insn)") (const_int 1))
  1227 +	       (const_string "2")
  1228 +	       (eq (symbol_ref "shl_casesi_worker_length (insn)") (const_int 2))
  1229 +	       (const_string "4")
  1230 +	       ;; Put "match_dup" here so that insn_variable_length_p return 1.
  1231 +	       (ne (match_dup 2) (match_dup 2))
  1232 +	       (const_string "4")]
  1233 +	      (const_string "6")))])
  1234  
  1235  (define_insn "casesi_shift_media"
  1236    [(set (match_operand 0 "arith_reg_operand" "=r")
  1237 diff -ruN gcc-20030210.orig/gcc/config/sh/sh3-linux.h gcc-20030210/gcc/config/sh/sh3-linux.h
  1238 --- gcc-20030210.orig/gcc/config/sh/sh3-linux.h	Thu Jan  1 09:00:00 1970
  1239 +++ gcc-20030210/gcc/config/sh/sh3-linux.h	Sat Feb 22 01:40:14 2003
  1240 @@ -0,0 +1,29 @@
  1241 +#undef TARGET_VERSION
  1242 +#define TARGET_VERSION  fputs (" (SH3 GNU/Linux with ELF)", stderr);
  1243 +
  1244 +#undef CPP_SPEC
  1245 +#define CPP_SPEC \
  1246 +  "-D__LITTLE_ENDIAN__ \
  1247 +   -D__SH3__ -D__sh3__ \
  1248 +   -D__SIZE_TYPE__=unsigned\\ int \
  1249 +   -D__PTRDIFF_TYPE__=int \
  1250 +   %{fPIC:-D__PIC__ -D__pic__} \
  1251 +   %{fpic:-D__PIC__ -D__pic__} \
  1252 +   %{posix:-D_POSIX_SOURCE} \
  1253 +   %{pthread:-D_REENTRANT -D_PTHREADS}"
  1254 +
  1255 +#undef ASM_SPEC
  1256 +#define ASM_SPEC  "%{mrelax:-relax}"
  1257 +
  1258 +#undef CC1_SPEC
  1259 +#define CC1_SPEC \
  1260 +  "-musermode -ml -m3 %{profile:-p}"
  1261 +
  1262 +#undef LINK_SPEC
  1263 +#define LINK_SPEC \
  1264 +  "%{mrelax:-relax} \
  1265 +   %{shared:-shared} \
  1266 +   %{!static: \
  1267 +     %{rdynamic:-export-dynamic} \
  1268 +     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
  1269 +    %{static:-static}"
  1270 diff -ruN gcc-20030210.orig/gcc/config/sh/sh3eb-linux.h gcc-20030210/gcc/config/sh/sh3eb-linux.h
  1271 --- gcc-20030210.orig/gcc/config/sh/sh3eb-linux.h	Thu Jan  1 09:00:00 1970
  1272 +++ gcc-20030210/gcc/config/sh/sh3eb-linux.h	Sat Feb 22 01:40:14 2003
  1273 @@ -0,0 +1,29 @@
  1274 +#undef TARGET_VERSION
  1275 +#define TARGET_VERSION  fputs (" (SH3EB GNU/Linux with ELF)", stderr);
  1276 +
  1277 +#undef CPP_SPEC
  1278 +#define CPP_SPEC \
  1279 +  "-D__BIG_ENDIAN__ \
  1280 +   -D__SH3__ -D__sh3__ \
  1281 +   -D__SIZE_TYPE__=unsigned\\ int \
  1282 +   -D__PTRDIFF_TYPE__=int \
  1283 +   %{fPIC:-D__PIC__ -D__pic__} \
  1284 +   %{fpic:-D__PIC__ -D__pic__} \
  1285 +   %{posix:-D_POSIX_SOURCE} \
  1286 +   %{pthread:-D_REENTRANT -D_PTHREADS}"
  1287 +
  1288 +#undef ASM_SPEC
  1289 +#define ASM_SPEC  "%{mrelax:-relax}"
  1290 +
  1291 +#undef CC1_SPEC
  1292 +#define CC1_SPEC \
  1293 +  "-musermode -mb -m3 %{profile:-p}"
  1294 +
  1295 +#undef LINK_SPEC
  1296 +#define LINK_SPEC \
  1297 +  "%{mrelax:-relax} \
  1298 +   %{shared:-shared} \
  1299 +   %{!static: \
  1300 +     %{rdynamic:-export-dynamic} \
  1301 +     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
  1302 +    %{static:-static}"
  1303 diff -ruN gcc-20030210.orig/gcc/config/sh/sh4-linux.h gcc-20030210/gcc/config/sh/sh4-linux.h
  1304 --- gcc-20030210.orig/gcc/config/sh/sh4-linux.h	Thu Jan  1 09:00:00 1970
  1305 +++ gcc-20030210/gcc/config/sh/sh4-linux.h	Sat Feb 22 01:40:14 2003
  1306 @@ -0,0 +1,29 @@
  1307 +#undef TARGET_VERSION
  1308 +#define TARGET_VERSION  fputs (" (SH4 GNU/Linux with ELF)", stderr);
  1309 +
  1310 +#undef CPP_SPEC
  1311 +#define CPP_SPEC \
  1312 +  "-D__LITTLE_ENDIAN__ \
  1313 +   -D__SH4__ \
  1314 +   -D__SIZE_TYPE__=unsigned\\ int \
  1315 +   -D__PTRDIFF_TYPE__=int \
  1316 +   %{fPIC:-D__PIC__ -D__pic__} \
  1317 +   %{fpic:-D__PIC__ -D__pic__} \
  1318 +   %{posix:-D_POSIX_SOURCE} \
  1319 +   %{pthread:-D_REENTRANT -D_PTHREADS}"
  1320 +
  1321 +#undef ASM_SPEC
  1322 +#define ASM_SPEC  "%{mrelax:-relax}"
  1323 +
  1324 +#undef CC1_SPEC
  1325 +#define CC1_SPEC \
  1326 +  "-musermode -ml -m4 %{profile:-p}"
  1327 +
  1328 +#undef LINK_SPEC
  1329 +#define LINK_SPEC \
  1330 +  "%{mrelax:-relax} \
  1331 +   %{shared:-shared} \
  1332 +   %{!static: \
  1333 +     %{rdynamic:-export-dynamic} \
  1334 +     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
  1335 +    %{static:-static}"
  1336 diff -ruN gcc-20030210.orig/gcc/config/sh/sh4eb-linux.h gcc-20030210/gcc/config/sh/sh4eb-linux.h
  1337 --- gcc-20030210.orig/gcc/config/sh/sh4eb-linux.h	Thu Jan  1 09:00:00 1970
  1338 +++ gcc-20030210/gcc/config/sh/sh4eb-linux.h	Sat Feb 22 01:40:14 2003
  1339 @@ -0,0 +1,29 @@
  1340 +#undef TARGET_VERSION
  1341 +#define TARGET_VERSION  fputs (" (SH4EB GNU/Linux with ELF)", stderr);
  1342 +
  1343 +#undef CPP_SPEC
  1344 +#define CPP_SPEC \
  1345 +  "-D__BIG_ENDIAN__ \
  1346 +   -D__SH4__ \
  1347 +   -D__SIZE_TYPE__=unsigned\\ int \
  1348 +   -D__PTRDIFF_TYPE__=int \
  1349 +   %{fPIC:-D__PIC__ -D__pic__} \
  1350 +   %{fpic:-D__PIC__ -D__pic__} \
  1351 +   %{posix:-D_POSIX_SOURCE} \
  1352 +   %{pthread:-D_REENTRANT -D_PTHREADS}"
  1353 +
  1354 +#undef ASM_SPEC
  1355 +#define ASM_SPEC  "%{mrelax:-relax}"
  1356 +
  1357 +#undef CC1_SPEC
  1358 +#define CC1_SPEC \
  1359 +  "-musermode -mb -m4 %{profile:-p}"
  1360 +
  1361 +#undef LINK_SPEC
  1362 +#define LINK_SPEC \
  1363 +  "%{mrelax:-relax} \
  1364 +   %{shared:-shared} \
  1365 +   %{!static: \
  1366 +     %{rdynamic:-export-dynamic} \
  1367 +     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
  1368 +    %{static:-static}"
  1369 diff -ruN gcc-20030210.orig/gcc/config/sh/t-linux gcc-20030210/gcc/config/sh/t-linux
  1370 --- gcc-20030210.orig/gcc/config/sh/t-linux	Thu May 17 12:16:12 2001
  1371 +++ gcc-20030210/gcc/config/sh/t-linux	Sat Feb 22 01:40:14 2003
  1372 @@ -1,10 +1,20 @@
  1373 -TARGET_LIBGCC2_CFLAGS = -fpic
  1374 +TARGET_LIBGCC2_CFLAGS = -fpic -DNO_FPSCR_VALUES
  1375 +LIBGCC1 = libgcc1-asm.a
  1376 +CROSS_LIBGCC1 = libgcc1-asm.a
  1377 +LIBGCC1_TEST = libgcc1-test
  1378  LIB1ASMFUNCS = _ashiftrt _ashiftrt_n _ashiftlt _lshiftrt _movstr \
  1379    _movstr_i4 _mulsi3 _sdivsi3 _sdivsi3_i4 _udivsi3 _udivsi3_i4 _set_fpscr \
  1380    _ic_invalidate
  1381 +LIB2ADDEH = $(srcdir)/unwind-sjlj.c
  1382 +LIB2ADDEHDEP = unwind.inc unwind-sjlj.c
  1383  
  1384 -MULTILIB_OPTIONS= mb m3e/m4
  1385 +MULTILIB_OPTIONS= mb m4
  1386  MULTILIB_DIRNAMES= 
  1387  MULTILIB_MATCHES = 
  1388  
  1389 -EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o
  1390 +EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
  1391 +
  1392 +# Override t-slibgcc-elf-ver to export some libgcc symbols with
  1393 +# the symbol versions that glibc used and SH specific.
  1394 +SHLIB_MAPFILES =  $(srcdir)/libgcc-std.ver \
  1395 +		  $(srcdir)/config/sh/libgcc-glibc.ver
  1396 diff -ruN gcc-20030210.orig/gcc/config/sh/t-linux-nomulti gcc-20030210/gcc/config/sh/t-linux-nomulti
  1397 --- gcc-20030210.orig/gcc/config/sh/t-linux-nomulti	Thu Jan  1 09:00:00 1970
  1398 +++ gcc-20030210/gcc/config/sh/t-linux-nomulti	Sat Feb 22 01:40:14 2003
  1399 @@ -0,0 +1,9 @@
  1400 +LIBGCC = libgcc.a
  1401 +EXTRA_PARTS = crtbegin.o crtbeginS.o crtend.o crtendS.o crtbeginT.o
  1402 +
  1403 +INSTALL_LIBGCC = install-libgcc
  1404 +
  1405 +MULTILIB_OPTIONS=
  1406 +MULTILIB_DIRNAMES= 
  1407 +MULTILIB_MATCHES = 
  1408 +EXTRA_MULTILIB_PARTS=
  1409 diff -ruN gcc-20030210.orig/gcc/config.gcc gcc-20030210/gcc/config.gcc
  1410 --- gcc-20030210.orig/gcc/config.gcc	Fri Jan 31 19:17:13 2003
  1411 +++ gcc-20030210/gcc/config.gcc	Sat Feb 22 01:40:14 2003
  1412 @@ -337,9 +337,9 @@
  1413  sparc*-*-*)
  1414  	cpu_type=sparc
  1415  	;;
  1416 -sh64-*-*)
  1417 -	cpu_type=sh
  1418 -	;;
  1419 +sh*-*-*)
  1420 + 	cpu_type=sh
  1421 + 	;;
  1422  esac
  1423  
  1424  tm_file=${cpu_type}/${cpu_type}.h
  1425 @@ -3018,9 +3018,31 @@
  1426  	  thread_file='rtems'
  1427  	fi
  1428  	;;
  1429 -sh-*-linux*)
  1430 +sh*-*-linux*)
  1431  	tm_file="${tm_file} sh/elf.h sh/linux.h"
  1432 -	tmake_file="sh/t-sh sh/t-elf sh/t-linux"
  1433 +	tmake_file="sh/t-sh sh/t-elf t-slibgcc-elf-ver t-linux sh/t-linux"
  1434 +	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
  1435 +	case $machine in
  1436 +		sh3eb-*)
  1437 +			tm_file="${tm_file} sh/sh3eb-linux.h"
  1438 +			tmake_file="${tmake_file} sh/t-linux-nomulti"
  1439 +			;;
  1440 +		sh4eb-*)
  1441 +			tm_file="${tm_file} sh/sh4eb-linux.h"
  1442 +			tmake_file="${tmake_file} sh/t-linux-nomulti"
  1443 +			;;
  1444 +		sh3-*)
  1445 +			tm_file="${tm_file} sh/sh3-linux.h"
  1446 +			tmake_file="${tmake_file} sh/t-linux-nomulti"
  1447 +			;;
  1448 +		sh4-*)
  1449 +			tm_file="${tm_file} sh/sh4-linux.h"
  1450 +			tmake_file="${tmake_file} sh/t-linux-nomulti"
  1451 +			;;
  1452 +		*)
  1453 +			;;
  1454 +	esac
  1455 +	xmake_file=x-linux
  1456  	gas=yes gnu_ld=yes
  1457  	float_format=sh
  1458  	;;
  1459 diff -ruN gcc-20030210.orig/gcc/dwarf2out.c gcc-20030210/gcc/dwarf2out.c
  1460 --- gcc-20030210.orig/gcc/dwarf2out.c	Mon Feb 10 19:36:25 2003
  1461 +++ gcc-20030210/gcc/dwarf2out.c	Sat Feb 22 01:40:14 2003
  1462 @@ -10224,7 +10224,9 @@
  1463  	  /* We can have a normal definition following an inline one in the
  1464  	     case of redefinition of GNU C extern inlines.
  1465  	     It seems reasonable to use AT_specification in this case.  */
  1466 -	  && !get_AT_unsigned (old_die, DW_AT_inline))
  1467 +	  && !get_AT_unsigned (old_die, DW_AT_inline)
  1468 +	  /* Skip the nested function.  */
  1469 +	  && !decl_function_context (decl))
  1470  	{
  1471  	  /* ??? This can happen if there is a bug in the program, for
  1472  	     instance, if it has duplicate function definitions.  Ideally,
  1473 diff -ruN gcc-20030210.orig/gcc/final.c gcc-20030210/gcc/final.c
  1474 --- gcc-20030210.orig/gcc/final.c	Fri Jan 31 19:17:20 2003
  1475 +++ gcc-20030210/gcc/final.c	Sat Feb 22 01:40:14 2003
  1476 @@ -1128,7 +1128,7 @@
  1477  	    }
  1478  	}
  1479  
  1480 -      INSN_ADDRESSES (uid) = insn_current_address;
  1481 +      INSN_ADDRESSES (uid) = insn_current_address + insn_lengths[uid];
  1482  
  1483        if (GET_CODE (insn) == NOTE || GET_CODE (insn) == BARRIER
  1484  	  || GET_CODE (insn) == CODE_LABEL)
  1485 diff -ruN gcc-20030210.orig/gcc/mkmap-symver.awk gcc-20030210/gcc/mkmap-symver.awk
  1486 --- gcc-20030210.orig/gcc/mkmap-symver.awk	Fri Jan 31 19:17:26 2003
  1487 +++ gcc-20030210/gcc/mkmap-symver.awk	Sat Feb 22 01:40:14 2003
  1488 @@ -89,7 +89,11 @@
  1489      output(inherit[lib]);
  1490  
  1491    printf("%s {\n", lib);
  1492 -  printf("  global:\n");
  1493 +  for (sym in ver)
  1494 +    if ((ver[sym] == lib) && (sym in def))
  1495 +      count++;
  1496 +  if (count > 0)
  1497 +    printf("  global:\n");
  1498    for (sym in ver)
  1499      if ((ver[sym] == lib) && (sym in def))
  1500        {
  1501 diff -ruN gcc-20030210.orig/gcc/reload1.c gcc-20030210/gcc/reload1.c
  1502 --- gcc-20030210.orig/gcc/reload1.c	Fri Jan 31 19:17:29 2003
  1503 +++ gcc-20030210/gcc/reload1.c	Sat Feb 22 01:40:14 2003
  1504 @@ -6103,6 +6103,7 @@
  1505  	    for (j = 0; j < n_reloads; j++)
  1506  	      if (rld[j].in != 0
  1507  		  && rld[j].when_needed != RELOAD_OTHER
  1508 +		  && rld[j].when_needed != RELOAD_FOR_OUTPUT_ADDRESS
  1509  		  && reg_overlap_mentioned_for_reload_p (rld[j].in,
  1510  							 rld[i].in))
  1511  		rld[j].when_needed
  1512 diff -ruN gcc-20030210.orig/gcc/reorg.c gcc-20030210/gcc/reorg.c
  1513 --- gcc-20030210.orig/gcc/reorg.c	Fri Jan 31 19:17:30 2003
  1514 +++ gcc-20030210/gcc/reorg.c	Sat Feb 22 01:40:14 2003
  1515 @@ -3265,6 +3265,14 @@
  1516  		|| condjump_in_parallel_p (XVECEXP (PATTERN (insn), 0, 0))))
  1517  	continue;
  1518  
  1519 +#ifdef MD_CAN_REDIRECT_BRANCH
  1520 +      /* On some targets, branches with delay slots can have a limited
  1521 +	 displacement.  Give the back end a chance to tell us we can't do
  1522 +	 this.  */
  1523 +      if (! MD_CAN_REDIRECT_BRANCH (insn, delay_insn))
  1524 +	continue;
  1525 +#endif
  1526 +
  1527        target_label = JUMP_LABEL (delay_insn);
  1528  
  1529        if (target_label)
  1530 diff -ruN gcc-20030210.orig/gcc/tree-inline.c gcc-20030210/gcc/tree-inline.c
  1531 --- gcc-20030210.orig/gcc/tree-inline.c	Fri Jan 31 19:17:33 2003
  1532 +++ gcc-20030210/gcc/tree-inline.c	Sat Feb 22 01:40:14 2003
  1533 @@ -836,11 +836,17 @@
  1534  
  1535    /* Don't try to inline functions that are not well-suited to
  1536       inlining.  */
  1537 -  if (!inlinable_function_p (fn, id))
  1538 -    return NULL_TREE;
  1539 +  if (! inlinable_function_p (fn, id)
  1540 +      || ! (*lang_hooks.tree_inlining.start_inlining) (fn))
  1541 +    {
  1542 +      if (DECL_INLINE (fn) && warn_inline && ! flag_really_no_inline)
  1543 +	{
  1544 +	  warning_with_decl (fn, "inlining failed in call to `%s'");
  1545 +	  warning ("called from here");
  1546 +	}
  1547  
  1548 -  if (! (*lang_hooks.tree_inlining.start_inlining) (fn))
  1549 -    return NULL_TREE;
  1550 +      return NULL_TREE;
  1551 +    }
  1552  
  1553    /* Set the current filename and line number to the function we are
  1554       inlining so that when we create new _STMT nodes here they get
  1555 diff -ruN gcc-20030210.orig/libjava/Makefile.in gcc-20030210/libjava/Makefile.in
  1556 --- gcc-20030210.orig/libjava/Makefile.in	Tue Jan 28 10:44:37 2003
  1557 +++ gcc-20030210/libjava/Makefile.in	Sat Feb 22 01:40:14 2003
  1558 @@ -1637,6 +1637,7 @@
  1559  	"AS=$(AS)" \
  1560  	"CC=$(CC)" \
  1561  	"CXX=$(CXX)" \
  1562 +	"GCJ=$(GCJ)" \
  1563  	"LD=$(LD)" \
  1564  	"LIBCFLAGS=$(LIBCFLAGS)" \
  1565  	"NM=$(NM)" \
  1566 diff -ruN gcc-20030210.orig/libjava/configure gcc-20030210/libjava/configure
  1567 --- gcc-20030210.orig/libjava/configure	Tue Jan 28 10:44:37 2003
  1568 +++ gcc-20030210/libjava/configure	Sat Feb 22 01:42:11 2003
  1569 @@ -2031,7 +2031,7 @@
  1570  # This must be Linux ELF.
  1571  linux-gnu*)
  1572    case $host_cpu in
  1573 -  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
  1574 +  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* )
  1575      lt_cv_deplibs_check_method=pass_all ;;
  1576    *)
  1577      # glibc up to 2.1.1 does not perform some relocations on ARM
  1578 diff -ruN gcc-20030210.orig/libjava/java/net/natInetAddress.cc gcc-20030210/libjava/java/net/natInetAddress.cc
  1579 --- gcc-20030210.orig/libjava/java/net/natInetAddress.cc	Tue Mar  5 05:02:19 2002
  1580 +++ gcc-20030210/libjava/java/net/natInetAddress.cc	Sat Feb 22 01:40:14 2003
  1581 @@ -56,7 +56,7 @@
  1582  #endif
  1583  
  1584  #ifndef HAVE_GETHOSTNAME_DECL
  1585 -extern "C" int gethostname (char *name, int namelen);
  1586 +extern "C" int gethostname (char *name, unsigned int namelen);
  1587  #endif
  1588  
  1589  #ifdef DISABLE_JAVA_NET
  1590 diff -ruN gcc-20030210.orig/libjava/libltdl/aclocal.m4 gcc-20030210/libjava/libltdl/aclocal.m4
  1591 --- gcc-20030210.orig/libjava/libltdl/aclocal.m4	Sun Sep 10 17:04:40 2000
  1592 +++ gcc-20030210/libjava/libltdl/aclocal.m4	Sat Feb 22 01:40:14 2003
  1593 @@ -573,7 +573,7 @@
  1594  # This must be Linux ELF.
  1595  linux-gnu*)
  1596    case "$host_cpu" in
  1597 -  alpha* | i*86 | powerpc* | sparc* | ia64* )
  1598 +  alpha* | i*86 | powerpc* | sparc* | ia64* | sh*)
  1599      lt_cv_deplibs_check_method=pass_all ;;
  1600    *)
  1601      # glibc up to 2.1.1 does not perform some relocations on ARM
  1602 diff -ruN gcc-20030210.orig/libjava/sysdep/sh/locks.h gcc-20030210/libjava/sysdep/sh/locks.h
  1603 --- gcc-20030210.orig/libjava/sysdep/sh/locks.h	Thu Jan  1 09:00:00 1970
  1604 +++ gcc-20030210/libjava/sysdep/sh/locks.h	Sat Feb 22 01:40:14 2003
  1605 @@ -0,0 +1,72 @@
  1606 +// locks.h - Thread synchronization primitives. SuperH implementation.
  1607 +
  1608 +/* Copyright (C) 2002  Free Software Foundation
  1609 +
  1610 +   This file is part of libgcj.
  1611 +
  1612 +This software is copyrighted work licensed under the terms of the
  1613 +Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
  1614 +details.  */
  1615 +
  1616 +#ifndef __SYSDEP_LOCKS_H__
  1617 +#define __SYSDEP_LOCKS_H__
  1618 +
  1619 +typedef size_t obj_addr_t;	/* Integer type big enough for object	*/
  1620 +				/* address.				*/
  1621 +
  1622 +static unsigned char __cas_lock = 0;
  1623 +
  1624 +inline static void
  1625 +__cas_start_atomic (void)
  1626 +{
  1627 +  unsigned int val;
  1628 +
  1629 +  do
  1630 +    __asm__ __volatile__ ("tas.b @%1; movt %0"
  1631 +			  : "=r" (val)
  1632 +			  : "r" (&__cas_lock)
  1633 +			  : "memory");
  1634 +  while (val == 0);
  1635 +}
  1636 +
  1637 +inline static void
  1638 +__cas_end_atomic (void)
  1639 +{
  1640 +  __asm__ __volatile__ (" " : : : "memory");
  1641 +  __cas_lock = 0;
  1642 +}
  1643 +
  1644 +inline static bool
  1645 +compare_and_swap (volatile obj_addr_t *addr, obj_addr_t old,
  1646 +		  obj_addr_t new_val)
  1647 +{
  1648 +  bool ret;
  1649 +
  1650 +  __cas_start_atomic ();
  1651 +  if (*addr != old)
  1652 +    ret = false;
  1653 +  else
  1654 +    {
  1655 +      *addr = new_val;
  1656 +      ret = true;
  1657 +    }
  1658 +  __cas_end_atomic ();
  1659 +
  1660 +  return ret;
  1661 +}
  1662 +
  1663 +inline static void
  1664 +release_set (volatile obj_addr_t *addr, obj_addr_t new_val)
  1665 +{
  1666 +  __asm__ __volatile__ (" " : : : "memory");
  1667 +  *(addr) = new_val;
  1668 +}
  1669 +
  1670 +inline static bool
  1671 +compare_and_swap_release (volatile obj_addr_t *addr, obj_addr_t old,
  1672 +			  obj_addr_t new_val)
  1673 +{
  1674 +  return compare_and_swap (addr, old, new_val);
  1675 +}
  1676 +
  1677 +#endif /* ! __SYSDEP_LOCKS_H__ */
  1678 diff -ruN gcc-20030210.orig/libstdc++-v3/acinclude.m4 gcc-20030210/libstdc++-v3/acinclude.m4
  1679 --- gcc-20030210.orig/libstdc++-v3/acinclude.m4	Tue Jan 28 02:30:41 2003
  1680 +++ gcc-20030210/libstdc++-v3/acinclude.m4	Sat Feb 22 01:40:14 2003
  1681 @@ -1828,9 +1828,10 @@
  1682    GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
  1683  
  1684    # Passed down for canadian crosses.
  1685 -  if test x"$CANADIAN" = xyes; then
  1686 -    TOPLEVEL_INCLUDES='-I$(includedir)'
  1687 -  fi
  1688 +  #if test x"$CANADIAN" = xyes; then
  1689 +  #  TOPLEVEL_INCLUDES='-I$(includedir)'
  1690 +  #fi
  1691 +  TOPLEVEL_INCLUDES=''
  1692  
  1693    LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
  1694  
  1695 diff -ruN gcc-20030210.orig/libstdc++-v3/aclocal.m4 gcc-20030210/libstdc++-v3/aclocal.m4
  1696 --- gcc-20030210.orig/libstdc++-v3/aclocal.m4	Mon Feb 10 19:36:47 2003
  1697 +++ gcc-20030210/libstdc++-v3/aclocal.m4	Sat Feb 22 01:40:14 2003
  1698 @@ -1840,9 +1840,10 @@
  1699    GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
  1700  
  1701    # Passed down for canadian crosses.
  1702 -  if test x"$CANADIAN" = xyes; then
  1703 -    TOPLEVEL_INCLUDES='-I$(includedir)'
  1704 -  fi
  1705 +  #if test x"$CANADIAN" = xyes; then
  1706 +  #  TOPLEVEL_INCLUDES='-I$(includedir)'
  1707 +  #fi
  1708 +  TOPLEVEL_INCLUDES=''
  1709  
  1710    LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
  1711  
  1712 diff -ruN gcc-20030210.orig/libstdc++-v3/configure gcc-20030210/libstdc++-v3/configure
  1713 --- gcc-20030210.orig/libstdc++-v3/configure	Mon Feb 10 19:37:17 2003
  1714 +++ gcc-20030210/libstdc++-v3/configure	Sat Feb 22 01:40:14 2003
  1715 @@ -1982,7 +1982,7 @@
  1716  # This must be Linux ELF.
  1717  linux-gnu*)
  1718    case $host_cpu in
  1719 -  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
  1720 +  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh*)
  1721      lt_cv_deplibs_check_method=pass_all ;;
  1722    *)
  1723      # glibc up to 2.1.1 does not perform some relocations on ARM
  1724 @@ -22340,9 +22340,10 @@
  1725    GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
  1726  
  1727    # Passed down for canadian crosses.
  1728 -  if test x"$CANADIAN" = xyes; then
  1729 -    TOPLEVEL_INCLUDES='-I$(includedir)'
  1730 -  fi
  1731 +  #if test x"$CANADIAN" = xyes; then
  1732 +  #  TOPLEVEL_INCLUDES='-I$(includedir)'
  1733 +  #fi
  1734 +  TOPLEVEL_INCLUDES=''
  1735  
  1736    LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
  1737  
  1738 diff -ruN gcc-20030210.orig/libtool.m4 gcc-20030210/libtool.m4
  1739 --- gcc-20030210.orig/libtool.m4	Fri Jan 31 19:16:59 2003
  1740 +++ gcc-20030210/libtool.m4	Sat Feb 22 01:40:14 2003
  1741 @@ -597,7 +597,7 @@
  1742  # This must be Linux ELF.
  1743  linux-gnu*)
  1744    case $host_cpu in
  1745 -  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
  1746 +  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* )
  1747      lt_cv_deplibs_check_method=pass_all ;;
  1748    *)
  1749      # glibc up to 2.1.1 does not perform some relocations on ARM
  1750 diff -ruN gcc-20030210.orig/zlib/configure gcc-20030210/zlib/configure
  1751 --- gcc-20030210.orig/zlib/configure	Tue Jan 28 10:44:15 2003
  1752 +++ gcc-20030210/zlib/configure	Sat Feb 22 01:40:14 2003
  1753 @@ -1571,7 +1571,7 @@
  1754  # This must be Linux ELF.
  1755  linux-gnu*)
  1756    case $host_cpu in
  1757 -  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
  1758 +  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | sh* )
  1759      lt_cv_deplibs_check_method=pass_all ;;
  1760    *)
  1761      # glibc up to 2.1.1 does not perform some relocations on ARM