]> git.pld-linux.org Git - packages/crossm68k-gcc.git/blob - crossm68k-gcc-full.patch
- for crossm68k-gcc-2.95.3
[packages/crossm68k-gcc.git] / crossm68k-gcc-full.patch
1 #
2 # This patch can be found at http://www.uclinux.org/pub/uClinux/m68k-elf-tools/
3 #
4 diff -u -r gcc-2.95.3-orig/ChangeLog gcc-2.95.3/ChangeLog
5 --- gcc-2.95.3-orig/ChangeLog   Fri Mar 16 22:52:01 2001
6 +++ gcc-2.95.3/ChangeLog        Tue Feb 26 06:52:47 2002
7 @@ -2,6 +2,11 @@
8  
9         * gcc-2.95.3 Released.
10  
11 + Tue Feb 13 08:08:47 EST 2001 Paul Dale (pauli@lineo.com)
12
13 +       * invoke.teki: Added documentation for the -msep-data and
14 +       -mno-sep-data m68k specific options.
15
16  Tue Mar  7 21:48:55 2000  Jeffrey A Law  (law@cygnus.com)
17  
18         * config.guess: Fix detection of ReliantUNIX.
19 diff -u -r gcc-2.95.3-orig/gcc/ChangeLog gcc-2.95.3/gcc/ChangeLog
20 --- gcc-2.95.3-orig/gcc/ChangeLog       Fri Mar 16 22:52:02 2001
21 +++ gcc-2.95.3/gcc/ChangeLog    Tue Feb 26 06:52:47 2002
22 @@ -27,6 +27,32 @@
23         * expr.h (expand_builtin_setjmp, expand_builtin_setjmp_receiver):
24         Likewise.
25  
26 +2001-02-13  Paul Dale  <pauli@lineo.com>
27
28 +       * lb1sf68.asm: Support build of libgcc.a for position
29 +       independent code.
30 +       * m68k-none.h (CPP_SPEC): Define __pic__ and __PIC__ when
31 +       generating position independent code.
32 +       * m68k.c (override_options): Enable -fPIC when -msep-data
33 +       is active.
34 +       * m68k.c (output_function_prologue): Disable A5 save/restore
35 +       code generation when -msep-data is active.
36 +       * m68k.c (output_function_epilogue): Disable A5 restore code
37 +       generation when -msep-data is active.
38 +       * m68k.c (legitimize_pic_address): Don't mark A5 as live if
39 +       the -msep-data option is active.
40 +       * m68k.h: Define the -msep-data and -mno-sep-data options.
41 +       * m68k.h (OVERRIDE_OPTIONS): Allow -fPIC on targets below 68020 and
42 +       enable function common subexpressions if generating position
43 +       independent code that calls functions via the global offset table.
44 +       * m68k.md: Modified PIC call sequences for sub 68020 targets to
45 +       either determine relative address inline or to call functions via
46 +       the global offset table.
47 +       * m68kelf.h (OVERRIDE_OPTIONS): Support -fPIC on sub 68020 targets,
48 +       enable function CSE when calling procedures via the GOT and
49 +       include call to override_options().
50 +       * t-m68kelf: Enable multilib build of -msep-data libraries.
51
52  2001-01-25  Bernd Schmidt  <bernds@redhat.co.uk>
53  
54         * version.c: Bump.
55 diff -u -r gcc-2.95.3-orig/gcc/config/m68k/lb1sf68.asm gcc-2.95.3/gcc/config/m68k/lb1sf68.asm
56 --- gcc-2.95.3-orig/gcc/config/m68k/lb1sf68.asm Tue Mar  2 01:06:44 1999
57 +++ gcc-2.95.3/gcc/config/m68k/lb1sf68.asm      Tue Feb 26 06:52:47 2002
58 @@ -86,6 +86,36 @@
59  #define a6 REG (a6)
60  #define fp REG (fp)
61  #define sp REG (sp)
62 +#define pc REG (pc)
63 +
64 +/* Provide a few macros to allow for PIC code support.
65 + * With PIC, data is stored A5 relative so we've got to take a bit of special
66 + * care to ensure that all loads of global data is via A5.  PIC also requires
67 + * jumps and subroutine calls to be PC relative rather than absolute.  We cheat
68 + * a little on this and in the PIC case, we use short offset branches and
69 + * hope that the final object code is within range (which it should be).
70 + */
71 +#ifndef __PIC__
72 +/* Non pic (absolute/relocatable) versions */
73 +#define LEA(sym,reg)   lea     sym, reg
74 +#define PEA(sym,areg)  pea     sym
75 +#define CALL(addr)     jbsr    addr
76 +#define JUMP(addr)     jmp     addr
77 +#else
78 +#ifdef __ID_SHARED_LIBRARY__
79 +/* shared library version */
80 +#define LEA(sym,reg)   movel   a5@(_current_shared_library_a5_offset_), reg;   \
81 +                       movel   CONCAT1(sym, @GOT(reg)), reg
82 +#define PEA(sym,areg)  movel   a5@(_current_shared_library_a5_offset_), areg;  \
83 +                       movel CONCAT1(sym, @GOT(areg)), sp@-
84 +#else
85 +/* msep-data version */
86 +#define LEA(sym,reg)   movel   CONCAT1(sym, @GOT(a5)), reg
87 +#define PEA(sym,areg)  movel   CONCAT1(sym, @GOT(a5)), sp@-
88 +#endif
89 +#define CALL(addr)     bsr     addr
90 +#define JUMP(addr)     bra     addr
91 +#endif
92  
93  #ifdef L_floatex
94  
95 @@ -213,7 +243,7 @@
96  
97  | void __clear_sticky_bits(void);
98  SYM (__clear_sticky_bit):              
99 -       lea     SYM (_fpCCR),a0
100 +       LEA(    SYM (_fpCCR),a0)
101  #ifndef __mcf5200__
102         movew   IMM (0),a0@(STICK)
103  #else
104 @@ -246,7 +276,7 @@
105  FPTRAP = 15
106  
107  $_exception_handler:
108 -       lea     SYM (_fpCCR),a0
109 +       LEA(    SYM (_fpCCR),a0)
110         movew   d7,a0@(EBITS)   | set __exception_bits
111  #ifndef __mcf5200__
112         orw     d7,a0@(STICK)   | and __sticky_bits
113 @@ -282,7 +312,7 @@
114         andl    d6,d7
115  #endif
116         beq     1f              | no, exit
117 -       pea     SYM (_fpCCR)    | yes, push address of _fpCCR
118 +       PEA(    SYM (_fpCCR),a1)| yes, push address of _fpCCR
119         trap    IMM (FPTRAP)    | and trap
120  #ifndef __mcf5200__
121  1:     moveml  sp@+,d2-d7      | restore data registers
122 @@ -421,7 +451,7 @@
123  
124  L2:    movel   d1, sp@-
125         movel   d0, sp@-
126 -       jbsr    SYM (__udivsi3) /* divide abs(dividend) by abs(divisor) */
127 +       CALL(   SYM (__udivsi3))/* divide abs(dividend) by abs(divisor) */
128         addql   IMM (8), sp
129  
130         tstb    d2
131 @@ -441,13 +471,13 @@
132         movel   sp@(4), d0      /* d0 = dividend */
133         movel   d1, sp@-
134         movel   d0, sp@-
135 -       jbsr    SYM (__udivsi3)
136 +       CALL(   SYM (__udivsi3))
137         addql   IMM (8), sp
138         movel   sp@(8), d1      /* d1 = divisor */
139  #ifndef __mcf5200__
140         movel   d1, sp@-
141         movel   d0, sp@-
142 -       jbsr    SYM (__mulsi3)  /* d0 = (a/b)*b */
143 +       CALL(   SYM (__mulsi3)) /* d0 = (a/b)*b */
144         addql   IMM (8), sp
145  #else
146         mulsl   d1,d0
147 @@ -467,13 +497,13 @@
148         movel   sp@(4), d0      /* d0 = dividend */
149         movel   d1, sp@-
150         movel   d0, sp@-
151 -       jbsr    SYM (__divsi3)
152 +       CALL(   SYM (__divsi3))
153         addql   IMM (8), sp
154         movel   sp@(8), d1      /* d1 = divisor */
155  #ifndef __mcf5200__
156         movel   d1, sp@-
157         movel   d0, sp@-
158 -       jbsr    SYM (__mulsi3)  /* d0 = (a/b)*b */
159 +       CALL(   SYM (__mulsi3)) /* d0 = (a/b)*b */
160         addql   IMM (8), sp
161  #else
162         mulsl   d1,d0
163 @@ -540,7 +570,7 @@
164         orl     d7,d0
165         movew   IMM (INEXACT_RESULT+UNDERFLOW),d7
166         moveq   IMM (DOUBLE_FLOAT),d6
167 -       jmp     $_exception_handler
168 +       JUMP(   $_exception_handler)
169  
170  Ld$infty:
171  Ld$overflow:
172 @@ -550,7 +580,7 @@
173         orl     d7,d0
174         movew   IMM (INEXACT_RESULT+OVERFLOW),d7
175         moveq   IMM (DOUBLE_FLOAT),d6
176 -       jmp     $_exception_handler
177 +       JUMP(   $_exception_handler)
178  
179  Ld$underflow:
180  | Return 0 and set the exception flags 
181 @@ -558,7 +588,7 @@
182         movel   d0,d1
183         movew   IMM (INEXACT_RESULT+UNDERFLOW),d7
184         moveq   IMM (DOUBLE_FLOAT),d6
185 -       jmp     $_exception_handler
186 +       JUMP(   $_exception_handler)
187  
188  Ld$inop:
189  | Return a quiet NaN and set the exception flags
190 @@ -566,7 +596,7 @@
191         movel   d0,d1
192         movew   IMM (INEXACT_RESULT+INVALID_OPERATION),d7
193         moveq   IMM (DOUBLE_FLOAT),d6
194 -       jmp     $_exception_handler
195 +       JUMP(   $_exception_handler)
196  
197  Ld$div$0:
198  | Return a properly signed INFINITY and set the exception flags
199 @@ -575,7 +605,7 @@
200         orl     d7,d0
201         movew   IMM (INEXACT_RESULT+DIVIDE_BY_ZERO),d7
202         moveq   IMM (DOUBLE_FLOAT),d6
203 -       jmp     $_exception_handler
204 +       JUMP(   $_exception_handler)
205  
206  |=============================================================================
207  |=============================================================================
208 @@ -1015,8 +1045,8 @@
209         addl    IMM (1),d4
210  #endif
211  1:
212 -       lea     Ladddf$5,a0     | to return from rounding routine
213 -       lea     SYM (_fpCCR),a1 | check the rounding mode
214 +       lea     pc@(Ladddf$5),a0 | to return from rounding routine
215 +       LEA(    SYM (_fpCCR),a1)| check the rounding mode
216  #ifdef __mcf5200__
217         clrl    d6
218  #endif
219 @@ -1123,8 +1153,8 @@
220         addl    IMM (1),d4
221  #endif
222  1:
223 -       lea     Lsubdf$1,a0     | to return from rounding routine
224 -       lea     SYM (_fpCCR),a1 | check the rounding mode
225 +       lea     pc@(Lsubdf$1),a0 | to return from rounding routine
226 +       LEA(    SYM (_fpCCR),a1)| check the rounding mode
227  #ifdef __mcf5200__
228         clrl    d6
229  #endif
230 @@ -1168,7 +1198,7 @@
231  #endif
232         movel   a6@(16),d0
233         movel   a6@(20),d1
234 -       lea     SYM (_fpCCR),a0
235 +       LEA(    SYM (_fpCCR),a0)
236         movew   IMM (0),a0@
237  #ifndef __mcf5200__
238         moveml  sp@+,d2-d7      | restore data registers
239 @@ -1190,7 +1220,7 @@
240  #endif
241         movel   a6@(8),d0
242         movel   a6@(12),d1
243 -       lea     SYM (_fpCCR),a0
244 +       LEA(    SYM (_fpCCR),a0)
245         movew   IMM (0),a0@
246  #ifndef __mcf5200__
247         moveml  sp@+,d2-d7      | restore data registers
248 @@ -1248,7 +1278,7 @@
249  
250  Ladddf$ret:
251  | Normal exit.
252 -       lea     SYM (_fpCCR),a0
253 +       LEA(    SYM (_fpCCR),a0)
254         movew   IMM (0),a0@
255         orl     d7,d0           | put sign bit back
256  #ifndef __mcf5200__
257 @@ -1610,7 +1640,7 @@
258         bclr    IMM (31),d2     | clear sign bit
259  1:     cmpl    IMM (0x7ff00000),d2 | check for non-finiteness
260         bge     Ld$inop         | in case NaN or +/-INFINITY return NaN
261 -       lea     SYM (_fpCCR),a0
262 +       LEA(    SYM (_fpCCR),a0)
263         movew   IMM (0),a0@
264  #ifndef __mcf5200__
265         moveml  sp@+,d2-d7
266 @@ -1895,7 +1925,7 @@
267         bne     Ld$inop         |
268  1:     movel   IMM (0),d0      | else return zero
269         movel   d0,d1           | 
270 -       lea     SYM (_fpCCR),a0 | clear exception flags
271 +       LEA(    SYM (_fpCCR),a0)| clear exception flags
272         movew   IMM (0),a0@     |
273  #ifndef __mcf5200__
274         moveml  sp@+,d2-d7      | 
275 @@ -2035,8 +2065,8 @@
276         orl     d7,d3           | the bits which were flushed right
277         movel   a0,d7           | get back sign bit into d7
278  | Now call the rounding routine (which takes care of denormalized numbers):
279 -       lea     Lround$0,a0     | to return from rounding routine
280 -       lea     SYM (_fpCCR),a1 | check the rounding mode
281 +       lea     pc@(Lround$0),a0 | to return from rounding routine
282 +       LEA(    SYM (_fpCCR),a1)| check the rounding mode
283  #ifdef __mcf5200__
284         clrl    d6
285  #endif
286 @@ -2084,7 +2114,7 @@
287         swap    d0              |
288         orl     d7,d0           | and sign also
289  
290 -       lea     SYM (_fpCCR),a0
291 +       LEA(    SYM (_fpCCR),a0)
292         movew   IMM (0),a0@
293  #ifndef __mcf5200__
294         moveml  sp@+,d2-d7
295 @@ -2126,7 +2156,7 @@
296         movel   d0,d7           | else get sign and return INFINITY
297         andl    IMM (0x80000000),d7
298         bra     Ld$infty                
299 -1:     lea     SYM (_fpCCR),a0
300 +1:     LEA(    SYM (_fpCCR),a0)
301         movew   IMM (0),a0@
302  #ifndef __mcf5200__
303         moveml  sp@+,d2-d7
304 @@ -2424,7 +2454,7 @@
305         orl     d7,d0
306         movew   IMM (INEXACT_RESULT+UNDERFLOW),d7
307         moveq   IMM (SINGLE_FLOAT),d6
308 -       jmp     $_exception_handler
309 +       JUMP(   $_exception_handler)
310  
311  Lf$infty:
312  Lf$overflow:
313 @@ -2433,21 +2463,21 @@
314         orl     d7,d0
315         movew   IMM (INEXACT_RESULT+OVERFLOW),d7
316         moveq   IMM (SINGLE_FLOAT),d6
317 -       jmp     $_exception_handler
318 +       JUMP(   $_exception_handler)
319  
320  Lf$underflow:
321  | Return 0 and set the exception flags 
322         movel   IMM (0),d0
323         movew   IMM (INEXACT_RESULT+UNDERFLOW),d7
324         moveq   IMM (SINGLE_FLOAT),d6
325 -       jmp     $_exception_handler
326 +       JUMP(   $_exception_handler)
327  
328  Lf$inop:
329  | Return a quiet NaN and set the exception flags
330         movel   IMM (QUIET_NaN),d0
331         movew   IMM (INEXACT_RESULT+INVALID_OPERATION),d7
332         moveq   IMM (SINGLE_FLOAT),d6
333 -       jmp     $_exception_handler
334 +       JUMP(   $_exception_handler)
335  
336  Lf$div$0:
337  | Return a properly signed INFINITY and set the exception flags
338 @@ -2455,7 +2485,7 @@
339         orl     d7,d0
340         movew   IMM (INEXACT_RESULT+DIVIDE_BY_ZERO),d7
341         moveq   IMM (SINGLE_FLOAT),d6
342 -       jmp     $_exception_handler
343 +       JUMP(   $_exception_handler)
344  
345  |=============================================================================
346  |=============================================================================
347 @@ -2737,8 +2767,8 @@
348  #endif
349         addl    IMM (1),d2
350  1:
351 -       lea     Laddsf$4,a0     | to return from rounding routine
352 -       lea     SYM (_fpCCR),a1 | check the rounding mode
353 +       lea     pc@(Laddsf$4),a0 | to return from rounding routine
354 +       LEA(    SYM (_fpCCR),a1)| check the rounding mode
355  #ifdef __mcf5200__
356         clrl    d6
357  #endif
358 @@ -2802,8 +2832,8 @@
359  | Note that we do not have to normalize, since in the subtraction bit
360  | #FLT_MANT_DIG+1 is never set, and denormalized numbers are handled by
361  | the rounding routines themselves.
362 -       lea     Lsubsf$1,a0     | to return from rounding routine
363 -       lea     SYM (_fpCCR),a1 | check the rounding mode
364 +       lea     pc@(Lsubsf$1),a0 | to return from rounding routine
365 +       LEA(    SYM (_fpCCR),a1)| check the rounding mode
366  #ifdef __mcf5200__
367         clrl    d6
368  #endif
369 @@ -2834,7 +2864,7 @@
370  | check for finiteness or zero).
371  Laddsf$a$small:
372         movel   a6@(12),d0
373 -       lea     SYM (_fpCCR),a0
374 +       LEA(    SYM (_fpCCR),a0)
375         movew   IMM (0),a0@
376  #ifndef __mcf5200__
377         moveml  sp@+,d2-d7      | restore data registers
378 @@ -2848,7 +2878,7 @@
379  
380  Laddsf$b$small:
381         movel   a6@(8),d0
382 -       lea     SYM (_fpCCR),a0
383 +       LEA(    SYM (_fpCCR),a0)
384         movew   IMM (0),a0@
385  #ifndef __mcf5200__
386         moveml  sp@+,d2-d7      | restore data registers
387 @@ -2905,7 +2935,7 @@
388  Laddsf$ret:
389  | Normal exit (a and b nonzero, result is not NaN nor +/-infty).
390  | We have to clear the exception flags (just the exception type).
391 -       lea     SYM (_fpCCR),a0
392 +       LEA(    SYM (_fpCCR),a0)
393         movew   IMM (0),a0@
394         orl     d7,d0           | put sign bit
395  #ifndef __mcf5200__
396 @@ -3141,7 +3171,7 @@
397  1:     bclr    IMM (31),d1     | clear sign bit 
398         cmpl    IMM (INFINITY),d1 | and check for a large exponent
399         bge     Lf$inop         | if b is +/-INFINITY or NaN return NaN
400 -       lea     SYM (_fpCCR),a0 | else return zero
401 +       LEA(    SYM (_fpCCR),a0)| else return zero
402         movew   IMM (0),a0@     | 
403  #ifndef __mcf5200__
404         moveml  sp@+,d2-d7      | 
405 @@ -3341,7 +3371,7 @@
406         cmpl    IMM (INFINITY),d1       | check for NaN
407         bhi     Lf$inop                 | 
408         movel   IMM (0),d0              | else return zero
409 -       lea     SYM (_fpCCR),a0         |
410 +       LEA(    SYM (_fpCCR),a0)        |
411         movew   IMM (0),a0@             |
412  #ifndef __mcf5200__
413         moveml  sp@+,d2-d7              | 
414 @@ -3444,8 +3474,8 @@
415  2:     orl     d6,d1           | this is a trick so we don't lose  '
416                                 | the extra bits which were flushed right
417  | Now call the rounding routine (which takes care of denormalized numbers):
418 -       lea     Lround$0,a0     | to return from rounding routine
419 -       lea     SYM (_fpCCR),a1 | check the rounding mode
420 +       lea     pc@(Lround$0),a0 | to return from rounding routine
421 +       LEA(    SYM (_fpCCR),a1)| check the rounding mode
422  #ifdef __mcf5200__
423         clrl    d6
424  #endif
425 @@ -3493,7 +3523,7 @@
426         swap    d0              |
427         orl     d7,d0           | and sign also
428  
429 -       lea     SYM (_fpCCR),a0
430 +       LEA(    SYM (_fpCCR),a0)
431         movew   IMM (0),a0@
432  #ifndef __mcf5200__
433         moveml  sp@+,d2-d7
434 @@ -3534,7 +3564,7 @@
435         movel   d0,d7           | else get sign and return INFINITY
436         andl    IMM (0x80000000),d7
437         bra     Lf$infty                
438 -1:     lea     SYM (_fpCCR),a0
439 +1:     LEA(    SYM (_fpCCR),a0)
440         movew   IMM (0),a0@
441  #ifndef __mcf5200__
442         moveml  sp@+,d2-d7
443 @@ -3742,7 +3772,7 @@
444         movl    a6@(16),sp@-
445         movl    a6@(12),sp@-
446         movl    a6@(8),sp@-
447 -       jbsr    SYM (__cmpdf2)
448 +       CALL(   SYM (__cmpdf2))
449         unlk    a6
450         rts
451  #endif /* L_eqdf2 */
452 @@ -3757,7 +3787,7 @@
453         movl    a6@(16),sp@-
454         movl    a6@(12),sp@-
455         movl    a6@(8),sp@-
456 -       jbsr    SYM (__cmpdf2)
457 +       CALL(   SYM (__cmpdf2))
458         unlk    a6
459         rts
460  #endif /* L_nedf2 */
461 @@ -3772,7 +3802,7 @@
462         movl    a6@(16),sp@-
463         movl    a6@(12),sp@-
464         movl    a6@(8),sp@-
465 -       jbsr    SYM (__cmpdf2)
466 +       CALL(   SYM (__cmpdf2))
467         unlk    a6
468         rts
469  #endif /* L_gtdf2 */
470 @@ -3787,7 +3817,7 @@
471         movl    a6@(16),sp@-
472         movl    a6@(12),sp@-
473         movl    a6@(8),sp@-
474 -       jbsr    SYM (__cmpdf2)
475 +       CALL(   SYM (__cmpdf2))
476         unlk    a6
477         rts
478  #endif /* L_gedf2 */
479 @@ -3802,7 +3832,7 @@
480         movl    a6@(16),sp@-
481         movl    a6@(12),sp@-
482         movl    a6@(8),sp@-
483 -       jbsr    SYM (__cmpdf2)
484 +       CALL(   SYM (__cmpdf2))
485         unlk    a6
486         rts
487  #endif /* L_ltdf2 */
488 @@ -3817,7 +3847,7 @@
489         movl    a6@(16),sp@-
490         movl    a6@(12),sp@-
491         movl    a6@(8),sp@-
492 -       jbsr    SYM (__cmpdf2)
493 +       CALL(   SYM (__cmpdf2))
494         unlk    a6
495         rts
496  #endif /* L_ledf2 */
497 @@ -3833,7 +3863,7 @@
498         link    a6,IMM (0)
499         movl    a6@(12),sp@-
500         movl    a6@(8),sp@-
501 -       jbsr    SYM (__cmpsf2)
502 +       CALL(   SYM (__cmpsf2))
503         unlk    a6
504         rts
505  #endif /* L_eqsf2 */
506 @@ -3846,7 +3876,7 @@
507         link    a6,IMM (0)
508         movl    a6@(12),sp@-
509         movl    a6@(8),sp@-
510 -       jbsr    SYM (__cmpsf2)
511 +       CALL(   SYM (__cmpsf2))
512         unlk    a6
513         rts
514  #endif /* L_nesf2 */
515 @@ -3859,7 +3889,7 @@
516         link    a6,IMM (0)
517         movl    a6@(12),sp@-
518         movl    a6@(8),sp@-
519 -       jbsr    SYM (__cmpsf2)
520 +       CALL(   SYM (__cmpsf2))
521         unlk    a6
522         rts
523  #endif /* L_gtsf2 */
524 @@ -3872,7 +3902,7 @@
525         link    a6,IMM (0)
526         movl    a6@(12),sp@-
527         movl    a6@(8),sp@-
528 -       jbsr    SYM (__cmpsf2)
529 +       CALL(   SYM (__cmpsf2))
530         unlk    a6
531         rts
532  #endif /* L_gesf2 */
533 @@ -3885,7 +3915,7 @@
534         link    a6,IMM (0)
535         movl    a6@(12),sp@-
536         movl    a6@(8),sp@-
537 -       jbsr    SYM (__cmpsf2)
538 +       CALL(   SYM (__cmpsf2))
539         unlk    a6
540         rts
541  #endif /* L_ltsf2 */
542 @@ -3898,7 +3928,7 @@
543         link    a6,IMM (0)
544         movl    a6@(12),sp@-
545         movl    a6@(8),sp@-
546 -       jbsr    SYM (__cmpsf2)
547 +       CALL(   SYM (__cmpsf2))
548         unlk    a6
549         rts
550  #endif /* L_lesf2 */
551 diff -u -r gcc-2.95.3-orig/gcc/config/m68k/m68k-none.h gcc-2.95.3/gcc/config/m68k/m68k-none.h
552 --- gcc-2.95.3-orig/gcc/config/m68k/m68k-none.h Thu Dec 17 07:06:54 1998
553 +++ gcc-2.95.3/gcc/config/m68k/m68k-none.h      Tue Feb 26 06:52:47 2002
554 @@ -97,7 +97,7 @@
555  #undef CPP_FPU_SPEC
556  #if TARGET_DEFAULT & MASK_68881
557  #define CPP_FPU_SPEC "\
558 -%{!mc68000:%{!m68000:%{!m68302:%{!mcpu32:%{!m68332:%{!m5200:%{!msoft-float:%{!mno-68881:%{!mfpa:%{!msky:-D__HAVE_68881__ }}}}}}}}}} \
559 +%{!mc68000:%{!m68000:%{!m68302:%{!mcpu32:%{!m68332:%{!m5200:%{!m5307:%{!msoft-float:%{!mno-68881:%{!mfpa:%{!msky:-D__HAVE_68881__ }}}}}}}}}}} \
560  %{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }%{msky:-D__HAVE_SKY__ }"
561  #else
562  /* This can't currently happen, but we code it anyway to show how it's done.  */
563 @@ -126,6 +126,7 @@
564     -m68332: define mc68332 mcpu32
565     -mcpu32: define mcpu32
566     -m5200: define mcf5200
567 +   -m5307: define mcf5307
568     default: define as above appropriately
569  
570     GCC won't automatically add __'d versions, we have to mention them
571 @@ -133,9 +134,10 @@
572  
573  #undef CPP_SPEC
574  #define CPP_SPEC "\
575 -%(cpp_fpu)%{!ansi:%{m68302:-Dmc68302 }%{m68010:-Dmc68010 }%{m68020:-Dmc68020 }%{mc68020:-Dmc68020 }%{m68030:-Dmc68030 }%{m68040:-Dmc68040 }%{m68020-40:-Dmc68020 -Dmc68030 -Dmc68040 }%{m68020-60:-Dmc68020 -Dmc68030 -Dmc68040 -Dmc68060 }%{m68060:-Dmc68060 }%{mcpu32:-Dmcpu32 } %{m68332:-Dmc68332 -Dmcpu32 }%{m5200:-Dmcf5200 }} \
576 -%{m68302:-D__mc68302__ -D__mc68302 }%{m68010:-D__mc68010__ -D__mc68010 }%{m68020:-D__mc68020__ -D__mc68020 }%{mc68020:-D__mc68020__ -D__mc68020 }%{m68030:-D__mc68030__ -D__mc68030 }%{m68040:-D__mc68040__ -D__mc68040 }%{m68020-40:-D__mc68020__ -D__mc68030__ -D__mc68040__ -D__mc68020 -D__mc68030 -D__mc68040 }%{m68020-60:-D__mc68020__ -D__mc68030__ -D__mc68040__ -D__mc68020 -D__mc68030 -D__mc68040 -D__mc68060__ -D__mc68060 }%{m68060:-D__mc68060__ -D__mc68060 }%{mcpu32:-D__mcpu32__ -D__mcpu32 }%{m68332:-D__mc68332__ -D__mc68332 -D__mcpu32__ -D__mcpu32 }%{m5200:-D__mcf5200__ -D__mcf5200 } \
577 -%{!mc68000:%{!m68000:%{!m68302:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68020-60:%{!m68060:%{!mcpu32: %{!m68332:%{!m5200:%(cpp_cpu_default)}}}}}}}}}}}}}} \
578 +%(cpp_fpu)%{!ansi:%{m68302:-Dmc68302 }%{m68010:-Dmc68010 }%{m68020:-Dmc68020 }%{mc68020:-Dmc68020 }%{m68030:-Dmc68030 }%{m68040:-Dmc68040 }%{m68020-40:-Dmc68020 -Dmc68030 -Dmc68040 }%{m68020-60:-Dmc68020 -Dmc68030 -Dmc68040 -Dmc68060 }%{m68060:-Dmc68060 }%{mcpu32:-Dmcpu32 } %{m68332:-Dmc68332 -Dmcpu32 }%{m5200:-Dmcf5200 }%{m5307:-Dmcf5307 -Dmcf5200 }} \
579 +%{m68302:-D__mc68302__ -D__mc68302 }%{m68010:-D__mc68010__ -D__mc68010 }%{m68020:-D__mc68020__ -D__mc68020 }%{mc68020:-D__mc68020__ -D__mc68020 }%{m68030:-D__mc68030__ -D__mc68030 }%{m68040:-D__mc68040__ -D__mc68040 }%{m68020-40:-D__mc68020__ -D__mc68030__ -D__mc68040__ -D__mc68020 -D__mc68030 -D__mc68040 }%{m68020-60:-D__mc68020__ -D__mc68030__ -D__mc68040__ -D__mc68020 -D__mc68030 -D__mc68040 -D__mc68060__ -D__mc68060 }%{m68060:-D__mc68060__ -D__mc68060 }%{mcpu32:-D__mcpu32__ -D__mcpu32 }%{m68332:-D__mc68332__ -D__mc68332 -D__mcpu32__ -D__mcpu32 }%{m5200:-D__mcf5200__ -D__mcf5200 }%{m5307:-D__mcf5307__ -D__mcf5307 -D__mcf5200__ -D__mcf5200 } \
580 +%{!mc68000:%{!m68000:%{!m68302:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68020-60:%{!m68060:%{!mcpu32: %{!m68332:%{!m5200:%{!m5307:%(cpp_cpu_default)}}}}}}}}}}}}}}} \
581 +%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{msep-data:-D__PIC__ -D__pic__} %{mid-shared-library:-D__PIC__ -D__pic__ -D__ID_SHARED_LIBRARY__} \
582  %(cpp_subtarget) \
583  "
584  
585 @@ -143,7 +145,8 @@
586  
587  #undef ASM_SPEC
588  #define ASM_SPEC "\
589 -%{m68851}%{mno-68851}%{m68881}%{mno-68881}%{msoft-float:-mno-68881 }%{m68000}%{m68302}%{mc68000}%{m68010}%{m68020}%{mc68020}%{m68030}%{m68040}%{m68020-40:-mc68040 }%{m68020-60:-mc68040 }%{m68060}%{mcpu32}%{m68332}%{m5200}%{!mc68000:%{!m68000:%{!m68302:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68020-60:%{!m68060:%{!mcpu32:%{!m68332:%{!m5200:%(asm_cpu_default) }}}}}}}}}}}}}} \
590 +%{m68851}%{mno-68851}%{m68881}%{mno-68881}%{msoft-float:-mno-68881 }%{m68000}%{m68302}%{mc68000}%{m68010}%{m68020}%{mc68020}%{m68030}%{m68040}%{m68020-40:-mc68040 }%{m68020-60:-mc68040 }%{m68060}%{mcpu32}%{m68332}%{m5200}%{m5307}%{mhwdiv}%{mno-hwdiv}%{mmac}%{mno-mac}%{!mc68000:%{!m68000:%{!m68302:%{!m68010:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68020-40:%{!m68020-60:%{!m68060:%{!mcpu32:%{!m68332:%{!m5200:%{!m5307:%(asm_cpu_default) }}}}}}}}}}}}}}} \
591 +%{fPIC:--pcrel} %{fpic:--pcrel} %{msep-data:--pcrel}  %{mid-shared-library:--pcrel} \
592  "
593  
594  /* cc1/cc1plus always receives all the -m flags. If the specs strings above 
595 diff -u -r gcc-2.95.3-orig/gcc/config/m68k/m68k.c gcc-2.95.3/gcc/config/m68k/m68k.c
596 --- gcc-2.95.3-orig/gcc/config/m68k/m68k.c      Mon Aug  2 14:51:08 1999
597 +++ gcc-2.95.3/gcc/config/m68k/m68k.c   Tue Feb 26 08:14:52 2002
598 @@ -38,6 +38,17 @@
599  /* Needed for use_return_insn.  */
600  #include "flags.h"
601  
602 +#define MUST_SAVE_REGISTER(regno)                                      \
603 + (! TREE_THIS_VOLATILE (current_function_decl)                         \
604 +   && (regno != STACK_POINTER_REGNUM)                                  \
605 +   /* Save any call saved register that was used.  */                  \
606 +   && (regs_ever_live[regno] && !call_used_regs[regno])                        \
607 +   /* Save any register used in an interrupt handler.   */             \
608 +   || (regs_ever_live[regno] && interrupt_handler)                     \
609 +   /* Save call clobbered registers in non-leaf interrupt handlers. */ \
610 +   || (call_used_regs[regno] && interrupt_handler && !current_function_is_leaf))
611
612 +
613  #ifdef SUPPORT_SUN_FPA
614  
615  /* Index into this array by (register number >> 3) to find the
616 @@ -63,6 +74,8 @@
617  const char *m68k_align_jumps_string;
618  /* Specify power of two alignment used for functions. */
619  const char *m68k_align_funcs_string;
620 +/* Specified the identification number of the library being built */
621 +const char *m68k_library_id_string;
622  
623  /* Specify power of two alignment used for loops. */
624  int m68k_align_loops;
625 @@ -70,6 +83,8 @@
626  int m68k_align_jumps;
627  /* Specify power of two alignment used for functions. */
628  int m68k_align_funcs;
629 +/* Specify library identification number */
630 +int m68k_library_id;
631  
632  /* Nonzero if the last compare/test insn had FP operands.  The
633     sCC expanders peek at this to determine what to do for the
634 @@ -124,6 +139,32 @@
635      }
636    else
637      m68k_align_funcs = def_align;
638 +
639 +  /* Library identification */
640 +  if (m68k_library_id_string)
641 +    {
642 +      if (! TARGET_ID_SHARED_LIBRARY)
643 +       fatal("-mshared-library-id= specified without -mid-shared-library");
644 +      m68k_library_id = atoi (m68k_library_id_string);
645 +      if (m68k_library_id < 0 || m68k_library_id > MAX_LIBRARY_ID)
646 +       fatal ("-mshared-library-id=%d is not between 0 and %d",
647 +              m68k_library_id, MAX_LIBRARY_ID);
648 +    }
649 +  else
650 +    m68k_library_id = -1;
651 +
652 +  /* Sanity check to ensure that msep-data and mid-sahred-library are not
653 +   * both specified together.  Doing so simply doesn't make sense.
654 +   */
655 +  if (TARGET_SEP_DATA && TARGET_ID_SHARED_LIBRARY)
656 +    fatal("cannot specify both -msep-data and -mid-sahred-library");
657 +
658 +  /* If we're generating code for a separate A5 relative data segment,
659 +   * we've got to enable -fPIC as well.  This might be relaxable to
660 +   * -fpic but it hasn't been tested properly.
661 +   */
662 +  if (TARGET_SEP_DATA || TARGET_ID_SHARED_LIBRARY)
663 +    flag_pic = 2;
664  }
665  \f
666  /* This function generates the assembly code for function entry.
667 @@ -150,6 +191,7 @@
668    extern char call_used_regs[];
669    int fsize = (size + 3) & -4;
670    int cfa_offset = INCOMING_FRAME_SP_OFFSET, cfa_store_offset = cfa_offset;
671 +  int interrupt_handler = m68k_interrupt_function_p (current_function_decl);
672    
673  
674    if (frame_pointer_needed)
675 @@ -287,7 +329,7 @@
676      }
677  #ifdef SUPPORT_SUN_FPA
678    for (regno = 24; regno < 56; regno++)
679 -    if (regs_ever_live[regno] && ! call_used_regs[regno])
680 +    if (MUST_SAVE_REGISTER(regno))
681        {
682  #ifdef MOTOROLA
683         asm_fprintf (stream, "\tfpmovd %s,-(%Rsp)\n",
684 @@ -313,7 +355,7 @@
685    if (TARGET_68881)
686      {
687        for (regno = 16; regno < 24; regno++)
688 -       if (regs_ever_live[regno] && ! call_used_regs[regno])
689 +       if (MUST_SAVE_REGISTER(regno))
690           {
691             mask |= 1 << (regno - 16);
692             num_saved_regs++;
693 @@ -346,7 +388,7 @@
694        num_saved_regs = 0;
695      }
696    for (regno = 0; regno < 16; regno++)
697 -    if (regs_ever_live[regno] && ! call_used_regs[regno])
698 +    if (MUST_SAVE_REGISTER(regno))
699        {
700          mask |= 1 << (15 - regno);
701          num_saved_regs++;
702 @@ -356,7 +398,9 @@
703        mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM));
704        num_saved_regs--;
705      }
706 -  if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
707 +  if (! TARGET_SEP_DATA && flag_pic &&
708 +                 (regs_ever_live[PIC_OFFSET_TABLE_REGNUM] ||
709 +                  ( ! current_function_is_leaf && TARGET_ID_SHARED_LIBRARY)))
710      {
711        mask |= 1 << (15 - PIC_OFFSET_TABLE_REGNUM);
712        num_saved_regs++;
713 @@ -462,18 +506,39 @@
714                                   -cfa_store_offset + n_regs++ * 4);
715         }
716      }
717 -  if (flag_pic && current_function_uses_pic_offset_table)
718 +  if (! TARGET_SEP_DATA && flag_pic &&
719 +                 (current_function_uses_pic_offset_table ||
720 +                  ( ! current_function_is_leaf && TARGET_ID_SHARED_LIBRARY)))
721      {
722 +      if (! TARGET_ID_SHARED_LIBRARY)
723 +       {
724  #ifdef MOTOROLA
725 -      asm_fprintf (stream, "\t%Olea (%Rpc, %U_GLOBAL_OFFSET_TABLE_@GOTPC), %s\n",
726 -                  reg_names[PIC_OFFSET_TABLE_REGNUM]);
727 +         asm_fprintf (stream, "\t%Olea (%Rpc, %U_GLOBAL_OFFSET_TABLE_@GOTPC), %s\n",
728 +                      reg_names[PIC_OFFSET_TABLE_REGNUM]);
729  #else
730 -      asm_fprintf (stream, "\tmovel %0I__GLOBAL_OFFSET_TABLE_, %s\n",
731 -                  reg_names[PIC_OFFSET_TABLE_REGNUM]);
732 -      asm_fprintf (stream, "\tlea %Rpc@(0,%s:l),%s\n",
733 -                  reg_names[PIC_OFFSET_TABLE_REGNUM],
734 -                  reg_names[PIC_OFFSET_TABLE_REGNUM]);
735 +         asm_fprintf (stream, "\tmovel %0I__GLOBAL_OFFSET_TABLE_, %s\n",
736 +                      reg_names[PIC_OFFSET_TABLE_REGNUM]);
737 +         asm_fprintf (stream, "\tlea %Rpc@(0,%s:l),%s\n",
738 +                      reg_names[PIC_OFFSET_TABLE_REGNUM],
739 +                      reg_names[PIC_OFFSET_TABLE_REGNUM]);
740  #endif
741 +       }
742 +      else
743 +       {
744 +         if (m68k_library_id > 0)
745 +           {
746 +             asm_fprintf (stream, "\tmovel %s@(%d), %s\n",
747 +                          reg_names[PIC_OFFSET_TABLE_REGNUM],
748 +                          m68k_library_id * -4 - 4,
749 +                          reg_names[PIC_OFFSET_TABLE_REGNUM]);
750 +           }
751 +         else
752 +           {
753 +             asm_fprintf (stream, "\tmovel %s@(_current_shared_library_a5_offset_), %s\n",
754 +                          reg_names[PIC_OFFSET_TABLE_REGNUM],
755 +                          reg_names[PIC_OFFSET_TABLE_REGNUM]);
756 +           }
757 +       }
758      }
759  }
760  \f
761 @@ -483,15 +554,23 @@
762  use_return_insn ()
763  {
764    int regno;
765 +  int interrupt_handler = m68k_interrupt_function_p (current_function_decl);
766  
767    if (!reload_completed || frame_pointer_needed || get_frame_size () != 0)
768      return 0;
769    
770 +  /* Check for needing a5 for PIC duties and thus epilogue... */
771 +  if (! TARGET_SEP_DATA && flag_pic &&
772 +                 (regs_ever_live[PIC_OFFSET_TABLE_REGNUM] ||
773 +                  current_function_uses_pic_offset_table ||
774 +                  ( ! current_function_is_leaf && TARGET_ID_SHARED_LIBRARY)))
775 +    return 0;
776 +  
777    /* Copied from output_function_epilogue ().  We should probably create a
778       separate layout routine to perform the common work.  */
779    
780    for (regno = 0 ; regno < FIRST_PSEUDO_REGISTER ; regno++)
781 -    if (regs_ever_live[regno] && ! call_used_regs[regno])
782 +    if (MUST_SAVE_REGISTER(regno))
783        return 0;
784    
785    return 1;
786 @@ -519,6 +598,7 @@
787    int big = 0;
788    rtx insn = get_last_insn ();
789    int restore_from_sp = 0;
790 +  int interrupt_handler = m68k_interrupt_function_p (current_function_decl);
791    
792    /* If the last insn was a BARRIER, we don't have to write any code.  */
793    if (GET_CODE (insn) == NOTE)
794 @@ -544,7 +624,7 @@
795    nregs = 0;  fmask = 0; fpoffset = 0;
796  #ifdef SUPPORT_SUN_FPA
797    for (regno = 24 ; regno < 56 ; regno++)
798 -    if (regs_ever_live[regno] && ! call_used_regs[regno])
799 +    if (MUST_SAVE_REGISTER(regno))
800        nregs++;
801    fpoffset = nregs * 8;
802  #endif
803 @@ -552,7 +632,7 @@
804    if (TARGET_68881)
805      {
806        for (regno = 16; regno < 24; regno++)
807 -       if (regs_ever_live[regno] && ! call_used_regs[regno])
808 +       if (MUST_SAVE_REGISTER(regno))
809           {
810             nregs++;
811             fmask |= 1 << (23 - regno);
812 @@ -563,12 +643,14 @@
813    if (frame_pointer_needed)
814      regs_ever_live[FRAME_POINTER_REGNUM] = 0;
815    for (regno = 0; regno < 16; regno++)
816 -    if (regs_ever_live[regno] && ! call_used_regs[regno])
817 +    if (MUST_SAVE_REGISTER(regno))
818        {
819          nregs++;
820         mask |= 1 << regno;
821        }
822 -  if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
823 +  if (! TARGET_SEP_DATA && flag_pic &&
824 +                 (regs_ever_live[PIC_OFFSET_TABLE_REGNUM] ||
825 +                  ( ! current_function_is_leaf && TARGET_ID_SHARED_LIBRARY)))
826      {
827        nregs++;
828        mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
829 @@ -583,14 +665,28 @@
830        && ! restore_from_sp
831        && (mask || fmask || fpoffset))
832      {
833 +      /* Because the ColdFire doesn't support moveml with
834 +         complex address modes we make an extra correction here */
835 +      if (TARGET_5200)
836 +        {
837 +#ifdef MOTOROLA
838 +          asm_fprintf (stream, "\t%Omove.l %0I%d,%Ra1\n", -fsize - offset);
839 +#else
840 +          asm_fprintf (stream, "\tmovel %0I%d,%Ra1\n", -fsize - offset );
841 +#endif
842 +        }
843 +      else
844 +        {
845  #ifdef MOTOROLA
846 -      asm_fprintf (stream, "\t%Omove.l %0I%d,%Ra1\n", -fsize);
847 +          asm_fprintf (stream, "\t%Omove.l %0I%d,%Ra1\n", -fsize);
848  #else
849 -      asm_fprintf (stream, "\tmovel %0I%d,%Ra1\n", -fsize);
850 +          asm_fprintf (stream, "\tmovel %0I%d,%Ra1\n", -fsize);
851  #endif
852 +        }
853 +
854        fsize = 0, big = 1;
855      }
856 -  if (TARGET_5200 || nregs <= 2)
857 +  if (nregs <= 2)
858      {
859        /* Restore each separately in the same order moveml does.
860           Using two movel instructions instead of a single moveml
861 @@ -644,41 +740,85 @@
862      }
863    else if (mask)
864      {
865 -      if (big)
866 -       {
867 +      /* The ColdFire requires special handling due to its limited moveml insn */
868 +      if (TARGET_5200)
869 +        {
870 +
871 +          if (big)
872 +            {
873  #ifdef MOTOROLA
874 -         asm_fprintf (stream, "\tmovm.l -%d(%s,%Ra1.l),%0I0x%x\n",
875 -                      offset + fsize,
876 -                      reg_names[FRAME_POINTER_REGNUM],
877 -                      mask);
878 +              asm_fprintf (stream, "\tadd.l %s,%Ra1\n", reg_names[FRAME_POINTER_REGNUM]);
879 +              asm_fprintf (stream, "\tmovm.l (%Ra1),%0I0x%x\n", mask);
880  #else
881 -         asm_fprintf (stream, "\tmoveml %s@(-%d,%Ra1:l),%0I0x%x\n",
882 -                      reg_names[FRAME_POINTER_REGNUM],
883 -                      offset + fsize, mask);
884 +              asm_fprintf (stream, "\taddl %s,%Ra1\n", reg_names[FRAME_POINTER_REGNUM]);
885 +              asm_fprintf (stream, "\tmoveml %Ra1@,%0I0x%x\n", mask);
886  #endif
887 -       }
888 -      else if (restore_from_sp)
889 -       {
890 +            }
891 +          else if (restore_from_sp)
892 +            {
893  #ifdef MOTOROLA
894 -         asm_fprintf (stream, "\tmovm.l (%Rsp)+,%0I0x%x\n", mask);
895 +              asm_fprintf (stream, "\tmovm.l (%Rsp),%0I0x%x\n", mask);
896 +              asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", nregs*4);
897  #else
898 -         asm_fprintf (stream, "\tmoveml %Rsp@+,%0I0x%x\n", mask);
899 +              asm_fprintf (stream, "\tmoveml %Rsp@,%0I0x%x\n", mask);
900 +              asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", nregs*4);
901  #endif
902 -       }
903 +
904 +            }
905 +          else
906 +            {
907 +#ifdef MOTOROLA
908 +              asm_fprintf (stream, "\tmovm.l -%d(%s),%0I0x%x\n",
909 +                           offset + fsize,
910 +                           reg_names[FRAME_POINTER_REGNUM],
911 +                           mask);
912 +#else
913 +              asm_fprintf (stream, "\tmoveml %s@(-%d),%0I0x%x\n",
914 +                           reg_names[FRAME_POINTER_REGNUM],
915 +                           offset + fsize, mask);
916 +#endif
917 +           }
918 +
919 +        }
920        else
921 -       {
922 +        {
923 +          if (big)
924 +            {
925  #ifdef MOTOROLA
926 -         asm_fprintf (stream, "\tmovm.l -%d(%s),%0I0x%x\n",
927 -                      offset + fsize,
928 -                      reg_names[FRAME_POINTER_REGNUM],
929 -                      mask);
930 +              asm_fprintf (stream, "\tmovm.l -%d(%s,%Ra1.l),%0I0x%x\n",
931 +                           offset + fsize,
932 +                           reg_names[FRAME_POINTER_REGNUM],
933 +                           mask);
934  #else
935 -         asm_fprintf (stream, "\tmoveml %s@(-%d),%0I0x%x\n",
936 -                      reg_names[FRAME_POINTER_REGNUM],
937 -                      offset + fsize, mask);
938 +              asm_fprintf (stream, "\tmoveml %s@(-%d,%Ra1:l),%0I0x%x\n",
939 +                           reg_names[FRAME_POINTER_REGNUM],
940 +                           offset + fsize, mask);
941  #endif
942 -       }
943 -    }
944 +            }
945 +          else if (restore_from_sp)
946 +            {
947 +#ifdef MOTOROLA
948 +              asm_fprintf (stream, "\tmovm.l (%Rsp)+,%0I0x%x\n", mask);
949 +#else
950 +              asm_fprintf (stream, "\tmoveml %Rsp@+,%0I0x%x\n", mask);
951 +#endif
952 +           }
953 +          else
954 +            {
955 +#ifdef MOTOROLA
956 +              asm_fprintf (stream, "\tmovm.l -%d(%s),%0I0x%x\n",
957 +                           offset + fsize,
958 +                           reg_names[FRAME_POINTER_REGNUM],
959 +                           mask);
960 +#else
961 +              asm_fprintf (stream, "\tmoveml %s@(-%d),%0I0x%x\n",
962 +                           reg_names[FRAME_POINTER_REGNUM],
963 +                           offset + fsize, mask);
964 +#endif
965 +            }
966 +      
967 +      }
968 +  }
969    if (fmask)
970      {
971        if (big)
972 @@ -718,7 +858,7 @@
973      }
974    if (fpoffset != 0)
975      for (regno = 55; regno >= 24; regno--)
976 -      if (regs_ever_live[regno] && ! call_used_regs[regno])
977 +      if (MUST_SAVE_REGISTER(regno))
978          {
979           if (big)
980             {
981 @@ -827,11 +967,18 @@
982           asm_fprintf (stream, "\taddl %0I%d,%Rsp\n", fsize + 4);
983  #endif
984         }
985 -    }
986 -  if (current_function_pops_args)
987 -    asm_fprintf (stream, "\trtd %0I%d\n", current_function_pops_args);
988 +  }
989 +  if (interrupt_handler)
990 +  {
991 +    fprintf (stream, "\trte\n");
992 +  }
993    else
994 -    fprintf (stream, "\trts\n");
995 +  {
996 +    if (current_function_pops_args)
997 +      asm_fprintf (stream, "\trtd %0I%d\n", current_function_pops_args);
998 +    else
999 +      fprintf (stream, "\trts\n");
1000 +  }
1001  }
1002  \f
1003  /* Similar to general_operand, but exclude stack_pointer_rtx.  */
1004 @@ -1334,7 +1481,7 @@
1005                              gen_rtx_PLUS (Pmode,
1006                                            pic_offset_table_rtx, orig));
1007        current_function_uses_pic_offset_table = 1;
1008 -      if (reload_in_progress)
1009 +      if (! TARGET_SEP_DATA && reload_in_progress)
1010         regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
1011        RTX_UNCHANGING_P (pic_ref) = 1;
1012        emit_move_insn (reg, pic_ref);
1013 @@ -1424,7 +1571,7 @@
1014        /* Constants easily generated by moveq + not.b/not.w/neg.w/swap  */
1015          return 1;
1016        case MOVL :
1017 -       return 2;
1018 +       return TARGET_5200 ? 1 : 2;
1019        default :
1020          abort ();
1021      }
1022 @@ -3397,3 +3544,76 @@
1023      }
1024    return "eor%.l %2,%0";
1025  }
1026 +
1027 +/* Return nonzero if ATTR is a valid attribute for DECL.
1028 +   ATTRIBUTES are any existing attributes and ARGS are the arguments
1029 +   supplied with ATTR.
1030 +
1031 +   Supported attributes:
1032 +
1033 +   interrupt -- specifies this function is an interrupt handler.
1034 +*/
1035 +
1036 +int
1037 +m68k_valid_machine_decl_attribute (decl, attributes, attr, args)
1038 +     tree decl;
1039 +     tree attributes;
1040 +     tree attr;
1041 +     tree args;
1042 +{
1043 +  if (args != NULL_TREE)
1044 +    return 0;
1045 +
1046 +  if (is_attribute_p ("interrupt", attr))
1047 +    return TREE_CODE (decl) == FUNCTION_DECL;
1048 +
1049 +  return 0;
1050 +}
1051 +
1052 +/* Return nonzero if FUNC is an interrupt function as specified by the
1053 +   "interrupt" attribute.  */
1054 +
1055 +int
1056 +m68k_interrupt_function_p(func)
1057 +     tree func;
1058 +{
1059 +  tree a;
1060 +
1061 +  if (TREE_CODE (func) != FUNCTION_DECL)
1062 +    return 0;
1063 +
1064 +  a = lookup_attribute ("interrupt", DECL_MACHINE_ATTRIBUTES (func));
1065 +  return (a != NULL_TREE);
1066 +}
1067 +
1068 +/* Return the initial difference between the
1069 +   frame pointer reg contents and the stack pointer reg contents,
1070 +   as of the start of the function body.  This depends on the layout
1071 +   of the fixed parts of the stack frame and on how registers are saved.
1072 +
1073 +   On the 68k, if we have a frame, we must add one word to its length
1074 +   to allow for the place that a6 is stored when we do have a frame pointer.
1075 +   Otherwise, we would need to compute the offset from the frame pointer
1076 +   of a local variable as a function of frame_pointer_needed, which
1077 +   is hard.  */
1078 +
1079 +int
1080 +initial_fp_offset(void) {
1081 +  int interrupt_handler = m68k_interrupt_function_p (current_function_decl);
1082 +  int regno;
1083 +  int offset = -4;
1084 +
1085 +  for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)
1086 +    if (MUST_SAVE_REGISTER(regno))
1087 +      offset += 12;
1088 +  for (regno = 0; regno < 16; regno++)
1089 +    if (MUST_SAVE_REGISTER(regno))
1090 +      offset += 4;
1091 +  if (flag_pic && ! TARGET_SEP_DATA &&
1092 +                 (current_function_uses_pic_offset_table ||
1093 +                  ( ! current_function_is_leaf && TARGET_ID_SHARED_LIBRARY)))
1094 +    offset += 4;
1095 +  return (offset + ((get_frame_size () + 3) & -4)
1096 +            + (get_frame_size () == 0 ? 0 : 4));
1097 +}
1098 +
1099 diff -u -r gcc-2.95.3-orig/gcc/config/m68k/m68k.h gcc-2.95.3/gcc/config/m68k/m68k.h
1100 --- gcc-2.95.3-orig/gcc/config/m68k/m68k.h      Fri Jan 26 00:03:34 2001
1101 +++ gcc-2.95.3/gcc/config/m68k/m68k.h   Tue Feb 26 06:52:47 2002
1102 @@ -120,6 +120,29 @@
1103  #define MASK_ALIGN_INT 4096
1104  #define TARGET_ALIGN_INT (target_flags & MASK_ALIGN_INT)
1105  
1106 +/* Support A5 relative data seperate from text.
1107 + * This option implies -fPIC, however it inhibits the generation of the
1108 + * A5 save/restore in functions and the loading of a5 with a got pointer.
1109 + */
1110 +#define MASK_SEP_DATA  8192
1111 +#define TARGET_SEP_DATA (target_flags & MASK_SEP_DATA)
1112 +
1113 +/* Compile for ColdFire with hardware divide (5307 etc.) */
1114 +#define MASK_CF_HWDIV  16384
1115 +#define TARGET_CF_HWDIV        (target_flags & MASK_CF_HWDIV)
1116 +
1117 +#define TARGET_5200_HWDIV (TARGET_5200 && TARGET_CF_HWDIV)
1118 +
1119 +/* Compile for mcf5300 */
1120 +#define MASK_5300      32768
1121 +#define TARGET_5300 (target_flags & MASK_5300)
1122 +
1123 +/* Compile using library ID based shared libraries.
1124 + * Set a specific ID using the -mshared-library-id=xxx option.
1125 + */
1126 +#define MASK_ID_SHARED_LIBRARY 65536
1127 +#define TARGET_ID_SHARED_LIBRARY       (target_flags & MASK_ID_SHARED_LIBRARY)
1128 +
1129  /* Compile for a CPU32 */
1130         /* A 68020 without bitfields is a good heuristic for a CPU32 */
1131  #define TARGET_CPU32   (TARGET_68020 && !TARGET_BITFIELD)
1132 @@ -170,6 +193,9 @@
1133      { "5200", - (MASK_68060|MASK_68040|MASK_68040_ONLY|MASK_68020      \
1134                 |MASK_BITFIELD|MASK_68881)},                            \
1135      { "5200", (MASK_5200)},                                            \
1136 +    { "5307", - (MASK_68060|MASK_68040|MASK_68040_ONLY|MASK_68020      \
1137 +               |MASK_BITFIELD|MASK_68881)},                            \
1138 +    { "5307", (MASK_5200|MASK_5300|MASK_CF_HWDIV)},                    \
1139      { "68851", 0},                                                     \
1140      { "no-68851", 0},                                                  \
1141      { "68302", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY      \
1142 @@ -182,6 +208,14 @@
1143      { "cpu32", MASK_68020},                                            \
1144      { "align-int", MASK_ALIGN_INT },                                   \
1145      { "no-align-int", -MASK_ALIGN_INT },                               \
1146 +    { "sep-data", MASK_SEP_DATA, "Enable separate data segment" },     \
1147 +    { "no-sep-data", -MASK_SEP_DATA, "Disable separate data segment" },        \
1148 +    { "id-shared-library", MASK_ID_SHARED_LIBRARY, "Enable ID based shared library" }, \
1149 +    { "no-id-shared-library", -MASK_ID_SHARED_LIBRARY, "Disable ID based shared library" },    \
1150 +    { "hwdiv", MASK_CF_HWDIV },                                                \
1151 +    { "no-hwdiv", -MASK_CF_HWDIV },                                    \
1152 +    { "mac", 0 },                                                      \
1153 +    { "no-mac", 0 },                                                   \
1154      SUBTARGET_SWITCHES                                                 \
1155      { "", TARGET_DEFAULT}}
1156  /* TARGET_DEFAULT is defined in sun*.h and isi.h, etc.  */
1157 @@ -199,6 +233,7 @@
1158  { { "align-loops=",    &m68k_align_loops_string },                     \
1159    { "align-jumps=",    &m68k_align_jumps_string },                     \
1160    { "align-functions=",        &m68k_align_funcs_string },                     \
1161 +  { "shared-library-id=",      &m68k_library_id_string },              \
1162    SUBTARGET_OPTIONS                                                    \
1163  }
1164  
1165 @@ -214,8 +249,9 @@
1166  #define OVERRIDE_OPTIONS               \
1167  {                                      \
1168    override_options();                  \
1169 -  if (! TARGET_68020 && flag_pic == 2) \
1170 -    error("-fPIC is not currently supported on the 68000 or 68010\n"); \
1171 +  if (flag_pic && (! optimize_size || TARGET_68020) && \
1172 +               ! TARGET_ID_SHARED_LIBRARY )    \
1173 +       flag_no_function_cse = 1;       \
1174    SUBTARGET_OVERRIDE_OPTIONS;          \
1175  }
1176  
1177 @@ -295,6 +331,9 @@
1178  /* Maximum power of 2 that code can be aligned to.  */
1179  #define MAX_CODE_ALIGN 2                       /* 4 byte alignment */
1180  
1181 +/* Maximum number of library ids we permit */
1182 +#define MAX_LIBRARY_ID 255
1183 +
1184  /* Align loop starts for optimal branching.  */
1185  #define LOOP_ALIGN(LABEL) (m68k_align_loops)
1186  
1187 @@ -414,6 +453,12 @@
1188  
1189  #endif /* defined SUPPORT_SUN_FPA */
1190  
1191 +/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
1192 +   is a valid machine specific attribute for DECL.
1193 +   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
1194 +extern int m68k_valid_machine_decl_attribute ();
1195 +#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
1196 +m68k_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
1197  
1198  /* Make sure everything's fine if we *don't* have a given processor.
1199     This assumes that putting a register in fixed_regs will keep the
1200 @@ -1178,7 +1223,7 @@
1201  /* Determine if the epilogue should be output as RTL.
1202     You should override this if you define FUNCTION_EXTRA_EPILOGUE.  */
1203  #define USE_RETURN_INSN use_return_insn ()
1204 -
1205
1206  /* Store in the variable DEPTH the initial difference between the
1207     frame pointer reg contents and the stack pointer reg contents,
1208     as of the start of the function body.  This depends on the layout
1209 @@ -1190,20 +1235,8 @@
1210     of a local variable as a function of frame_pointer_needed, which
1211     is hard.  */
1212  
1213 -#define INITIAL_FRAME_POINTER_OFFSET(DEPTH)                    \
1214 -{ int regno;                                                   \
1215 -  int offset = -4;                                             \
1216 -  for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)     \
1217 -    if (regs_ever_live[regno] && ! call_used_regs[regno])      \
1218 -      offset += 12;                                            \
1219 -  for (regno = 0; regno < 16; regno++)                         \
1220 -    if (regs_ever_live[regno] && ! call_used_regs[regno])      \
1221 -      offset += 4;                                             \
1222 -  if (flag_pic && current_function_uses_pic_offset_table)      \
1223 -    offset += 4;                                               \
1224 -  (DEPTH) = (offset + ((get_frame_size () + 3) & -4)           \
1225 -            + (get_frame_size () == 0 ? 0 : 4));               \
1226 -}
1227 +#define INITIAL_FRAME_POINTER_OFFSET(DEPTH)    (DEPTH) = initial_fp_offset();
1228 +
1229  
1230  /* Output assembler code for a block containing the constant parts
1231     of a trampoline, leaving space for the variable parts.  */
1232 @@ -1640,9 +1673,10 @@
1233     relative to an average of the time for add and the time for shift,
1234     taking away a little more because sometimes move insns are needed.  */
1235  /* div?.w is relatively cheaper on 68000 counted in COSTS_N_INSNS terms.  */
1236 -#define MULL_COST (TARGET_68060 ? 2 : TARGET_68040 ? 5 : 13)
1237 -#define MULW_COST (TARGET_68060 ? 2 : TARGET_68040 ? 3 : TARGET_68020 ? 8 : 5)
1238 -#define DIVW_COST (TARGET_68020 ? 27 : 12)
1239 +#define MULL_COST (TARGET_68060 ? 2 : TARGET_68040 ? 5 : TARGET_5300 ? 3 : TARGET_5200 ? 10 : 13)
1240 +#define MULW_COST (TARGET_68060 ? 2 : TARGET_68040 ? 3 : TARGET_68020 ? 8 : \
1241 +                       TARGET_5300 ? 2 : 5)
1242 +#define DIVW_COST (TARGET_68020 ? 27 : TARGET_CF_HWDIV ? 11 : 12)
1243  
1244  #define RTX_COSTS(X,CODE,OUTER_CODE)                           \
1245    case PLUS:                                                   \
1246 @@ -1654,15 +1688,19 @@
1247         && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT        \
1248         && (INTVAL (XEXP (XEXP (X, 0), 1)) == 2                 \
1249             || INTVAL (XEXP (XEXP (X, 0), 1)) == 4              \
1250 -           || INTVAL (XEXP (XEXP (X, 0), 1)) == 8))            \
1251 -      return COSTS_N_INSNS (3);         /* lea an@(dx:l:i),am */       \
1252 +           || INTVAL (XEXP (XEXP (X, 0), 1)) == 8)) {          \
1253 +      if (TARGET_5200)                                         \
1254 +       return COSTS_N_INSNS (2);                               \
1255 +      else                                                     \
1256 +       return COSTS_N_INSNS (3);        /* lea an@(dx:l:i),am */       \
1257 +    }                                                          \
1258      break;                                                     \
1259    case ASHIFT:                                                 \
1260    case ASHIFTRT:                                               \
1261    case LSHIFTRT:                                               \
1262      if (TARGET_68060)                                          \
1263        return COSTS_N_INSNS(1);                                 \
1264 -    if (! TARGET_68020)                                                        \
1265 +    if (! TARGET_68020 && ! TARGET_5200)                               \
1266        {                                                                        \
1267         if (GET_CODE (XEXP (X, 1)) == CONST_INT)                        \
1268           {                                                             \
1269 @@ -1680,8 +1718,12 @@
1270        return COSTS_N_INSNS (2);         /* clrw;swap */                \
1271      if (GET_CODE (XEXP (X, 1)) == CONST_INT                    \
1272         && !(INTVAL (XEXP (X, 1)) > 0                           \
1273 -            && INTVAL (XEXP (X, 1)) <= 8))                     \
1274 -      return COSTS_N_INSNS (3);         /* lsr #i,dn */                \
1275 +            && INTVAL (XEXP (X, 1)) <= 8)) {                   \
1276 +      if (TARGET_5200)                                         \
1277 +        return COSTS_N_INSNS(1);                               \
1278 +      else                                                     \
1279 +       return COSTS_N_INSNS (3);        /* lsr #i,dn */        \
1280 +      }                                                                \
1281      break;                                                     \
1282    case MULT:                                                   \
1283      if ((GET_CODE (XEXP (X, 0)) == ZERO_EXTEND                 \
1284 @@ -1698,6 +1740,8 @@
1285    case UMOD:                                                   \
1286      if (GET_MODE (X) == QImode || GET_MODE (X) == HImode)      \
1287        return COSTS_N_INSNS (DIVW_COST); /* div.w */            \
1288 +    if (TARGET_CF_HWDIV)                                               \
1289 +      return COSTS_N_INSNS(18);                                        \
1290      return COSTS_N_INSNS (43);  /* div.l */
1291  \f
1292  /* Tell final.c how to eliminate redundant test instructions.  */
1293 @@ -2083,6 +2127,11 @@
1294  
1295  #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1296  
1297 +/* The maximum alignment which the object file format can support. */
1298 +#undef MAX_OFILE_ALIGNMENT
1299 +#define MAX_OFILE_ALIGNMENT 128
1300 +
1301 +
1302  /* Define functions defined in aux-output.c and used in templates.  */
1303  
1304  extern char *output_move_const_into_data_reg ();
1305 @@ -2115,6 +2164,8 @@
1306  extern const char *m68k_align_loops_string;
1307  extern const char *m68k_align_jumps_string;
1308  extern const char *m68k_align_funcs_string;
1309 +extern const char *m68k_library_id_string;
1310 +extern int m68k_library_id;
1311  extern int m68k_align_loops;
1312  extern int m68k_align_jumps;
1313  extern int m68k_align_funcs;
1314 @@ -2133,6 +2184,7 @@
1315  extern void notice_update_cc ();
1316  extern void finalize_pic ();
1317  extern void override_options ();
1318 +extern int initial_fp_offset ();
1319  
1320  \f
1321  /*
1322 diff -u -r gcc-2.95.3-orig/gcc/config/m68k/m68k.md gcc-2.95.3/gcc/config/m68k/m68k.md
1323 --- gcc-2.95.3-orig/gcc/config/m68k/m68k.md     Thu Aug  5 16:22:05 1999
1324 +++ gcc-2.95.3/gcc/config/m68k/m68k.md  Tue Feb 26 06:52:47 2002
1325 @@ -3516,13 +3516,23 @@
1326  \f
1327  ;; Remainder instructions.
1328  
1329 -(define_insn "divmodsi4"
1330 +(define_expand "divmodsi4"
1331 +  [(parallel
1332 +   [(set (match_operand:SI 0 "general_operand" "")
1333 +       (div:SI (match_operand:SI 1 "general_operand" "")
1334 +               (match_operand:SI 2 "general_operand" "")))
1335 +    (set (match_operand:SI 3 "general_operand" "")
1336 +       (mod:SI (match_dup 1) (match_dup 2)))])]
1337 +  "TARGET_68020 || TARGET_5200_HWDIV"
1338 +  "")
1339 +
1340 +(define_insn ""
1341    [(set (match_operand:SI 0 "general_operand" "=d")
1342         (div:SI (match_operand:SI 1 "general_operand" "0")
1343                 (match_operand:SI 2 "general_operand" "dmsK")))
1344     (set (match_operand:SI 3 "general_operand" "=d")
1345         (mod:SI (match_dup 1) (match_dup 2)))]
1346 -  "TARGET_68020 && !TARGET_5200"
1347 +  "TARGET_68020"
1348    "*
1349  {
1350    if (find_reg_note (insn, REG_UNUSED, operands[3]))
1351 @@ -3531,13 +3541,40 @@
1352      return \"divsl%.l %2,%3:%0\";
1353  }")
1354  
1355 -(define_insn "udivmodsi4"
1356 +(define_insn ""
1357 +  [(set (match_operand:SI 0 "general_operand" "=d")
1358 +       (div:SI (match_operand:SI 1 "general_operand" "0")
1359 +               (match_operand:SI 2 "general_operand" "dQ")))
1360 +   (set (match_operand:SI 3 "general_operand" "=&d")
1361 +       (mod:SI (match_dup 1) (match_dup 2)))]
1362 +  "TARGET_5200_HWDIV"
1363 +  "*
1364 +{
1365 +  if (find_reg_note (insn, REG_UNUSED, operands[3]))
1366 +    return \"divs%.l %2,%0\";
1367 +  else if (find_reg_note (insn, REG_UNUSED, operands[0]))
1368 +    return \"rems%.l %2,%3:%0\";
1369 +  else
1370 +    return \"rems%.l %2,%3:%0\;divs%.l %2,%0\";
1371 +}")
1372 +
1373 +(define_expand "udivmodsi4"
1374 +  [(parallel
1375 +   [(set (match_operand:SI 0 "general_operand" "")
1376 +       (udiv:SI (match_operand:SI 1 "general_operand" "")
1377 +                (match_operand:SI 2 "general_operand" "")))
1378 +   (set (match_operand:SI 3 "general_operand" "")
1379 +       (umod:SI (match_dup 1) (match_dup 2)))])]
1380 +  "TARGET_68020 || TARGET_5200_HWDIV"
1381 +  "")
1382 +
1383 +(define_insn ""
1384    [(set (match_operand:SI 0 "general_operand" "=d")
1385         (udiv:SI (match_operand:SI 1 "general_operand" "0")
1386                  (match_operand:SI 2 "general_operand" "dmsK")))
1387     (set (match_operand:SI 3 "general_operand" "=d")
1388         (umod:SI (match_dup 1) (match_dup 2)))]
1389 -  "TARGET_68020 && !TARGET_5200"
1390 +  "TARGET_68020"
1391    "*
1392  {
1393    if (find_reg_note (insn, REG_UNUSED, operands[3]))
1394 @@ -3546,13 +3583,30 @@
1395      return \"divul%.l %2,%3:%0\";
1396  }")
1397  
1398 +(define_insn ""
1399 +  [(set (match_operand:SI 0 "general_operand" "=d")
1400 +       (udiv:SI (match_operand:SI 1 "general_operand" "0")
1401 +                (match_operand:SI 2 "general_operand" "dQ")))
1402 +   (set (match_operand:SI 3 "general_operand" "=&d")
1403 +       (umod:SI (match_dup 1) (match_dup 2)))]
1404 +  "TARGET_5200_HWDIV"
1405 +  "*
1406 +{
1407 +  if (find_reg_note (insn, REG_UNUSED, operands[3]))
1408 +    return \"divu%.l %2,%0\";
1409 +  else if (find_reg_note (insn, REG_UNUSED, operands[0]))
1410 +    return \"remu%.l %2,%3:%0\";
1411 +  else
1412 +    return \"remu%.l %2,%3:%0\;divu%.l %2,%0\";
1413 +}")
1414 +
1415  (define_insn "divmodhi4"
1416    [(set (match_operand:HI 0 "general_operand" "=d")
1417         (div:HI (match_operand:HI 1 "general_operand" "0")
1418                 (match_operand:HI 2 "general_operand" "dmsK")))
1419     (set (match_operand:HI 3 "general_operand" "=d")
1420         (mod:HI (match_dup 1) (match_dup 2)))]
1421 -  "!TARGET_5200"
1422 +  "!TARGET_5200 || TARGET_5200_HWDIV"
1423    "*
1424  {
1425  #ifdef MOTOROLA
1426 @@ -3575,7 +3629,7 @@
1427                  (match_operand:HI 2 "general_operand" "dmsK")))
1428     (set (match_operand:HI 3 "general_operand" "=d")
1429         (umod:HI (match_dup 1) (match_dup 2)))]
1430 -  "!TARGET_5200"
1431 +  "!TARGET_5200 || TARGET_5200_HWDIV"
1432    "*
1433  {
1434  #ifdef MOTOROLA
1435 @@ -3591,6 +3645,8 @@
1436    else
1437      return \"\";
1438  }")
1439 +
1440 +
1441  \f
1442  ;; logical-and instructions
1443  
1444 @@ -6830,7 +6886,19 @@
1445  #ifdef USE_GAS
1446      return \"bsr.l %0@PLTPC\";
1447  #else
1448 -    return \"bsr %0@PLTPC\";
1449 +    /* We output a bsr instruction if we've using -fpic or we're building for
1450 +     * a target that supports long branches.  If we're building -fPIC on the
1451 +     * 68000. 68010 or coldfire we're generate one of two sequences
1452 +     * a shorter one that uses a GOT entry or a longer one that doesn't.
1453 +     * We'll use the -Os commandline flag to decide which to generate.
1454 +     * Both sequences take the same time to execute on the coldfire.
1455 +     */
1456 +    if (flag_pic == 1 || TARGET_68020)
1457 +      return \"bsr %0@PLTPC\";
1458 +    else if (optimize_size || TARGET_ID_SHARED_LIBRARY)
1459 +      return \"move.l %0@GOT(%%a5), %%a1\\n\\tjsr (%%a1)\";
1460 +    else
1461 +      return \"lea %0-.-8,%%a1\;jsr 0(%%pc,%%a1)\";
1462  #endif
1463  #endif
1464  #else
1465 @@ -6894,7 +6962,18 @@
1466  #ifdef USE_GAS
1467        return \"bsr.l %1@PLTPC\";
1468  #else
1469 +    /* We output a bsr instruction if we've using -fpic or we're building for
1470 +     * a target that supports long branches.  If we're building -fPIC on the
1471 +     * 68000. 68010 or coldfire we're generate one of two sequences
1472 +     * a shorter one that uses a GOT entry or a longer one that doesn't.
1473 +     * We'll use the -Os commandline flag to decide which to generate.
1474 +     */
1475 +    if (flag_pic == 1 || TARGET_68020)
1476        return \"bsr %1@PLTPC\";
1477 +    else if (optimize_size || TARGET_ID_SHARED_LIBRARY)
1478 +      return \"move.l %1@GOT(%%a5), %%a1\\n\\tjsr (%%a1)\";
1479 +    else
1480 +      return \"lea %1-.-8,%%a1\;jsr 0(%%pc,%%a1)\";
1481  #endif
1482  #endif
1483  #else
1484 diff -u -r gcc-2.95.3-orig/gcc/config/m68k/m68kelf.h gcc-2.95.3/gcc/config/m68k/m68kelf.h
1485 --- gcc-2.95.3-orig/gcc/config/m68k/m68kelf.h   Fri Feb 19 02:00:12 1999
1486 +++ gcc-2.95.3/gcc/config/m68k/m68kelf.h        Tue Feb 26 06:52:47 2002
1487 @@ -255,12 +255,17 @@
1488     the PLT entry for `foo'. Doing function cse will cause the address of `foo'
1489     to be loaded into a register, which is exactly what we want to avoid when
1490     we are doing PIC on svr4 m68k. */
1491 +/* We allow function cse if we're optimising for size not on the 68020 or
1492 + * above since all function calls are going via the got anyway so loading the
1493 + * address isn't a problem.
1494 + */
1495  #undef OVERRIDE_OPTIONS
1496  #define OVERRIDE_OPTIONS               \
1497  {                                      \
1498 -  if (flag_pic) flag_no_function_cse = 1; \
1499 -  if (! TARGET_68020 && flag_pic == 2) \
1500 -    error("-fPIC is not currently supported on the 68000 or 68010\n"); \
1501 +  override_options();                  \
1502 +  if (flag_pic && (! optimize_size || TARGET_68020) && \
1503 +               ! TARGET_ID_SHARED_LIBRARY )    \
1504 +       flag_no_function_cse = 1;       \
1505  }
1506  /* end of stuff from m68kv4.h */
1507  
1508 diff -u -r gcc-2.95.3-orig/gcc/config/m68k/t-m68kbare gcc-2.95.3/gcc/config/m68k/t-m68kbare
1509 --- gcc-2.95.3-orig/gcc/config/m68k/t-m68kbare  Thu Dec 17 07:07:29 1998
1510 +++ gcc-2.95.3/gcc/config/m68k/t-m68kbare       Tue Feb 26 06:52:47 2002
1511 @@ -15,10 +15,10 @@
1512         echo '#define EXTFLOAT' > xfgnulib.c
1513         cat $(srcdir)/config/m68k/fpgnulib.c >> xfgnulib.c
1514  
1515 -MULTILIB_OPTIONS = m68000/m68020/m5200/mcpu32 m68881/msoft-float
1516 +MULTILIB_OPTIONS = m68000/m68020/m5200/mcpu32 m68881/msoft-float/mhwdiv
1517  MULTILIB_DIRNAMES =
1518  MULTILIB_MATCHES = m68000=mc68000 m68000=m68302 mcpu32=m68332 m68020=mc68020 m68020=m68040 m68020=m68060
1519 -MULTILIB_EXCEPTIONS = m68000/msoft-float m5200/m68881 m5200/msoft-float mcpu32/m68881 mcpu32/msoft-float
1520 +MULTILIB_EXCEPTIONS = mhwdiv m68000/msoft-float m68000/mhwdiv m68020/mhwdiv m5200/m68881 m5200/msoft-float mcpu32/m68881 mcpu32/msoft-float mcpu32/mhwdiv
1521  
1522  LIBGCC = stmp-multilib
1523  INSTALL_LIBGCC = install-multilib
1524 diff -u -r gcc-2.95.3-orig/gcc/config/m68k/t-m68kelf gcc-2.95.3/gcc/config/m68k/t-m68kelf
1525 --- gcc-2.95.3-orig/gcc/config/m68k/t-m68kelf   Thu Dec 17 07:07:30 1998
1526 +++ gcc-2.95.3/gcc/config/m68k/t-m68kelf        Tue Feb 26 06:52:47 2002
1527 @@ -15,10 +15,13 @@
1528         echo '#define EXTFLOAT' > xfgnulib.c
1529         cat $(srcdir)/config/m68k/fpgnulib.c >> xfgnulib.c
1530  
1531 -MULTILIB_OPTIONS = m68000/m68020/m5200/mcpu32 m68881/msoft-float
1532 +MULTILIB_OPTIONS = m68000/m68020/m5200/m5307/mcpu32 m68881/msoft-float msep-data/mid-shared-library
1533  MULTILIB_DIRNAMES =
1534  MULTILIB_MATCHES = m68000=mc68000 m68000=m68302 mcpu32=m68332 m68020=mc68020 m68020=m68040 m68020=m68060
1535 -MULTILIB_EXCEPTIONS = m68000/msoft-float m5200/m68881 m5200/msoft-float mcpu32/m68881 mcpu32/msoft-float
1536 +MULTILIB_EXCEPTIONS = m68000/msoft-float* m5200/m68881* m5200/msoft-float* mcpu32/m68881* mcpu32/msoft-float* \
1537 +               msep-data msoft-float/msep-data m5307/m68881* m5307/msoft-float* \
1538 +               mid-shared-library msoft-float/mid-shared-library
1539 +# MULTILIB_EXTRA_OPTS = 
1540  
1541  LIBGCC = stmp-multilib
1542  INSTALL_LIBGCC = install-multilib
1543 diff -u -r gcc-2.95.3-orig/gcc/invoke.texi gcc-2.95.3/gcc/invoke.texi
1544 --- gcc-2.95.3-orig/gcc/invoke.texi     Fri Jan 26 00:03:17 2001
1545 +++ gcc-2.95.3/gcc/invoke.texi  Tue Feb 26 06:52:47 2002
1546 @@ -214,7 +214,8 @@
1547  -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
1548  -m68060  -mcpu32 -m5200  -m68881  -mbitfield  -mc68000  -mc68020  
1549  -mfpa -mnobitfield  -mrtd  -mshort  -msoft-float  
1550 --malign-int
1551 +-malign-int  -msep-data  -mno-sep-data -mmac -mno-mac -mhwdiv -mno-hwdiv
1552 +-mshared-library-id=n -mid-shared-library -mno-id-shared-library
1553  
1554  @emph{VAX Options}
1555  -mg  -mgnu  -munix
1556 @@ -3226,7 +3227,7 @@
1557  when the compiler is configured for 520X-based systems.
1558  
1559  Use this option for microcontroller with a 5200 core, including 
1560 -the MCF5202, MCF5203, MCF5204 and MCF5202.
1561 +the MCF5202, MCF5204, MCF5206e and MCF5307.
1562  
1563  
1564  @item -m68020-40
1565 @@ -3299,6 +3300,44 @@
1566  @strong{Warning:} if you use the @samp{-malign-int} switch, GCC will
1567  align structures containing the above types  differently than
1568  most published application binary interface specifications for the m68k.
1569 +
1570 +@item -mhwdiv
1571 +@itemx -mno-hwdiv
1572 +Control the generation of output containing divide instructions that 
1573 +will only work on ColdFire processors with a hardware divide unit. This
1574 +option is only available when compiling for the ColdFire. The default is
1575 +@samp{-mnohwdiv}.
1576 +
1577 +@item -mmac
1578 +@itemx -mno-mac
1579 +Control the availability of ColdFire Multiply and ACcumulate instructions.
1580 +This does not affect the code generated only the availablity of the 
1581 +instructions to assembler contained within the C. The default is
1582 +@samp{-mnomac}.
1583 +
1584 +@item -mno-sep-data
1585 +Generate code that assumes that the data segment follows the text segment.
1586 +This is the default.
1587 +
1588 +@item -msep-data
1589 +Generate code that allows the data segment to be located in a different
1590 +area of memory from the text segment.  This allows for execute in place in
1591 +an environment without virtual memory management.  This option implies -fPIC.
1592 +
1593 +@item -mid-shared-library
1594 +Generate code that supports shared libraries via the library ID method.
1595 +This allows for execute in place and shared libraries in an environment
1596 +without virtual memory management.  This option implies -fPIC.
1597 +
1598 +@item -mno-id-shared-library
1599 +Generate code that doesn't assume ID based shared libraries are being used.
1600 +This is the default.
1601 +
1602 +@item -mshared-library-id=n
1603 +Specified the identification number of the ID based shared library being
1604 +compiled.  Specifying a value of 0 will generate more compact code, specifying
1605 +other values will force the allocation of that number to the current
1606 +library but is no more space or time efficient than omitting this option.
1607  
1608  @end table
1609  
1610 diff -u -r gcc-2.95.3-orig/gcc/longlong.h gcc-2.95.3/gcc/longlong.h
1611 --- gcc-2.95.3-orig/gcc/longlong.h      Thu Jan  7 06:44:39 1999
1612 +++ gcc-2.95.3/gcc/longlong.h   Tue Feb 26 06:52:47 2002
1613 @@ -514,8 +514,43 @@
1614              "dmi" ((USItype) (d)))
1615  
1616  #else /* not mc68020 */
1617 -#if !defined(__mcf5200__)
1618  /* %/ inserts REGISTER_PREFIX, %# inserts IMMEDIATE_PREFIX.  */
1619 +#if defined(__mcf5200__)
1620 +#define umul_ppmm(xh, xl, a, b) \
1621 +  __asm__ ("| Inlined umul_ppmm
1622 +       move%.l %2,%/d0
1623 +       move%.l %3,%/d1
1624 +       move%.l %/d0,%/d2
1625 +       swap    %/d0
1626 +       move%.l %/d1,%/d3
1627 +       swap    %/d1
1628 +       move%.w %/d2,%/d4
1629 +       mulu    %/d3,%/d4
1630 +       mulu    %/d1,%/d2
1631 +       mulu    %/d0,%/d3
1632 +       mulu    %/d0,%/d1
1633 +       move%.l %/d4,%/d0
1634 +       clr%.w  %/d0
1635 +       swap    %/d0
1636 +       add%.l  %/d0,%/d2
1637 +       add%.l  %/d3,%/d2
1638 +       jcc     1f
1639 +       add%.l  %#65536,%/d1
1640 +1:     swap    %/d2
1641 +       moveq   %#0,%/d0
1642 +       move%.w %/d2,%/d0
1643 +       move%.w %/d4,%/d2
1644 +       move%.l %/d2,%1
1645 +       add%.l  %/d1,%/d0
1646 +       move%.l %/d0,%0"                                                \
1647 +          : "=g" ((USItype) (xh)),                                     \
1648 +            "=g" ((USItype) (xl))                                      \
1649 +          : "g" ((USItype) (a)),                                       \
1650 +            "g" ((USItype) (b))                                        \
1651 +          : "d0", "d1", "d2", "d3", "d4")
1652 +#define UMUL_TIME 100
1653 +#define UDIV_TIME 400
1654 +#else /* not mcf5200 */
1655  #define umul_ppmm(xh, xl, a, b) \
1656    __asm__ ("| Inlined umul_ppmm
1657         move%.l %2,%/d0
1658 diff -u -r gcc-2.95.3-orig/gcc/version.c gcc-2.95.3/gcc/version.c
1659 --- gcc-2.95.3-orig/gcc/version.c       Fri Mar 16 22:52:12 2001
1660 +++ gcc-2.95.3/gcc/version.c    Tue Feb 26 06:52:47 2002
1661 @@ -1 +1 @@
1662 -char *version_string = "2.95.3 20010315 (release)";
1663 +char *version_string = "2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)";
This page took 2.713312 seconds and 3 git commands to generate.