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