Commit 3b836249feae6d08d3e6887486e4b9961ddafa09

Anthony Green 2011-02-08T14:28:59

Rebase from GCC

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
diff --git a/.pc/aix-ibm-xlc/ChangeLog b/.pc/aix-ibm-xlc/ChangeLog
index 41523ab..5c0ed7f 100644
--- a/.pc/aix-ibm-xlc/ChangeLog
+++ b/.pc/aix-ibm-xlc/ChangeLog
@@ -3,6 +3,20 @@
 	* configure.ac: Fix x86 test for pc related relocs.
 	* confifure: Rebuilt.
 
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/debug-build/ChangeLog b/.pc/debug-build/ChangeLog
index e924b83..c8f5859 100644
--- a/.pc/debug-build/ChangeLog
+++ b/.pc/debug-build/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/debug-build/configure b/.pc/debug-build/configure
index a308cf6..1c5aafe 100755
--- a/.pc/debug-build/configure
+++ b/.pc/debug-build/configure
@@ -12224,7 +12224,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/.pc/debug-build/configure.ac b/.pc/debug-build/configure.ac
index 82d67e3..0764460 100644
--- a/.pc/debug-build/configure.ac
+++ b/.pc/debug-build/configure.ac
@@ -118,7 +118,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/.pc/ffi_last_abi/ChangeLog b/.pc/ffi_last_abi/ChangeLog
index 25e4f60..109b58d 100644
--- a/.pc/ffi_last_abi/ChangeLog
+++ b/.pc/ffi_last_abi/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/ffi_last_abi/src/mips/ffitarget.h b/.pc/ffi_last_abi/src/mips/ffitarget.h
index c5f4e05..d0fc983 100644
--- a/.pc/ffi_last_abi/src/mips/ffitarget.h
+++ b/.pc/ffi_last_abi/src/mips/ffitarget.h
@@ -29,9 +29,17 @@
 
 #ifdef linux
 # include <asm/sgidefs.h>
+#elif defined(__rtems__)
+/*
+ * Subprogram calling convention - copied from sgidefs.h
+ */
+#define _MIPS_SIM_ABI32		1
+#define _MIPS_SIM_NABI32	2
+#define _MIPS_SIM_ABI64		3
 #else
 # include <sgidefs.h>
 #endif
+
 #  ifndef _ABIN32
 #    define _ABIN32 _MIPS_SIM_NABI32
 #  endif
diff --git a/.pc/fix-grammar/ChangeLog b/.pc/fix-grammar/ChangeLog
index 1b6af52..06f43b4 100644
--- a/.pc/fix-grammar/ChangeLog
+++ b/.pc/fix-grammar/ChangeLog
@@ -7,6 +7,20 @@
 	* configure.ac: Fix x86 test for pc related relocs.
 	* confifure: Rebuilt.
 
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/hpux-mallinfo/ChangeLog b/.pc/hpux-mallinfo/ChangeLog
index d271376..abb3be9 100644
--- a/.pc/hpux-mallinfo/ChangeLog
+++ b/.pc/hpux-mallinfo/ChangeLog
@@ -16,6 +16,20 @@
 	* configure.ac: Fix x86 test for pc related relocs.
 	* confifure: Rebuilt.
 
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/ml64-safeseh/ChangeLog b/.pc/ml64-safeseh/ChangeLog
index 891033e..f88a995 100644
--- a/.pc/ml64-safeseh/ChangeLog
+++ b/.pc/ml64-safeseh/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/msvcc-warning/ChangeLog b/.pc/msvcc-warning/ChangeLog
index 53990f4..2516c17 100644
--- a/.pc/msvcc-warning/ChangeLog
+++ b/.pc/msvcc-warning/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/sparc-v8-aggregate-returns/ChangeLog b/.pc/sparc-v8-aggregate-returns/ChangeLog
index 8e21aea..801315f 100644
--- a/.pc/sparc-v8-aggregate-returns/ChangeLog
+++ b/.pc/sparc-v8-aggregate-returns/ChangeLog
@@ -11,6 +11,20 @@
 	* configure.ac: Fix x86 test for pc related relocs.
 	* confifure: Rebuilt.
 
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/stand-alone/configure b/.pc/stand-alone/configure
index a4a4a19..b115511 100755
--- a/.pc/stand-alone/configure
+++ b/.pc/stand-alone/configure
@@ -11391,7 +11391,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/.pc/stand-alone/configure.ac b/.pc/stand-alone/configure.ac
index a7e97d5..d16155a 100644
--- a/.pc/stand-alone/configure.ac
+++ b/.pc/stand-alone/configure.ac
@@ -114,7 +114,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/.pc/stdcall-x86-closure-fix/ChangeLog b/.pc/stdcall-x86-closure-fix/ChangeLog
index 80e5418..42d7e16 100644
--- a/.pc/stdcall-x86-closure-fix/ChangeLog
+++ b/.pc/stdcall-x86-closure-fix/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/win64-struct-args/ChangeLog b/.pc/win64-struct-args/ChangeLog
index 7839a36..b5e3334 100644
--- a/.pc/win64-struct-args/ChangeLog
+++ b/.pc/win64-struct-args/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/win64-underscore/ChangeLog b/.pc/win64-underscore/ChangeLog
index bb9d920..20cb637 100644
--- a/.pc/win64-underscore/ChangeLog
+++ b/.pc/win64-underscore/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/win64-underscore/configure b/.pc/win64-underscore/configure
index 93c0f9c..935a0c9 100755
--- a/.pc/win64-underscore/configure
+++ b/.pc/win64-underscore/configure
@@ -12230,7 +12230,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/.pc/win64-underscore/configure.ac b/.pc/win64-underscore/configure.ac
index 7f0b98d..d835500 100644
--- a/.pc/win64-underscore/configure.ac
+++ b/.pc/win64-underscore/configure.ac
@@ -122,7 +122,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/.pc/x86_pcrel_test/ChangeLog b/.pc/x86_pcrel_test/ChangeLog
index 2ea6891..42c1f41 100644
--- a/.pc/x86_pcrel_test/ChangeLog
+++ b/.pc/x86_pcrel_test/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/.pc/x86_pcrel_test/configure b/.pc/x86_pcrel_test/configure
index 7a082c8..6752b2b 100755
--- a/.pc/x86_pcrel_test/configure
+++ b/.pc/x86_pcrel_test/configure
@@ -12231,7 +12231,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/.pc/x86_pcrel_test/configure.ac b/.pc/x86_pcrel_test/configure.ac
index 3535542..63f0b53 100644
--- a/.pc/x86_pcrel_test/configure.ac
+++ b/.pc/x86_pcrel_test/configure.ac
@@ -122,7 +122,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/ChangeLog b/ChangeLog
index 7fd0193..46b65aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,20 @@
 	* configure.ac: Fix x86 test for pc related relocs.
 	* confifure: Rebuilt.
 
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+	Handle case when CPU variant does not have long double support.
+	* libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+	and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+	* configure.ac: Add mips*-*-rtems* support.
+	* configure: Regenerate.
+	* src/mips/ffitarget.h: Ensure needed constants are available
+	for targets which do not have sgidefs.h.
+
 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
 
 	PR target/40125
diff --git a/Makefile.in b/Makefile.in
index ca3c0b9..d6ec834 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -383,7 +383,6 @@ psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
diff --git a/compile b/compile
old mode 100644
new mode 100755
diff --git a/configure b/configure
index 6c8c102..b4be879 100755
--- a/configure
+++ b/configure
@@ -12231,7 +12231,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/configure.ac b/configure.ac
index 59bacd9..c59d6c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,7 +122,7 @@ case "$host" in
 	TARGET=M68K; TARGETDIR=m68k
 	;;
 
-  mips-sgi-irix5.* | mips-sgi-irix6.*)
+  mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
 	TARGET=MIPS; TARGETDIR=mips
 	;;
   mips*-*-linux*)
diff --git a/fficonfig.h.in b/fficonfig.h.in
index 2d6058f..e6a51b3 100644
--- a/fficonfig.h.in
+++ b/fficonfig.h.in
@@ -154,9 +154,6 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
-/* Define if symbols are underscored. */
-#undef SYMBOL_UNDERSCORE
-
 /* Define this if you are using Purify and want to suppress spurious messages.
    */
 #undef USING_PURIFY
diff --git a/include/Makefile.in b/include/Makefile.in
index 264fd13..a0dc177 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -192,7 +192,6 @@ psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
diff --git a/man/Makefile.in b/man/Makefile.in
index b05b609..8ddba1f 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -190,7 +190,6 @@ psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
diff --git a/patches/debug-build b/patches/debug-build
index b88c9b4..e98da60 100644
--- a/patches/debug-build
+++ b/patches/debug-build
@@ -2,7 +2,7 @@ Index: libffi/ChangeLog
 ===================================================================
 --- libffi.orig/ChangeLog
 +++ libffi/ChangeLog
-@@ -109,6 +109,13 @@
+@@ -123,6 +123,13 @@
  	* testsuite/libffi.call/cls_longdouble.c: Likewise.
  	* testsuite/libffi.call/huge_struct.c: Likewise.
  
diff --git a/patches/ffi_last_abi b/patches/ffi_last_abi
index df1d80d..e637f44 100644
--- a/patches/ffi_last_abi
+++ b/patches/ffi_last_abi
@@ -2,7 +2,7 @@ Index: libffi/ChangeLog
 ===================================================================
 --- libffi.orig/ChangeLog
 +++ libffi/ChangeLog
-@@ -109,6 +109,12 @@
+@@ -123,6 +123,12 @@
  	* testsuite/libffi.call/cls_longdouble.c: Likewise.
  	* testsuite/libffi.call/huge_struct.c: Likewise.
  
@@ -127,7 +127,7 @@ Index: libffi/src/mips/ffitarget.h
 ===================================================================
 --- libffi.orig/src/mips/ffitarget.h
 +++ libffi/src/mips/ffitarget.h
-@@ -186,30 +186,29 @@ typedef enum ffi_abi {
+@@ -194,30 +194,29 @@ typedef enum ffi_abi {
    FFI_O32_SOFT_FLOAT,
    FFI_N32_SOFT_FLOAT,
    FFI_N64_SOFT_FLOAT,
diff --git a/patches/ml64-safeseh b/patches/ml64-safeseh
index 4e0a83c..eeb8f19 100644
--- a/patches/ml64-safeseh
+++ b/patches/ml64-safeseh
@@ -2,7 +2,7 @@ Index: libffi/ChangeLog
 ===================================================================
 --- libffi.orig/ChangeLog
 +++ libffi/ChangeLog
-@@ -117,6 +117,10 @@
+@@ -131,6 +131,10 @@
  	* src/prep_cif.c: Push stack space computation into src/x86/ffi.c
  	for X86_ANY so return value space doesn't get added twice.
  
diff --git a/patches/msvcc-warning b/patches/msvcc-warning
index 56cd929..f0c66b1 100644
--- a/patches/msvcc-warning
+++ b/patches/msvcc-warning
@@ -76,7 +76,7 @@ Index: libffi/ChangeLog
 ===================================================================
 --- libffi.orig/ChangeLog
 +++ libffi/ChangeLog
-@@ -175,6 +175,11 @@
+@@ -189,6 +189,11 @@
  	* man/Makefile.in: Regenerate.
  	* testsuite/Makefile.in: Regenerate.
  
diff --git a/patches/stdcall-x86-closure-fix b/patches/stdcall-x86-closure-fix
index 36026e2..ef17356 100644
--- a/patches/stdcall-x86-closure-fix
+++ b/patches/stdcall-x86-closure-fix
@@ -2,7 +2,7 @@ Index: libffi/ChangeLog
 ===================================================================
 --- libffi.orig/ChangeLog
 +++ libffi/ChangeLog
-@@ -109,6 +109,14 @@
+@@ -123,6 +123,14 @@
  	* testsuite/libffi.call/cls_longdouble.c: Likewise.
  	* testsuite/libffi.call/huge_struct.c: Likewise.
  
diff --git a/patches/win64-struct-args b/patches/win64-struct-args
index 4bdb9b9..e4673f4 100644
--- a/patches/win64-struct-args
+++ b/patches/win64-struct-args
@@ -51,7 +51,7 @@ Index: libffi/ChangeLog
 ===================================================================
 --- libffi.orig/ChangeLog
 +++ libffi/ChangeLog
-@@ -146,6 +146,14 @@
+@@ -160,6 +160,14 @@
  	* fficonfig.h.in: Regenerate.
  	* src/x86/sysv.S (.eh_frame): Use .ascii, .string or error.
  
diff --git a/patches/win64-underscore b/patches/win64-underscore
index 5699fcb..ebdcca4 100644
--- a/patches/win64-underscore
+++ b/patches/win64-underscore
@@ -2,7 +2,7 @@ Index: libffi/ChangeLog
 ===================================================================
 --- libffi.orig/ChangeLog
 +++ libffi/ChangeLog
-@@ -42,6 +42,13 @@
+@@ -56,6 +56,13 @@
  	(.eh_frame): Use FDE_ENCODING.
  	(.LASFDE1, .LASFDE2, LASFDE3): Simplify with FDE_ENCODE.
  
diff --git a/patches/x86_pcrel_test b/patches/x86_pcrel_test
index a8fd8c4..6fb03af 100644
--- a/patches/x86_pcrel_test
+++ b/patches/x86_pcrel_test
@@ -8,9 +8,9 @@ Index: libffi/ChangeLog
 +	* configure.ac: Fix x86 test for pc related relocs.
 +	* confifure: Rebuilt.
 +
- 2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
+ 2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
  
- 	PR target/40125
+ 	* libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
 Index: libffi/configure
 ===================================================================
 --- libffi.orig/configure
diff --git a/src/m68k/ffi.c b/src/m68k/ffi.c
index 600cf20..0d4df1e 100644
--- a/src/m68k/ffi.c
+++ b/src/m68k/ffi.c
@@ -9,8 +9,12 @@
 
 #include <stdlib.h>
 #include <unistd.h>
+#ifdef __rtems__
+void rtems_cache_flush_multiple_data_lines( const void *, size_t );
+#else
 #include <sys/syscall.h>
 #include <asm/cachectl.h>
+#endif
 
 void ffi_call_SYSV (extended_cif *,
 		    unsigned, unsigned,
@@ -144,9 +148,11 @@ ffi_prep_cif_machdep (ffi_cif *cif)
       cif->flags = CIF_FLAGS_DOUBLE;
       break;
 
+#if (FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE)
     case FFI_TYPE_LONGDOUBLE:
       cif->flags = CIF_FLAGS_LDOUBLE;
       break;
+#endif
 
     case FFI_TYPE_POINTER:
       cif->flags = CIF_FLAGS_POINTER;
@@ -266,8 +272,12 @@ ffi_prep_closure_loc (ffi_closure* closure,
   else
     *(void **)(closure->tramp + 8) = ffi_closure_SYSV;
 
+#ifdef __rtems__
+  rtems_cache_flush_multiple_data_lines( codeloc, FFI_TRAMPOLINE_SIZE );
+#else
   syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE,
 	  FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE);
+#endif
 
   closure->cif  = cif;
   closure->user_data = user_data;
diff --git a/src/m68k/sysv.S b/src/m68k/sysv.S
index 58822e0..c782f51 100644
--- a/src/m68k/sysv.S
+++ b/src/m68k/sysv.S
@@ -1,4 +1,5 @@
 /* -----------------------------------------------------------------------
+	
    sysv.S - Copyright (c) 1998 Andreas Schwab
 	    Copyright (c) 2008 Red Hat, Inc. 
    
@@ -85,7 +86,12 @@ ffi_call_SYSV:
 	move.l	16(%fp),%d2
 
 	| If the return value pointer is NULL, assume no return value.
+	| NOTE: On the mc68000, tst on an address register is not supported.
+#if defined(__mc68000__) && !defined(__mcoldfire__)
+	cmp.w	#0, %a1
+#else
 	tst.l	%a1
+#endif
 	jbeq	noretval
 
 	btst	#0,%d2
@@ -103,19 +109,34 @@ retlongint:
 retfloat:
 	btst	#2,%d2
 	jbeq	retdouble
+#if defined(__MC68881__)
 	fmove.s	%fp0,(%a1)
+#else
+	move.l	%d0,(%a1)
+#endif
 	jbra	epilogue
 
 retdouble:
 	btst	#3,%d2
 	jbeq	retlongdouble
+#if defined(__MC68881__)
 	fmove.d	%fp0,(%a1)
+#else
+	move.l	%d0,(%a1)+
+	move.l	%d1,(%a1)
+#endif
 	jbra	epilogue
 
 retlongdouble:
 	btst	#4,%d2
 	jbeq	retpointer
+#if defined(__MC68881__)
 	fmove.x	%fp0,(%a1)
+#else
+	move.l	%d0,(%a1)+
+	move.l	%d1,(%a1)+
+	move.l	%d2,(%a1)
+#endif
 	jbra	epilogue
 
 retpointer:
@@ -178,16 +199,31 @@ ffi_closure_SYSV:
 	move.l	(%a0),%d1
 	jra	.Lcls_epilogue
 .Lcls_ret_float:
+#if defined(__MC68881__)
 	fmove.s	(%a0),%fp0
+#else
+	move.l	(%a0),%d0
+#endif
 	jra	.Lcls_epilogue
 1:
 	lsr.l	#2,%d0
 	jne	1f
 	jcs	.Lcls_ret_ldouble
+#if defined(__MC68881__)
 	fmove.d	(%a0),%fp0
+#else
+	move.l	(%a0)+,%d0
+	move.l	(%a0),%d1
+#endif
 	jra	.Lcls_epilogue
 .Lcls_ret_ldouble:
+#if defined(__MC68881__)
 	fmove.x	(%a0),%fp0
+#else
+	move.l	(%a0)+,%d0
+	move.l	(%a0)+,%d1
+	move.l	(%a0),%d2
+#endif
 	jra	.Lcls_epilogue
 1:
 	lsr.l	#2,%d0
diff --git a/src/mips/ffitarget.h b/src/mips/ffitarget.h
index d70197c..4c247b8 100644
--- a/src/mips/ffitarget.h
+++ b/src/mips/ffitarget.h
@@ -29,9 +29,17 @@
 
 #ifdef linux
 # include <asm/sgidefs.h>
+#elif defined(__rtems__)
+/*
+ * Subprogram calling convention - copied from sgidefs.h
+ */
+#define _MIPS_SIM_ABI32		1
+#define _MIPS_SIM_NABI32	2
+#define _MIPS_SIM_ABI64		3
 #else
 # include <sgidefs.h>
 #endif
+
 #  ifndef _ABIN32
 #    define _ABIN32 _MIPS_SIM_NABI32
 #  endif
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index 14f6951..5b4eccf 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -167,7 +167,6 @@ psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
 sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@