1diff -Naur binutils-2.16.1.orig/bfd/config.bfd binutils-2.16.1-src/bfd/config.bfd
2--- binutils-2.16.1.orig/bfd/config.bfd	Mon Jan 31 17:18:46 2005
3+++ binutils-2.16.1-src/bfd/config.bfd	Thu Jun 30 23:40:16 2005
4@@ -708,7 +708,6 @@
5     ;;
6   m68*-*-coff* | m68*-*-sysv*)
7     targ_defvec=m68kcoff_vec
8-    targ_selvecs="m68kcoff_vec versados_vec ieee_vec"
9     ;;
10   m68*-*-hpux*)
11     targ_defvec=hp300hpux_vec
12diff -Naur binutils-2.16.1.orig/gas/as.c binutils-2.16.1-src/gas/as.c
13--- binutils-2.16.1.orig/gas/as.c	Thu Mar  3 01:29:52 2005
14+++ binutils-2.16.1-src/gas/as.c	Sun Jul 31 18:40:42 2005
15@@ -251,6 +251,14 @@
16                       	  s      include symbols\n\
17                       	  =FILE  list to FILE (must be last sub-option)\n"));
18
19+/* (TIGCC 20050732) */
20+  fprintf (stream, _("\
21+  --a68k                  assemble in A68k compatibility mode\n"));
22+
23+/* (TIGCC 20030716) */
24+  fprintf (stream, _("\
25+  --all-relocs            output all relocs, implies --keep-locals (-L)\n"));
26+
27   fprintf (stream, _("\
28   --alternate             initially turn on alternate macro syntax\n"));
29   fprintf (stream, _("\
30@@ -426,7 +434,9 @@
31       OPTION_EXECSTACK,
32       OPTION_NOEXECSTACK,
33       OPTION_ALTERNATE,
34-      OPTION_WARN_FATAL
35+      OPTION_WARN_FATAL,
36+      OPTION_ALL_RELOCS, /* (TIGCC 20030716) */
37+      OPTION_A68K /* (TIGCC 20050731) */
38     /* When you add options here, check that they do
39        not collide with OPTION_MD_BASE.  See as.h.  */
40     };
41@@ -442,6 +452,10 @@
42        necessary because -a=<FILE> is a valid switch but getopt would
43        normally reject it since --alternate does not take an argument.  */
44     ,{"a", optional_argument, NULL, 'a'}
45+/* (TIGCC 20050731) */
46+    ,{"a68k", no_argument, NULL, OPTION_A68K}
47+/* (TIGCC 20030716) */
48+    ,{"all-relocs", no_argument, NULL, OPTION_ALL_RELOCS}
49     ,{"defsym", required_argument, NULL, OPTION_DEFSYM}
50     ,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG}
51     ,{"emulation", required_argument, NULL, OPTION_EMULATION}
52@@ -735,6 +749,9 @@
53 	  listing_lhs_cont_lines = atoi (optarg);
54 	  break;
55
56+	case OPTION_A68K: /* (TIGCC 20050731) */
57+	  flag_a68k = 1;
58+	  /* fall through */
59 	case 'M':
60 	  flag_mri = 1;
61 #ifdef TC_M68K
62@@ -864,6 +881,12 @@
63
64 	case 'X':
65 	  /* -X means treat warnings as errors.  */
66+	  break;
67+
68+	/* (TIGCC 20030716) */
69+	case OPTION_ALL_RELOCS:
70+	  flag_all_relocs = 1;
71+	  flag_keep_locals = 1; /* implies -L */
72 	  break;
73 	}
74     }
75diff -Naur binutils-2.16.1.orig/gas/as.h binutils-2.16.1-src/gas/as.h
76--- binutils-2.16.1.orig/gas/as.h	Wed Apr 13 19:58:40 2005
77+++ binutils-2.16.1-src/gas/as.h	Sun Jul 31 18:40:04 2005
78@@ -244,16 +244,22 @@
79
80 #ifdef MANY_SEGMENTS
81 #include "bfd.h"
82-#define N_SEGMENTS 40
83-#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E39)
84-#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,\
85-		 SEG_E10,SEG_E11,SEG_E12,SEG_E13,SEG_E14,SEG_E15,SEG_E16,SEG_E17,SEG_E18,SEG_E19,\
86-		 SEG_E20,SEG_E21,SEG_E22,SEG_E23,SEG_E24,SEG_E25,SEG_E26,SEG_E27,SEG_E28,SEG_E29,\
87-		 SEG_E30,SEG_E31,SEG_E32,SEG_E33,SEG_E34,SEG_E35,SEG_E36,SEG_E37,SEG_E38,SEG_E39
88+/* (TIGCC 20040625) 40 sections are definitely not enough for
89+                    -ffunction-sections, -fdata-sections and the like.
90+                    So I increased them to 120. -- Kevin Kofler
91+   (TIGCC 20040905) And again to 1024. -- Kevin Kofler */
92+#define N_SEGMENTS 1024
93+#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_LAST)
94+#define LIST_10_(decade) decade##0,decade##1,decade##2,decade##3,decade##4,decade##5,decade##6,decade##7,decade##8,decade##9
95+#define LIST_FIRST_100_(century) LIST_10_(century),LIST_10_(century##1),LIST_10_(century##2),LIST_10_(century##3),LIST_10_(century##4),LIST_10_(century##5),LIST_10_(century##6),LIST_10_(century##7),LIST_10_(century##8),LIST_10_(century##9)
96+#define LIST_100_(century) LIST_10_(century##0),LIST_10_(century##1),LIST_10_(century##2),LIST_10_(century##3),LIST_10_(century##4),LIST_10_(century##5),LIST_10_(century##6),LIST_10_(century##7),LIST_10_(century##8),LIST_10_(century##9)
97+#define LIST_FIRST_1000_(millennium) LIST_FIRST_100_(millennium),LIST_100_(millennium##1),LIST_100_(millennium##2),LIST_100_(millennium##3),LIST_100_(millennium##4),LIST_100_(millennium##5),LIST_100_(millennium##6),LIST_100_(millennium##7),LIST_100_(millennium##8),LIST_100_(millennium##9)
98+#define SEG_LIST LIST_FIRST_1000_(SEG_E),LIST_10_(SEG_E100),LIST_10_(SEG_E101),\
99+		 SEG_E1020,SEG_E1021,SEG_E1022,SEG_E1023
100 #define SEG_TEXT SEG_E0
101 #define SEG_DATA SEG_E1
102 #define SEG_BSS SEG_E2
103-#define SEG_LAST SEG_E39
104+#define SEG_LAST SEG_E1023
105 #else
106 #define N_SEGMENTS 3
107 #define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS)
108@@ -294,8 +300,13 @@
109 #ifdef BFD_ASSEMBLER
110 #define segment_name(SEG)	bfd_get_section_name (stdoutput, SEG)
111 #else
112+/* (TIGCC 20040905) Allow arbitrary number of sections here. -- Kevin Kofler */
113+#if 0
114 extern char const *const seg_name[];
115-#define segment_name(SEG)	seg_name[(int) (SEG)]
116+#define segment_name(SEG)	seg_name[(int) (SEG)]*/
117+#else
118+char *segment_name PARAMS ((int));
119+#endif
120 #endif
121
122 #ifndef BFD_ASSEMBLER
123@@ -481,6 +492,12 @@
124
125 extern enum debug_info_type debug_type;
126 extern int use_gnu_debug_info_extensions;
127+
128+/* (TIGCC 20030716) True if all relocs should be retained.  */
129+COMMON unsigned char flag_all_relocs; /* --all-relocs */
130+
131+/* (TIGCC 20050731) True if assembling in A68k compatibility mode.  */
132+COMMON unsigned char flag_a68k; /* --a68k */
133
134 /* Maximum level of macro nesting.  */
135 extern int max_macro_nest;
136diff -Naur binutils-2.16.1.orig/gas/config/obj-coff.c binutils-2.16.1-src/gas/config/obj-coff.c
137--- binutils-2.16.1.orig/gas/config/obj-coff.c	Tue Mar  1 11:24:30 2005
138+++ binutils-2.16.1-src/gas/config/obj-coff.c	Thu Jun 30 23:40:16 2005
139@@ -1695,7 +1695,7 @@
140      section alignment, then skip this step, as TICOFF does.  */
141   size = bfd_get_section_size (sec);
142   mask = ((bfd_vma) 1 << align_power) - 1;
143-#if !defined(TICOFF)
144+#if 0 /*!defined(TICOFF)*/
145   if (size & mask)
146     {
147       bfd_vma new_size;
148@@ -1834,14 +1834,20 @@
149 /* This vector is used to turn a gas internal segment number into a
150    section number suitable for insertion into a coff symbol table.
151    This must correspond to seg_info_off_by_4.  */
152+/* (TIGCC 20040625) 40 sections are definitely not enough for
153+                    -ffunction-sections, -fdata-sections and the like.
154+                    So I increased them to 120. -- Kevin Kofler */
155
156 const short seg_N_TYPE[] =
157 {				/* in: segT   out: N_TYPE bits */
158+/* (TIGCC 20040905) Allow arbitrary number of sections here. -- Kevin Kofler */
159+#if 0
160   C_ABS_SECTION,
161   1,    2,  3,   4,    5,   6,   7,   8,   9,  10,
162   11,  12,  13,  14,  15,  16,  17,  18,  19,  20,
163   21,  22,  23,  24,  25,  26,  27,  28,  29,  30,
164   31,  32,  33,  34,  35,  36,  37,  38,  39,  40,
165+#endif /*0*/
166   C_UNDEF_SECTION,		/* SEG_UNKNOWN */
167   C_UNDEF_SECTION,		/* SEG_GOOF */
168   C_UNDEF_SECTION,		/* SEG_EXPR */
169@@ -1851,6 +1857,13 @@
170   C_REGISTER_SECTION,		/* SEG_REGISTER */
171 };
172
173+short SEGMENT_TO_SYMBOL_TYPE (n) int n;
174+{
175+  if (!n) return C_ABS_SECTION;
176+  else if (SEG_NORMAL(n)) return n-SEG_E0+1;
177+  else return seg_N_TYPE[n-(N_SEGMENTS+1)];
178+}
179+
180 int function_lineoff = -1;	/* Offset in line#s where the last function
181 				   started (the odd entry for line #0) */
182
183@@ -1918,6 +1931,8 @@
184  SEG_DEBUG,
185  SEG_ABSOLUTE,
186  SEG_UNKNOWN,
187+/* (TIGCC 20040905) Allow arbitrary number of sections here. -- Kevin Kofler */
188+#if 0
189  SEG_E0,  SEG_E1,  SEG_E2,  SEG_E3,  SEG_E4,
190  SEG_E5,  SEG_E6,  SEG_E7,  SEG_E8,  SEG_E9,
191  SEG_E10, SEG_E11, SEG_E12, SEG_E13, SEG_E14,
192@@ -1936,9 +1951,19 @@
193  (segT) 0,
194  (segT) 0,
195  SEG_REGISTER
196+#endif /*0*/
197 };
198
199-#define SEG_INFO_FROM_SECTION_NUMBER(x) (seg_info_off_by_4[(x)+4])
200+static segT SEG_INFO_FROM_SECTION_NUMBER PARAMS ((int));
201+
202+static segT SEG_INFO_FROM_SECTION_NUMBER (n) int n;
203+{
204+  if (n<=0) return seg_info_off_by_4[n+4];
205+  else if (n<=N_SEGMENTS) return n-1+SEG_E0;
206+  else if (n<=N_SEGMENTS+6) return n-1;
207+  else if (n==C_REGISTER_SECTION) return SEG_REGISTER;
208+  else return 0;
209+}
210
211 static relax_addressT relax_align PARAMS ((relax_addressT, long));
212
213@@ -2010,6 +2035,12 @@
214 	    size += off;
215 	  }
216 	  break;
217+    case rs_cfa:
218+      size += frag->fr_fix + eh_frame_estimate_size_before_relax (frag);
219+      break;
220+    case rs_dwarf2dbg:
221+      size += frag->fr_fix + dwarf2dbg_estimate_size_before_relax (frag);
222+      break;
223 	default:
224 	  BAD_CASE (frag->fr_type);
225 	  break;
226@@ -2159,8 +2190,11 @@
227 					S_GET_NAME (symbol_ptr));
228 			    }
229
230+/* (TIGCC 20030715) Don't convert references to references to the section symbol.
231+   (TIGCC 20030805) ... except for local symbols!
232+ -- Kevin Kofler  */
233 			  dot = segment_info[S_GET_SEGMENT (symbol_ptr)].dot;
234-			  if (dot)
235+			  if (dot && S_IS_LOCAL(symbol_ptr))
236 			    intr.r_symndx = dot->sy_number;
237 			  else
238 			    intr.r_symndx = symbol_ptr->sy_number;
239@@ -2309,6 +2343,16 @@
240 		    }
241
242 		  break;
243+
244+		case rs_cfa:
245+		  eh_frame_convert_frag (frag);
246+		  goto have_converted_rs_fill;
247+
248+		case rs_dwarf2dbg:
249+		  dwarf2dbg_convert_frag (frag);
250+          /* fall through */
251+
252+		have_converted_rs_fill:
253 		case rs_space:
254 		case rs_fill:
255 		case rs_align:
256@@ -3218,6 +3262,11 @@
257       tc_frob_coff_symbol (symbolP);
258 #endif
259
260+      /* (TIGCC 20040725) Clear the SF_LOCAL flag if the symbol is in a
261+                          mergeable section. -- Kevin Kofler  */
262+     if (segment_info[S_GET_SEGMENT (symbolP)].scnhdr.s_flags & STYP_MERGEABLE)
263+       SF_CLEAR_LOCAL (symbolP);
264+
265       /* We must put the external symbols apart. The loader
266 	 does not bomb if we do not. But the references in
267 	 the endndx field for a .bb symbol are not corrected
268@@ -3559,7 +3608,7 @@
269   (!(FRCHAIN)->frch_next || (FRCHAIN)->frch_next->frch_seg != (SEG)	\
270    ? get_recorded_alignment (SEG) : 0)
271 #else
272-#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 1
273+#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0 /*1*/
274 #endif
275 #endif
276
277@@ -3767,7 +3816,9 @@
278 {
279   unsigned int i;
280
281-#ifndef COFF_LONG_SECTION_NAMES
282+/* (TIGCC 20040625) Use the full name, not the truncated name, for merging of
283+                    identically-named sections. -- Kevin Kofler */
284+#if 0 /*ndef COFF_LONG_SECTION_NAMES*/
285   char buf[SCNNMLEN + 1];
286
287   strncpy (buf, name, SCNNMLEN);
288@@ -3870,6 +3921,9 @@
289 		case 'w': flags |= STYP_DATA;   break;
290 		case 'x': flags |= STYP_TEXT;   break;
291 		case 'r': flags |= STYP_LIT;	break;
292+/* (TIGCC 20040724) TIGCC COFF extensions for section flags -- Kevin Kofler */
293+		case 'm': flags |= STYP_MERGEABLE;	break;
294+		case 'u': flags |= STYP_UNALIGNED;	break;
295 		default:
296 		  as_warn(_("unknown section attribute '%c'"),
297 			  *input_line_pointer);
298@@ -4029,6 +4083,13 @@
299       symbol_remove (symbolP, &symbol_rootP, &symbol_lastP);
300       symbol_insert (symbolP, symbol_rootP, &symbol_rootP, &symbol_lastP);
301     }
302+
303+  /* (TIGCC 20030717) In all-relocs mode, add an __ld_all_relocs symbol pointing
304+                      to a dummy label in the text section. -- Kevin Kofler  */
305+  if (flag_all_relocs) {
306+    symbolP = symbol_new("__ld_all_relocs", SEG_TEXT, 0, &zero_address_frag);
307+    S_SET_EXTERNAL(symbolP); /* make it an xdef */
308+  }
309 }
310
311 /* Build a 'section static' symbol.  */
312@@ -4344,10 +4405,13 @@
313 #endif /* TC_I960 */
314 	      add_number += S_GET_VALUE (add_symbolP) -
315 		S_GET_VALUE (sub_symbolP);
316-	      add_symbolP = NULL;
317
318 	      if (!TC_FORCE_RELOCATION (fixP))
319 		{
320+		  /* (TIGCC 20030717) Zero out add_symbolP only if !TC_FORCE_RELOCATION.
321+		                      -- Kevin Kofler  */
322+		  add_symbolP = NULL;
323+
324 		  fixP->fx_addsy = NULL;
325 		  fixP->fx_subsy = NULL;
326 		  fixP->fx_done = 1;
327@@ -4368,6 +4432,8 @@
328 #ifdef DIFF_EXPR_OK
329 	      else if (S_GET_SEGMENT (sub_symbolP) == this_segment_type)
330 		{
331+/* (TIGCC 20030716) Take TC_FORCE_RELOCATION_SUB_LOCAL into account. -- Kevin Kofler  */
332+		 if (!TC_FORCE_RELOCATION_SUB_LOCAL (fixP)) {
333 		  /* Make it pc-relative.  */
334 		  add_number += (md_pcrel_from (fixP)
335 				 - S_GET_VALUE (sub_symbolP));
336@@ -4375,15 +4441,19 @@
337 		  fixP->fx_pcrel = 1;
338 		  sub_symbolP = 0;
339 		  fixP->fx_subsy = 0;
340+		 }
341 		}
342 #endif
343 	      else
344 		{
345+/* (TIGCC 20030716) Take UNDEFINED_DIFFERENCE_OK into account. -- Kevin Kofler  */
346+#ifndef UNDEFINED_DIFFERENCE_OK
347 		  as_bad_where (fixP->fx_file, fixP->fx_line,
348 				_("Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %ld."),
349 				segment_name (S_GET_SEGMENT (sub_symbolP)),
350 				S_GET_NAME (sub_symbolP),
351 				(long) (fragP->fr_address + where));
352+#endif
353 		}
354 	    }
355 	}
356@@ -4522,7 +4592,13 @@
357
358       md_apply_fix3 (fixP, (valueT *) & add_number, this_segment_type);
359
360-      if (!fixP->fx_bit_fixP && ! fixP->fx_no_overflow)
361+/* (TIGCC 20030716) Reuse fx_im_disp to turn off range checking on the 68k.
362+                    -- Kevin Kofler  */
363+      if (!fixP->fx_bit_fixP && ! fixP->fx_no_overflow
364+#ifdef TC_M68K
365+          && !fixP->fx_im_disp
366+#endif
367+      )
368 	{
369 #ifndef TC_M88K
370 	  /* The m88k uses the offset field of the reloc to get around
371diff -Naur binutils-2.16.1.orig/gas/config/obj-coff.h binutils-2.16.1-src/gas/config/obj-coff.h
372--- binutils-2.16.1.orig/gas/config/obj-coff.h	Thu Mar  3 11:47:48 2005
373+++ binutils-2.16.1-src/gas/config/obj-coff.h	Thu Jun 30 23:40:16 2005
374@@ -487,7 +487,8 @@
375 #define C_DEBUG_SECTION		N_DEBUG
376 #define C_NTV_SECTION		N_TV
377 #define C_PTV_SECTION		P_TV
378-#define C_REGISTER_SECTION	50
379+/* (TIGCC 20040905) Don't hardcode number of sections here. -- Kevin Kofler */
380+#define C_REGISTER_SECTION	(N_SEGMENTS+10)
381
382 /* Macros to extract information from a symbol table entry.
383    This syntactic indirection allows independence regarding a.out or coff.
384@@ -510,20 +511,31 @@
385 /* Return true for symbols that should not be reduced to section
386    symbols or eliminated from expressions, because they may be
387    overridden by the linker.  */
388+/* (TIGCC 20030716) Never reduce or eliminate relocs in all-relocs mode.
389+   (TIGCC 20040719) Don't force relocs for absolute symbols if !flag_all_relocs.
390+   (TIGCC 20040725) Force relocs for symbols in mergeable sections.
391+                    -- Kevin Kofler  */
392 #define S_FORCE_RELOC(s, strict) \
393-  (!SEG_NORMAL (S_GET_SEGMENT (s)) || (strict && S_IS_WEAK (s)))
394+  ((!SEG_NORMAL (S_GET_SEGMENT (s)) && S_GET_SEGMENT (s) != absolute_section) \
395+   || (strict && S_IS_WEAK (s)) || flag_all_relocs \
396+   || (segment_info[S_GET_SEGMENT (s)].scnhdr.s_flags & STYP_MERGEABLE))
397
398 /* True if a debug special symbol entry.  */
399 #define S_IS_DEBUG(s) \
400   ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
401
402 /* True if a symbol is local symbol name.  */
403-/* A symbol name whose name includes ^A is a gas internal pseudo symbol.  */
404+/* A symbol name whose name includes ^A is a gas internal pseudo symbol.
405+   (TIGCC 20030716) However, we want them output when outputting local symbols.
406+   (TIGCC 20040724) Also, we always want to output local symbols in mergeable
407+                    sections, because our linker relies on that.
408+                    -- Kevin Kofler  */
409 #define S_IS_LOCAL(s) \
410   ((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \
411-   || (S_LOCAL_NAME(s) && ! flag_keep_locals && ! S_IS_DEBUG (s)) \
412-   || strchr (S_GET_NAME (s), '\001') != NULL \
413-   || strchr (S_GET_NAME (s), '\002') != NULL \
414+   || (S_LOCAL_NAME(s) && ! flag_keep_locals && ! S_IS_DEBUG (s) \
415+       && !(segment_info[S_GET_SEGMENT (s)].scnhdr.s_flags & STYP_MERGEABLE)) \
416+   || (strchr (S_GET_NAME (s), '\001') != NULL && ! flag_keep_locals) \
417+   || (strchr (S_GET_NAME (s), '\002') != NULL && ! flag_keep_locals) \
418    || (flag_strip_local_absolute \
419        && !S_IS_EXTERNAL(s) \
420        && (s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION))
421diff -Naur binutils-2.16.1.orig/gas/config/tc-m68k.c binutils-2.16.1-src/gas/config/tc-m68k.c
422--- binutils-2.16.1.orig/gas/config/tc-m68k.c	Tue Mar 22 15:31:48 2005
423+++ binutils-2.16.1-src/gas/config/tc-m68k.c	Thu Jun 30 23:40:16 2005
424@@ -79,6 +79,7 @@
425 int flag_want_pic;
426
427 static int flag_short_refs;	/* -l option.  */
428+static int flag_short_jumps;	/* --short-jumps option */
429 static int flag_long_jumps;	/* -S option.  */
430 static int flag_keep_pcrel;	/* --pcrel option.  */
431
432@@ -579,6 +580,10 @@
433   {"extend", float_cons, 'x'},
434   {"ldouble", float_cons, 'x'},
435
436+  /* Dwarf2 support for Gcc.  */
437+  {"file", (void (*) PARAMS ((int))) dwarf2_directive_file, 0},
438+  {"loc", dwarf2_directive_loc, 0},
439+
440   /* The following pseudo-ops are supported for MRI compatibility.  */
441   {"chip", s_chip, 0},
442   {"comline", s_space, 1},
443@@ -777,15 +782,24 @@
444 short
445 tc_coff_fix2rtype (fixS *fixP)
446 {
447+/* (TIGCC 20040920) Handle unoptimizable relocs.  -- Kevin Kofler */
448+  short isunopt;
449+  isunopt = (fixP->fx_unoptimizable) ? R_UNOPTIMIZABLE : 0;
450+
451   if (fixP->fx_tcbit && fixP->fx_size == 4)
452-    return R_RELLONG_NEG;
453+    return isunopt | R_RELLONG_NEG;
454+/* (TIGCC 20030716) Handle word and byte negative relocs.  -- Kevin Kofler */
455+  if (fixP->fx_tcbit && fixP->fx_size == 2)
456+    return isunopt | R_RELWORD_NEG;
457+  if (fixP->fx_tcbit && fixP->fx_size == 1)
458+    return isunopt | R_RELBYTE_NEG;
459 #ifdef NO_PCREL_RELOCS
460   know (fixP->fx_pcrel == 0);
461-  return (fixP->fx_size == 1 ? R_RELBYTE
462+  return isunopt | (fixP->fx_size == 1 ? R_RELBYTE
463 	  : fixP->fx_size == 2 ? R_DIR16
464 	  : R_DIR32);
465 #else
466-  return (fixP->fx_pcrel
467+  return isunopt | (fixP->fx_pcrel
468 	  ? (fixP->fx_size == 1 ? R_PCRBYTE
469 	     : fixP->fx_size == 2 ? R_PCRWORD
470 	     : R_PCRLONG)
471@@ -2759,6 +2773,7 @@
472 	      add_fix ('B', &opP->disp, 1, -1);
473 	      break;
474 	    case 'W':
475+	    word_branch: /* (TIGCC 20050130) */
476 	      add_fix ('w', &opP->disp, 1, 0);
477 	      addword (0);
478 	      break;
479@@ -2771,6 +2786,20 @@
480 	      addword (0);
481 	      addword (0);
482 	      break;
483+	    case 'G': /* (TIGCC 20050130) */
484+	    /* (TIGCC 20050130) We want only branches (word). -- Kevin Kofler */
485+	      if (subs (&opP->disp))	/* We can't relax it.  */
486+		goto word_branch;
487+
488+#ifdef OBJ_ELF
489+	      /* If the displacement needs pic relocation it cannot be
490+		 relaxed.  */
491+	      if (opP->disp.pic_reloc != pic_none)
492+		goto word_branch;
493+#endif
494+	      add_frag (adds (&opP->disp), offs (&opP->disp),
495+			TAB (BRANCHBW, SZ_UNDEF));
496+	      break;
497 	    case 'g':
498 	      if (subs (&opP->disp))	/* We can't relax it.  */
499 		goto long_branch;
500@@ -2793,8 +2822,15 @@
501 		    the_ins.opcode[0] = 0x4EB9;
502 		  else					/* jCC */
503 		    {
504+		      /* (TIGCC 20030902) Add a PC-relative reloc (unconditionally, because
505+		                          it will be removed later on if not in all-relocs
506+		                          mode). -- Kevin Kofler  */
507+		      struct m68k_exp temp_expr = {SIZE_UNSPEC,
508+		      {symbol_new (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix () + 8, frag_now),
509+		      NULL, 0, O_symbol, 0, 0}};
510 		      the_ins.opcode[0] ^= 0x0100;
511 		      the_ins.opcode[0] |= 0x0006;
512+		      add_fix ('B' /*case-sensitive!*/, &temp_expr, 1 /*PCREL*/, -1 /*PCREL fix for bytes*/);
513 		      addword (0x4EF9);
514 		    }
515 		  add_fix ('l', &opP->disp, 0, 0);
516@@ -3955,7 +3991,7 @@
517       current_label = NULL;
518     }
519
520-#ifdef OBJ_ELF
521+#if 1 /*def OBJ_ELF*/
522   /* Tie dwarf2 debug info to the address at the start of the insn.  */
523   dwarf2_emit_insn (0);
524 #endif
525@@ -4008,6 +4044,13 @@
526 	  fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
527 	  if (the_ins.reloc[m].wid == 'B')
528 	    fixP->fx_signed = 1;
529+	  /* (TIGCC 20050130) These relocs are by definition the ones which cannot
530+	                      be "relaxed" - or "optimized" in ld-tigcc terms.
531+	                      Excepted from this are byte branches because the
532+	                      linker must be able to remove them entirely.
533+	                      -- Kevin Kofler */
534+	  else
535+	    fixP->fx_unoptimizable = 1;
536 	}
537       return;
538     }
539@@ -4068,6 +4111,10 @@
540 			      get_reloc_code (wid, the_ins.reloc[m].pcrel,
541 					      the_ins.reloc[m].pic_reloc));
542 	  fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
543+	  /* (TIGCC 20050130) These relocs are by definition the ones which cannot
544+	                      be "relaxed" - or "optimized" in ld-tigcc terms.
545+	                      -- Kevin Kofler */
546+	  fixP->fx_unoptimizable = 1;
547 	}
548       (void) frag_var (rs_machine_dependent, 10, 0,
549 		       (relax_substateT) (the_ins.fragb[n].fragty),
550@@ -4105,6 +4152,10 @@
551 			  get_reloc_code (wid, the_ins.reloc[m].pcrel,
552 					  the_ins.reloc[m].pic_reloc));
553       fixP->fx_pcrel_adjust = the_ins.reloc[m].pcrel_fix;
554+      /* (TIGCC 20050130) These relocs are by definition the ones which cannot
555+                          be "relaxed" - or "optimized" in ld-tigcc terms.
556+                          -- Kevin Kofler */
557+      fixP->fx_unoptimizable = 1;
558     }
559 }
560
561@@ -4126,6 +4177,8 @@
562     return ret;
563   if (op1 < op2)
564     return -1;
565+  if (op1 > op2)
566+    return 1; /* (TIGCC 200505611) This is required for Windows. -- Kevin Kofler */
567   return 0;
568 }
569
570@@ -4619,7 +4672,9 @@
571
572   val = SEXT (val);
573
574-  if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
575+/* (TIGCC 20030716) We aren't done when we still have something to subtract.
576+                    -- Kevin Kofler  */
577+  if (fixP->fx_addsy == NULL && fixP->fx_subsy == NULL && fixP->fx_pcrel == 0)
578     fixP->fx_done = 1;
579
580 #ifdef OBJ_ELF
581@@ -4642,6 +4697,55 @@
582     return;
583 #endif
584
585+  /* Fix up a negative reloc.  */
586+  if (fixP->fx_addsy == NULL && fixP->fx_subsy != NULL)
587+    {
588+      fixP->fx_addsy = fixP->fx_subsy;
589+      fixP->fx_subsy = NULL;
590+      fixP->fx_tcbit = 1;
591+      val = -val; /* (TIGCC 20030716) */
592+    }
593+  /* (TIGCC 20030716) Fix up an address difference by splitting it into its
594+                      components.
595+                      Fix up subtraction of the dot symbol by changing the reloc
596+                      to PC-relative (disabled 20030717).  -- Kevin Kofler
597+     (TIGCC 20040807) For common symbols, the value is the size, not the
598+                      position, so don't use it.  -- Kevin Kofler  */
599+  else if (fixP->fx_addsy != NULL && fixP->fx_subsy != NULL)
600+    {
601+#if 0 /* (TIGCC 20030717) This is unnecessary (see expr.c fix) and probably wrong. */
602+      if (!~fixP->fx_subsy->sy_number) { /* detect the dot symbol */
603+        /* make the reloc PC-relative: */
604+        val += md_pcrel_from (fixP);
605+        fixP->fx_offset = *valP = val;
606+        fixP->fx_pcrel = 1;
607+        fixP->fx_subsy = NULL;
608+      } else {
609+#endif
610+        fixS *negreloc = fix_new (fixP->fx_frag, fixP->fx_where, fixP->fx_size,
611+                                  fixP->fx_subsy, fixP->fx_offset
612+                                                  + (S_IS_COMMON (fixP->fx_addsy) ? 0 : S_GET_VALUE (fixP->fx_addsy))
613+                                                  + segment_info[S_GET_SEGMENT (fixP->fx_addsy)].scnhdr.s_paddr
614+                                                  - (((S_IS_COMMON (fixP->fx_subsy) ? 0 : S_GET_VALUE (fixP->fx_subsy))
615+                                                     + segment_info[S_GET_SEGMENT (fixP->fx_subsy)].scnhdr.s_paddr)
616+                                                     << 1) /* (TIGCC 20030717) Yes, we need to subtract this twice!
617+                                                               This kludge compensates for later incorrect
618+                                                               computations in obj-coff.c. -- Kevin Kofler  */,
619+                                  0, 0);
620+        if (negreloc) {
621+          fixP->fx_offset = 0; /* We have transferred the offset to the negative reloc.  */
622+          fixP->fx_pcrel = 0;
623+          fixP->fx_subsy = NULL;
624+          negreloc->fx_tcbit = 1;
625+          /* turn off range checking for both relocs: */
626+          fixP->fx_im_disp = negreloc->fx_im_disp = 1;
627+        }
628+#if 0
629+      }
630+#endif
631+    }
632+
633+  /* (TIGCC 20030716) Moved this down so val can be adjusted. -- Kevin Kofler  */
634   switch (fixP->fx_size)
635     {
636       /* The cast to offsetT below are necessary to make code
637@@ -4669,13 +4773,8 @@
638       BAD_CASE (fixP->fx_size);
639     }
640
641-  /* Fix up a negative reloc.  */
642-  if (fixP->fx_addsy == NULL && fixP->fx_subsy != NULL)
643-    {
644-      fixP->fx_addsy = fixP->fx_subsy;
645-      fixP->fx_subsy = NULL;
646-      fixP->fx_tcbit = 1;
647-    }
648+  /* (TIGCC 20030716) Reuse fx_im_disp to turn off range checking. -- Kevin Kofler  */
649+  if (fixP->fx_im_disp) return;
650
651   /* For non-pc-relative values, it's conceivable we might get something
652      like "0xff" for a byte field.  So extend the upper part of the range
653@@ -4684,7 +4783,17 @@
654   if (! fixP->fx_pcrel && ! fixP->fx_signed)
655     upper_limit = upper_limit * 2 + 1;
656
657-  if ((addressT) val > upper_limit
658+  /* (TIGCC 20050507) We can't properly range-check PC-relative relocs in
659+     all-relocs mode because of COFF VMA annoyances. Ideally, the section
660+     contents should be just unrelocated offsets which can be properly
661+     range-checked, but unfortunately COFF is designed with unrelocated use in
662+     mind and relocation as an afterthought. And moreover, we need to
663+     range-check in the linker anyway, as only the linker knows the final
664+     section disposition. So let's just let the linker worry about
665+     range-checking. */
666+  if (fixP->fx_pcrel)
667+    fixP->fx_im_disp = 1;
668+  else if ((addressT) val > upper_limit
669       && (val > 0 || val < lower_limit))
670     as_bad_where (fixP->fx_file, fixP->fx_line, _("value out of range"));
671
672@@ -4795,6 +4904,27 @@
673       fragP->fr_opcode[0] ^= 0x01;	/* Invert bcc.  */
674       fragP->fr_opcode[1]  = 0x06;	/* Branch offset = 6.  */
675
676+      /* (TIGCC 20030902) Add a PC-relative reloc (unconditionally, because
677+                          it will be removed later on if not in all-relocs
678+                          mode).  -- Kevin Kofler
679+         (TIGCC 20030908) Unfortunately, we cannot create symbols here for some
680+                          reason, so we create the symbol in advance in
681+                          md_estimate_size_before_relax and store it into the
682+                          frag structure of the next frag. Here, we only have to
683+                          read it.  -- Kevin Kofler, patch by Sebastian Reichelt
684+         */
685+      {
686+	fragS *nextFragP = fragP->fr_next;
687+	symbolS *symbolP = NULL;
688+	if (nextFragP)
689+	  symbolP = nextFragP->fr_start_symbol;
690+
691+	if (symbolP)
692+	  fix_new (fragP, fragP->fr_fix - 1, 1, symbolP, -1, 1, RELAX_RELOC_PC8);
693+	else
694+	  as_warn_where (fragP->fr_file, fragP->fr_line, _("no symbol available for pseudo-op code"));
695+      }
696+
697       /* JF: these used to be fr_opcode[2,3], but they may be in a
698 	   different frag, in which case referring to them is a no-no.
699 	   Only fr_opcode[0,1] are guaranteed to work.  */
700@@ -4963,8 +5093,17 @@
701 	    && relaxable_symbol (fragP->fr_symbol))
702 	  {
703 	    fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), BYTE);
704+	    /* (TIGCC 20030909) Create a symbol at the beginning of the next frag
705+	                        and store it into the frag structure, because
706+	                        md_convert_frag_1 might need a symbol there, but
707+	                        can't create it itself. This is necessary only for
708+	                        conditional jumps. -- Kevin Kofler  */
709+	    if ((TABTYPE (fragP->fr_subtype) == BRABSJCOND) && fragP->fr_next)
710+	      {
711+		fragP->fr_next->fr_start_symbol = symbol_new (FAKE_LABEL_NAME, segment, fragP->fr_next->fr_address, fragP->fr_next);
712+	      }
713 	  }
714-	else if (flag_short_refs)
715+	else if (flag_short_jumps)
716 	  {
717 	    /* Symbol is undefined and we want short ref.  */
718 	    fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
719@@ -4973,6 +5112,17 @@
720 	  {
721 	    /* Symbol is still undefined.  Make it LONG.  */
722 	    fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), LONG);
723+	    /* (TIGCC 20030908) Create a symbol at the beginning of the next frag
724+	                        and store it into the frag structure, because
725+	                        md_convert_frag_1 might need a symbol there, but
726+	                        can't create it itself.
727+	                        -- Kevin Kofler, patch by Sebastian Reichelt
728+	       (TIGCC 20030909) This is necessary only for conditional jumps.
729+	                        -- Kevin Kofler  */
730+	    if ((TABTYPE (fragP->fr_subtype) == BRABSJCOND) && fragP->fr_next)
731+	      {
732+		fragP->fr_next->fr_start_symbol = symbol_new (FAKE_LABEL_NAME, segment, fragP->fr_next->fr_address, fragP->fr_next);
733+	      }
734 	  }
735 	break;
736       }
737@@ -4999,7 +5149,7 @@
738       {
739 	if ((S_GET_SEGMENT (fragP->fr_symbol) == segment
740 	     && relaxable_symbol (fragP->fr_symbol))
741-	    || flag_short_refs)
742+	    || flag_short_jumps)
743 	  {
744 	    fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
745 	  }
746@@ -5025,7 +5175,8 @@
747     case TAB (ABSTOPCREL, SZ_UNDEF):
748       {
749 	if ((S_GET_SEGMENT (fragP->fr_symbol) == segment
750-	     && relaxable_symbol (fragP->fr_symbol)))
751+	     && relaxable_symbol (fragP->fr_symbol))
752+	    || flag_short_refs)
753 	  {
754 	    fragP->fr_subtype = TAB (ABSTOPCREL, SHORT);
755 	  }
756@@ -5069,6 +5220,7 @@
757 	    }
758 	}
759       break;
760+
761     default:
762       break;
763     }
764@@ -7067,6 +7219,8 @@
765   {"disp-size-default-32", no_argument, NULL, OPTION_DISP_SIZE_DEFAULT_32},
766 #define OPTION_PCREL (OPTION_MD_BASE + 7)
767   {"pcrel", no_argument, NULL, OPTION_PCREL},
768+#define OPTION_SHORT_JUMPS (OPTION_MD_BASE + 8)
769+  {"short-jumps", no_argument, NULL, OPTION_SHORT_JUMPS},
770   {NULL, no_argument, NULL, 0}
771 };
772 size_t md_longopts_size = sizeof (md_longopts);
773@@ -7079,6 +7233,12 @@
774     case 'l':			/* -l means keep external to 2 bit offset
775 				   rather than 16 bit one.  */
776       flag_short_refs = 1;
777+      flag_short_jumps = 1;
778+      break;
779+
780+    case OPTION_SHORT_JUMPS:	/* --short-jumps is like -l only for
781+				   jumps.  */
782+      flag_short_jumps = 1;
783       break;
784
785     case 'S':			/* -S means that jbsr's always turn into
786@@ -7255,6 +7415,7 @@
787   fprintf (stream, _("\
788 680X0 options:\n\
789 -l			use 1 word for refs to undefined symbols [default 2]\n\
790+--short-jumps		use 1 word for jumps to undefined symbols [default 2]\n\
791 -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060 |\n\
792 -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -m68360 | -mcpu32 |\n\
793 -m5200  | -m5202  | -m5204  | -m5206  | -m5206e | -m521x  | -m5249  |\n\
794diff -Naur binutils-2.16.1.orig/gas/config/tc-m68k.h binutils-2.16.1-src/gas/config/tc-m68k.h
795--- binutils-2.16.1.orig/gas/config/tc-m68k.h	Tue Mar  1 22:35:20 2005
796+++ binutils-2.16.1-src/gas/config/tc-m68k.h	Thu Jun 30 23:40:16 2005
797@@ -234,3 +234,20 @@
798
799 #define tc_cfi_frame_initial_instructions tc_m68k_frame_initial_instructions
800 extern void tc_m68k_frame_initial_instructions (void);
801+
802+/* (TIGCC 20030716) Allow difference of undefined symbols. -- Kevin Kofler  */
803+#define UNDEFINED_DIFFERENCE_OK
804+
805+/* (TIGCC 20030716) Force relocs in all-relocs mode. -- Kevin Kofler  */
806+#define TC_FORCE_RELOCATION(FIX)		\
807+  (generic_force_reloc (FIX))
808+#define TC_FORCE_RELOCATION_ABS(FIX)		\
809+  (0)
810+#define TC_FORCE_RELOCATION_LOCAL(FIX)		\
811+  (TC_FORCE_RELOCATION (FIX))
812+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
813+  (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
814+#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX)	\
815+  (TC_FORCE_RELOCATION (FIX))
816+/* (END TIGCC 20030716) */
817+
818diff -Naur binutils-2.16.1.orig/gas/configure binutils-2.16.1-src/gas/configure
819--- binutils-2.16.1.orig/gas/configure	Tue Mar  1 00:43:50 2005
820+++ binutils-2.16.1-src/gas/configure	Thu Jun 30 23:40:16 2005
821@@ -10839,7 +10839,7 @@
822
823
824
825-                              ac_config_files="$ac_config_files Makefile doc/Makefile po/Makefile.in:po/Make-in"
826+                              ac_config_files="$ac_config_files Makefile doc/Makefile po/Makefile.in:po/Make-in"
827
828           ac_config_commands="$ac_config_commands default"
829
830diff -Naur binutils-2.16.1.orig/gas/dwarf2dbg.c binutils-2.16.1-src/gas/dwarf2dbg.c
831--- binutils-2.16.1.orig/gas/dwarf2dbg.c	Thu Mar  3 01:29:52 2005
832+++ binutils-2.16.1-src/gas/dwarf2dbg.c	Thu Jun 30 23:40:16 2005
833@@ -53,7 +53,15 @@
834 # define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
835 #endif
836
837-#ifdef BFD_ASSEMBLER
838+#ifndef BFD_ASSEMBLER
839+# define section_symbol(SEC) seg_info(SEC)->dwarf2_secsym
840+#endif
841+
842+#ifdef __MINGW32__
843+# define ffs __builtin_ffs
844+#endif
845+
846+#if 1 /*def BFD_ASSEMBLER*/
847
848 #include "subsegs.h"
849
850@@ -331,6 +339,13 @@
851   dwarf2_gen_line_info (frag_now_fix () - size, &loc);
852 }
853
854+void
855+dwarf2_emit_insn_if_loc_seen (int size)
856+{
857+  if (loc_directive_seen)
858+    dwarf2_emit_insn (size);
859+}
860+
861 /* Get a .debug_line file number for FILENAME.  If NUM is nonzero,
862    allocate it on that file table slot, otherwise return the first
863    empty one.  */
864@@ -962,7 +977,9 @@
865       if (1 /* line != e->loc.line || changed */)
866 	{
867 	  int line_delta = e->loc.line - line;
868-	  if (frag == NULL)
869+	  /* (TIGCC 20050415) Always use DW_LNE_set_address, as everything else is
870+	     incompatible with linker optimization. -- Kevin Kofler */
871+	  if (1 /*frag == NULL*/)
872 	    {
873 	      out_set_addr (seg, e->frag, e->frag_ofs);
874 	      out_inc_line_addr (line_delta, 0);
875@@ -992,11 +1009,16 @@
876   /* Emit a DW_LNE_end_sequence for the end of the section.  */
877   last_frag = last_frag_for_seg (seg);
878   last_frag_ofs = get_frag_fix (last_frag);
879+#if 0 /* (TIGCC 20050419) */
880   if (frag == last_frag)
881     out_inc_line_addr (INT_MAX, last_frag_ofs - frag_ofs);
882   else
883     relax_inc_line_addr (INT_MAX, seg, last_frag, last_frag_ofs,
884 			 frag, frag_ofs);
885+#else
886+  out_set_addr (seg, last_frag, last_frag_ofs);
887+  out_inc_line_addr (INT_MAX, 0);
888+#endif
889 }
890
891 /* Emit the directory and file tables for .debug_line.  */
892@@ -1057,6 +1079,7 @@
893   subseg_set (line_seg, 0);
894
895   line_start = symbol_temp_new_now ();
896+  seg_info (line_seg)->dwarf2_secsym = line_start; /* (TIGCC 20050407) */
897   prologue_end = symbol_temp_make ();
898   line_end = symbol_temp_make ();
899
900@@ -1212,15 +1235,19 @@
901 {
902   subseg_set (abbrev_seg, 0);
903
904+  seg_info (abbrev_seg)->dwarf2_secsym = symbol_temp_new_now (); /* (TIGCC 20050407) */
905+
906   out_uleb128 (1);
907   out_uleb128 (DW_TAG_compile_unit);
908   out_byte (DW_CHILDREN_no);
909   out_abbrev (DW_AT_stmt_list, DW_FORM_data4);
910+#if 0 /* (TIGCC 20050407) */
911   if (all_segs->next == NULL)
912     {
913       out_abbrev (DW_AT_low_pc, DW_FORM_addr);
914       out_abbrev (DW_AT_high_pc, DW_FORM_addr);
915     }
916+#endif
917   out_abbrev (DW_AT_name, DW_FORM_string);
918   out_abbrev (DW_AT_comp_dir, DW_FORM_string);
919   out_abbrev (DW_AT_producer, DW_FORM_string);
920@@ -1249,6 +1276,7 @@
921   subseg_set (info_seg, 0);
922
923   info_start = symbol_temp_new_now ();
924+  seg_info (info_seg)->dwarf2_secsym = info_start; /* (TIGCC 20050407) */
925   info_end = symbol_temp_make ();
926
927   /* Compilation Unit length.  */
928@@ -1297,6 +1325,7 @@
929   /* ??? sizeof_offset */
930   TC_DWARF2_EMIT_OFFSET (section_symbol (line_seg), 4);
931
932+#if 0 /* (TIGCC 20050407) */
933   /* These two attributes may only be emitted if all of the code is
934      contiguous.  Multiple sections are not that.  */
935   if (all_segs->next == NULL)
936@@ -1313,6 +1342,7 @@
937       expr.X_add_number = 0;
938       emit_expr (&expr, sizeof_address);
939     }
940+#endif
941
942   /* DW_AT_name.  We don't have the actual file name that was present
943      on the command line, so assume files[1] is the main input file.
944@@ -1366,8 +1396,37 @@
945   segT info_seg;
946   int emit_other_sections = 0;
947
948+#ifdef BFD_ASSEMBLER
949   info_seg = bfd_get_section_by_name (stdoutput, ".debug_info");
950   emit_other_sections = info_seg == NULL || !seg_not_empty_p (info_seg);
951+#else
952+/* (TIGCC 20050403) Yes, this is ugly, it is mostly copied out of subseg_new and
953+                    should be in its own function. -- Kevin Kofler */
954+  int i;
955+  info_seg = (segT)(-1);
956+  for (i = 0; i < (int) SEG_MAXIMUM_ORDINAL; i++)
957+    {
958+      const char *s;
959+
960+      s = segment_name ((segT) i);
961+      if (strcmp (".debug_info", s) == 0
962+          || (strcmp ("debug_info", s) == 0))
963+        {
964+          info_seg = (segT) i;
965+          break;
966+        }
967+#ifdef obj_segment_name
968+      s = obj_segment_name ((segT) i);
969+      if (strcmp (".debug_info", s) == 0
970+          || (strcmp ("debug_info", s) == 0))
971+        {
972+          info_seg = (segT) i;
973+          break;
974+        }
975+#endif
976+    }
977+  emit_other_sections = info_seg == (segT)(-1) || !seg_not_empty_p (info_seg);
978+#endif
979
980   if (!all_segs && emit_other_sections)
981     /* There is no line information and no non-empty .debug_info
982@@ -1375,11 +1434,17 @@
983     return;
984
985   /* Calculate the size of an address for the target machine.  */
986+#ifdef BFD_ASSEMBLER
987   sizeof_address = DWARF2_ADDR_SIZE (stdoutput);
988+#else
989+  sizeof_address = 4;
990+#endif
991
992   /* Create and switch to the line number section.  */
993   line_seg = subseg_new (".debug_line", 0);
994+#ifdef BFD_ASSEMBLER
995   bfd_set_section_flags (stdoutput, line_seg, SEC_READONLY | SEC_DEBUGGING);
996+#endif
997
998   /* For each subsection, chain the debug entries together.  */
999   for (s = all_segs; s; s = s->next)
1000@@ -1410,12 +1475,14 @@
1001       abbrev_seg = subseg_new (".debug_abbrev", 0);
1002       aranges_seg = subseg_new (".debug_aranges", 0);
1003
1004+#ifdef BFD_ASSEMBLER
1005       bfd_set_section_flags (stdoutput, info_seg,
1006 			     SEC_READONLY | SEC_DEBUGGING);
1007       bfd_set_section_flags (stdoutput, abbrev_seg,
1008 			     SEC_READONLY | SEC_DEBUGGING);
1009       bfd_set_section_flags (stdoutput, aranges_seg,
1010 			     SEC_READONLY | SEC_DEBUGGING);
1011+#endif
1012
1013       record_alignment (aranges_seg, ffs (2 * sizeof_address) - 1);
1014
1015diff -Naur binutils-2.16.1.orig/gas/dwarf2dbg.h binutils-2.16.1-src/gas/dwarf2dbg.h
1016--- binutils-2.16.1.orig/gas/dwarf2dbg.h	Thu Mar  3 01:29:52 2005
1017+++ binutils-2.16.1-src/gas/dwarf2dbg.h	Thu Jun 30 23:40:16 2005
1018@@ -61,6 +61,7 @@
1019
1020 /* Must be called for each generated instruction.  */
1021 extern void dwarf2_emit_insn (int);
1022+extern void dwarf2_emit_insn_if_loc_seen (int);
1023
1024 extern void dwarf2_finish (void);
1025
1026diff -Naur binutils-2.16.1.orig/gas/expr.c binutils-2.16.1-src/gas/expr.c
1027--- binutils-2.16.1.orig/gas/expr.c	Thu Mar  3 17:22:12 2005
1028+++ binutils-2.16.1-src/gas/expr.c	Thu Jun 30 23:40:16 2005
1029@@ -1751,8 +1751,11 @@
1030 	  /* X + constant.  */
1031 	  resultP->X_add_number += right.X_add_number;
1032 	}
1033-      /* This case comes up in PIC code.  */
1034-      else if (op_left == O_subtract
1035+      /* This case comes up in PIC code.
1036+         (TIGCC 20040719) This optimization isn't valid in all-relocs mode.
1037+                          -- Kevin Kofler  */
1038+      else if (!flag_all_relocs
1039+	       && op_left == O_subtract
1040 	       && right.X_op == O_symbol
1041 	       && resultP->X_op == O_symbol
1042 	       && (symbol_get_frag (right.X_add_symbol)
1043@@ -1848,6 +1851,15 @@
1044 		       && right.X_add_number == 0)))
1045 	{
1046 	  /* Symbol OP symbol.  */
1047+
1048+	  /* (TIGCC 20030717) Optimize .set sym2,sym3+c; sym1-sym2 to
1049+	     .set sym2,sym3+c; sym1-(sym3+c). The code below will further change
1050+	     this to .set sym2,sym3+c; (sym1-c)-sym3. -- Kevin Kofler  */
1051+	  if (!right.X_add_number && right.X_add_symbol->sy_value.X_op == O_symbol) {
1052+	    resolve_symbol_value(right.X_add_symbol);
1053+	    memcpy(&right, &right.X_add_symbol->sy_value, sizeof(expressionS));
1054+	  }
1055+
1056 	  resultP->X_op = op_left;
1057 	  resultP->X_op_symbol = right.X_add_symbol;
1058 	  if (op_left == O_add)
1059diff -Naur binutils-2.16.1.orig/gas/frags.h binutils-2.16.1-src/gas/frags.h
1060--- binutils-2.16.1.orig/gas/frags.h	Thu Mar  3 01:29:52 2005
1061+++ binutils-2.16.1-src/gas/frags.h	Thu Jun 30 23:40:16 2005
1062@@ -66,6 +66,9 @@
1063   char *fr_file;
1064   unsigned int fr_line;
1065
1066+  /* (TIGCC) Symbol at the beginning of the frag. May be NULL.  */
1067+  symbolS *fr_start_symbol;
1068+
1069 #ifndef NO_LISTING
1070   struct list_info_struct *line;
1071 #endif
1072diff -Naur binutils-2.16.1.orig/gas/listing.c binutils-2.16.1-src/gas/listing.c
1073--- binutils-2.16.1.orig/gas/listing.c	Thu Mar  3 01:29:52 2005
1074+++ binutils-2.16.1-src/gas/listing.c	Thu Jun 30 23:40:16 2005
1075@@ -944,7 +944,8 @@
1076   int show_listing = 1;
1077   unsigned int width;
1078
1079-  buffer = xmalloc (listing_rhs_width);
1080+  buffer = xmalloc (listing_rhs_width + 1); /* (TIGCC 20030901) Add 1 for the
1081+    terminating '\0' character. -- Kevin Kofler  */
1082   data_buffer = xmalloc (MAX_BYTES);
1083   eject = 1;
1084   list = head;
1085@@ -962,8 +963,8 @@
1086     {
1087       unsigned int list_line;
1088
1089-      width = listing_rhs_width > paper_width ? paper_width :
1090-	listing_rhs_width;
1091+      width = (listing_rhs_width > paper_width ? paper_width :
1092+	listing_rhs_width) + 1; /* (TIGCC 20030901) See above.  */
1093
1094       list_line = list->line;
1095       switch (list->edict)
1096diff -Naur binutils-2.16.1.orig/gas/read.c binutils-2.16.1-src/gas/read.c
1097--- binutils-2.16.1.orig/gas/read.c	Wed Apr 13 19:58:40 2005
1098+++ binutils-2.16.1-src/gas/read.c	Thu Jun 30 23:40:16 2005
1099@@ -40,6 +40,7 @@
1100 #include "obstack.h"
1101 #include "listing.h"
1102 #include "ecoff.h"
1103+#include "dwarf2dbg.h"
1104 #include "dw2gencfi.h"
1105
1106 #ifndef TC_START_LABEL
1107@@ -3273,6 +3274,14 @@
1108 	{
1109 	  symbolS *s = exp.X_add_symbol;
1110
1111+	  /* (TIGCC 20050611) Don't evaluate defined+const here, as this breaks
1112+	                      all-relocs mode. -- Kevin Kofler */
1113+	  if (exp.X_add_number != 0)
1114+	    {
1115+	      symbol_set_value_expression (symbolP, &exp);
1116+	      break;
1117+	    }
1118+
1119 	  S_SET_SEGMENT (symbolP, seg);
1120 	  S_SET_VALUE (symbolP, exp.X_add_number + S_GET_VALUE (s));
1121 	  symbol_set_frag (symbolP, symbol_get_frag (s));
1122@@ -3427,7 +3436,13 @@
1123 void
1124 cons (int size)
1125 {
1126+  /* (TIGCC 20050603) Call dwarf2_emit_insn_if_loc_seen unless we are in a
1127+                      debugging info section. -- Kevin Kofler */
1128+  const char *segname;
1129   cons_worker (size, 0);
1130+  segname = seg_info (now_seg)->scnhdr.s_name;
1131+  if (strncmp (segname, ".debug_", 7) && strncmp (segname, ".eh_", 4))
1132+    dwarf2_emit_insn_if_loc_seen (size);
1133 }
1134
1135 void
1136@@ -3768,8 +3783,9 @@
1137 #define TC_CONS_RELOC 0
1138 #endif
1139 #endif
1140+      /* (TIGCC 20040920) Constants aren't optimizable relocs. -- Kevin Kofler */
1141       fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
1142-		   TC_CONS_RELOC);
1143+		   TC_CONS_RELOC) -> fx_unoptimizable = 1;
1144 #endif /* TC_CONS_FIX_NEW */
1145 #endif /* BFD_ASSEMBLER */
1146     }
1147diff -Naur binutils-2.16.1.orig/gas/subsegs.c binutils-2.16.1-src/gas/subsegs.c
1148--- binutils-2.16.1.orig/gas/subsegs.c	Thu Mar  3 11:47:44 2005
1149+++ binutils-2.16.1-src/gas/subsegs.c	Thu Jun 30 23:40:16 2005
1150@@ -41,6 +41,8 @@
1151
1152 #endif /* MANY_SEGMENTS */
1153 char const *const seg_name[] = {
1154+/* (TIGCC 20040905) Allow arbitrary number of sections here. -- Kevin Kofler */
1155+#if 0
1156   "absolute",
1157 #ifdef MANY_SEGMENTS
1158   "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9",
1159@@ -52,6 +54,7 @@
1160   "data",
1161   "bss",
1162 #endif /* MANY_SEGMENTS */
1163+#endif /* 0 */
1164   "unknown",
1165   "ASSEMBLER-INTERNAL-LOGIC-ERROR!",
1166   "expr",
1167@@ -61,6 +64,17 @@
1168   "register",
1169   "",
1170 };				/* Used by error reporters, dumpers etc.  */
1171+
1172+char *segment_name (n) int n;
1173+{
1174+  if (!n) return "absolute";
1175+  else if (SEG_NORMAL(n)) {
1176+    static char s[8];
1177+    sprintf(s,"e%d",n-SEG_E0);
1178+    return s;
1179+  } else return seg_name[n-(N_SEGMENTS+1)];
1180+}
1181+
1182 #else /* BFD_ASSEMBLER */
1183
1184 /* Gas segment information for bfd_abs_section_ptr and
1185diff -Naur binutils-2.16.1.orig/gas/subsegs.h binutils-2.16.1-src/gas/subsegs.h
1186--- binutils-2.16.1.orig/gas/subsegs.h	Thu Feb 17 13:46:00 2005
1187+++ binutils-2.16.1-src/gas/subsegs.h	Thu Jun 30 23:40:16 2005
1188@@ -89,6 +89,7 @@
1189 #endif
1190
1191   symbolS *dot;
1192+  symbolS *dwarf2_secsym; /* (TIGCC 20050407) */
1193
1194   struct lineno_list *lineno_list_head;
1195   struct lineno_list *lineno_list_tail;
1196diff -Naur binutils-2.16.1.orig/gas/symbols.c binutils-2.16.1-src/gas/symbols.c
1197--- binutils-2.16.1.orig/gas/symbols.c	Wed Apr 13 19:58:40 2005
1198+++ binutils-2.16.1-src/gas/symbols.c	Thu Jun 30 23:40:16 2005
1199@@ -1143,6 +1143,14 @@
1200 		       || add_symbol == op_symbol)))
1201 	    report_op_error (symp, add_symbol, op_symbol);
1202
1203+	  /* (TIGCC 20040719) In all-relocs mode, we can't apply operations other
1204+	                      than + or - on an address or address difference.
1205+	                      -- Kevin Kofler */
1206+	  if (flag_all_relocs && finalize_syms
1207+	      && !(op == O_subtract || op == O_add)
1208+	      && final_seg == undefined_section)
1209+	    report_op_error (symp, add_symbol, op_symbol);
1210+
1211 	  if (final_seg == expr_section || final_seg == undefined_section)
1212 	    final_seg = absolute_section;
1213
1214diff -Naur binutils-2.16.1.orig/gas/symbols.h binutils-2.16.1-src/gas/symbols.h
1215--- binutils-2.16.1.orig/gas/symbols.h	Wed Apr 13 19:58:40 2005
1216+++ binutils-2.16.1-src/gas/symbols.h	Thu Jun 30 23:40:16 2005
1217@@ -144,11 +144,16 @@
1218 /*
1219  * Current means for getting from symbols to segments and vice verse.
1220  * This will change for infinite-segments support (e.g. COFF).
1221+ * (TIGCC 20040905) And indeed it does. -- Kevin Kofler
1222  */
1223 extern const segT N_TYPE_seg[];	/* subseg.c */
1224
1225+#if 0
1226 #define	SEGMENT_TO_SYMBOL_TYPE(seg)  ( seg_N_TYPE [(int) (seg)] )
1227 extern const short seg_N_TYPE[];/* subseg.c */
1228+#else
1229+short SEGMENT_TO_SYMBOL_TYPE PARAMS ((int seg));
1230+#endif
1231
1232 #define	N_REGISTER	30	/* Fake N_TYPE value for SEG_REGISTER */
1233
1234diff -Naur binutils-2.16.1.orig/gas/write.c binutils-2.16.1-src/gas/write.c
1235--- binutils-2.16.1.orig/gas/write.c	Thu Mar  3 01:29:52 2005
1236+++ binutils-2.16.1-src/gas/write.c	Thu Jun 30 23:40:16 2005
1237@@ -217,6 +217,7 @@
1238 #if defined(NEED_FX_R_TYPE) || defined (BFD_ASSEMBLER)
1239   fixP->fx_r_type = r_type;
1240 #endif
1241+  fixP->fx_unoptimizable = 0; /* (TIGCC 20040920) */
1242   fixP->fx_im_disp = 0;
1243   fixP->fx_pcrel_adjust = 0;
1244   fixP->fx_bit_fixP = 0;
1245@@ -831,6 +832,11 @@
1246 	    continue;
1247 	  }
1248
1249+	/* (TIGCC 20030716) Only reduce relocs which refer to local symbols we
1250+	                    aren't going to output. -- Kevin Kofler  */
1251+	if (! S_IS_LOCAL (sym))
1252+		continue;
1253+
1254 	/* Don't try to reduce relocs which refer to non-local symbols
1255            in .linkonce sections.  It can lead to confusion when a
1256            debugging section refers to a .linkonce section.  I hope
1257@@ -1381,7 +1387,7 @@
1258       /* This now gets called even if we had errors.  In that case,
1259          any alignment is meaningless, and, moreover, will look weird
1260          if we are generating a listing.  */
1261-      if (!had_errors ())
1262+      if (0 /*!had_errors ()*/)
1263 	{
1264 	  alignment = SUB_SEGMENT_ALIGN (now_seg, frchainP);
1265 #ifdef BFD_ASSEMBLER
1266diff -Naur binutils-2.16.1.orig/gas/write.h binutils-2.16.1-src/gas/write.h
1267--- binutils-2.16.1.orig/gas/write.h	Thu Mar  3 01:29:52 2005
1268+++ binutils-2.16.1-src/gas/write.h	Thu Jun 30 23:40:16 2005
1269@@ -71,9 +71,12 @@
1270      look into it for version 2.6.  */
1271   unsigned fx_plt : 1;
1272
1273+  /* (TIGCC 20040920) Is this an unoptimizable reloc? -- Kevin Kofler  */
1274+  unsigned fx_unoptimizable : 1;
1275+
1276   /* Is this value an immediate displacement?  */
1277   /* Only used on i960 and ns32k; merge it into TC_FIX_TYPE sometime.  */
1278-  unsigned fx_im_disp : 2;
1279+  unsigned fx_im_disp : 1;
1280
1281   /* A bit for the CPU specific code.
1282      This probably can be folded into tc_fix_data, below.  */
1283diff -Naur binutils-2.16.1.orig/include/coff/internal.h binutils-2.16.1-src/include/coff/internal.h
1284--- binutils-2.16.1.orig/include/coff/internal.h	Thu Mar  3 11:58:04 2005
1285+++ binutils-2.16.1-src/include/coff/internal.h	Thu Jun 30 23:40:16 2005
1286@@ -350,6 +350,9 @@
1287
1288 #define STYP_LIT	0x8020	/* Literal data (like STYP_TEXT) */
1289
1290+/* (TIGCC 20040724) TIGCC COFF extensions for section flags -- Kevin Kofler */
1291+#define STYP_MERGEABLE 0x1000000
1292+#define STYP_UNALIGNED 0x2000000
1293
1294 /********************** LINE NUMBERS **********************/
1295
1296@@ -743,5 +746,10 @@
1297 #define R_W65_PCR16	9
1298
1299 #define R_W65_DP       10  /* direct page 8 bits only   */
1300+
1301+/* (TIGCC 20030716, 20040920) TIGCC COFF extensions -- Kevin Kofler  */
1302+#define R_RELWORD_NEG 0x7161
1303+#define R_RELBYTE_NEG 0x7162
1304+#define R_UNOPTIMIZABLE 0x8000
1305
1306 #endif /* GNU_COFF_INTERNAL_H */
1307diff -Naur binutils-2.16.1.orig/opcodes/configure binutils-2.16.1-src/opcodes/configure
1308--- binutils-2.16.1.orig/opcodes/configure	Mon Jan 31 20:30:36 2005
1309+++ binutils-2.16.1-src/opcodes/configure	Thu Jun 30 23:40:16 2005
1310@@ -271,7 +271,7 @@
1311 PACKAGE_STRING=
1312 PACKAGE_BUGREPORT=
1313
1314-ac_unique_file="z8k-dis.c"
1315+ac_unique_file="m68k-dis.c"
1316 # Factoring default headers for most tests.
1317 ac_includes_default="\
1318 #include <stdio.h>
1319diff -Naur binutils-2.16.1.orig/opcodes/configure.in binutils-2.16.1-src/opcodes/configure.in
1320--- binutils-2.16.1.orig/opcodes/configure.in	Mon Nov  8 13:17:36 2004
1321+++ binutils-2.16.1-src/opcodes/configure.in	Thu Jun 30 23:40:16 2005
1322@@ -3,7 +3,7 @@
1323
1324 AC_PREREQ(2.59)
1325 AC_INIT
1326-AC_CONFIG_SRCDIR([z8k-dis.c])
1327+AC_CONFIG_SRCDIR([m68k-dis.c])
1328
1329 AC_CANONICAL_TARGET
1330 AC_ISC_POSIX
1331diff -Naur binutils-2.16.1.orig/opcodes/m68k-opc.c binutils-2.16.1-src/opcodes/m68k-opc.c
1332--- binutils-2.16.1.orig/opcodes/m68k-opc.c	Mon May 24 16:33:22 2004
1333+++ binutils-2.16.1-src/opcodes/m68k-opc.c	Thu Jun 30 23:40:16 2005
1334@@ -116,6 +116,22 @@
1335 {"asrl", 2,	one(0160200),	one(0170770), "QdDs", m68000up | mcfisa_a },
1336 {"asrl", 2,	one(0160240),	one(0170770), "DdDs", m68000up | mcfisa_a },
1337
1338+/* (TIGCC 20050130) New branch type: variable-size, word by default. */
1339+{"bhi",	2, one(0061000),	one(0177777), "BG", m68000up | mcfisa_a },
1340+{"bls",	2, one(0061400),	one(0177777), "BG", m68000up | mcfisa_a },
1341+{"bcc",	2, one(0062000),	one(0177777), "BG", m68000up | mcfisa_a },
1342+{"bcs",	2, one(0062400),	one(0177777), "BG", m68000up | mcfisa_a },
1343+{"bne",	2, one(0063000),	one(0177777), "BG", m68000up | mcfisa_a },
1344+{"beq",	2, one(0063400),	one(0177777), "BG", m68000up | mcfisa_a },
1345+{"bvc",	2, one(0064000),	one(0177777), "BG", m68000up | mcfisa_a },
1346+{"bvs",	2, one(0064400),	one(0177777), "BG", m68000up | mcfisa_a },
1347+{"bpl",	2, one(0065000),	one(0177777), "BG", m68000up | mcfisa_a },
1348+{"bmi",	2, one(0065400),	one(0177777), "BG", m68000up | mcfisa_a },
1349+{"bge",	2, one(0066000),	one(0177777), "BG", m68000up | mcfisa_a },
1350+{"blt",	2, one(0066400),	one(0177777), "BG", m68000up | mcfisa_a },
1351+{"bgt",	2, one(0067000),	one(0177777), "BG", m68000up | mcfisa_a },
1352+{"ble",	2, one(0067400),	one(0177777), "BG", m68000up | mcfisa_a },
1353+
1354 {"bhiw", 2,	one(0061000),	one(0177777), "BW", m68000up | mcfisa_a },
1355 {"blsw", 2,	one(0061400),	one(0177777), "BW", m68000up | mcfisa_a },
1356 {"bccw", 2,	one(0062000),	one(0177777), "BW", m68000up | mcfisa_a },
1357@@ -199,6 +215,8 @@
1358
1359 {"bkpt", 2,	one(0044110),	one(0177770), "ts", m68010up },
1360
1361+/* (TIGCC 20050130) New branch type: variable-size, word by default. */
1362+{"bra",	2, one(0060000),	one(0177777), "BG", m68000up | mcfisa_a },
1363 {"braw", 2,	one(0060000),	one(0177777), "BW", m68000up | mcfisa_a },
1364 {"bral", 2,	one(0060377),	one(0177777), "BL", m68020up | cpu32 | mcfisa_b},
1365 {"bras", 2,	one(0060000),	one(0177400), "BB", m68000up | mcfisa_a },
1366@@ -208,6 +226,8 @@
1367 {"bset", 4,	one(0004300),	one(0177700), "#b$s", m68000up },
1368 {"bset", 4,	one(0004300),	one(0177700), "#bqs", mcfisa_a },
1369
1370+/* (TIGCC 20050130) New branch type: variable-size, word by default. */
1371+{"bsr",	2, one(0060400),	one(0177777), "BG", m68000up | mcfisa_a },
1372 {"bsrw", 2,	one(0060400),	one(0177777), "BW", m68000up | mcfisa_a },
1373 {"bsrl", 2,	one(0060777),	one(0177777), "BL", m68020up | cpu32 | mcfisa_b},
1374 {"bsrs", 2,	one(0060400),	one(0177400), "BB", m68000up | mcfisa_a },
1375@@ -254,6 +274,7 @@
1376
1377 {"clrb", 2,	one(0041000),	one(0177700), "$s", m68000up | mcfisa_a },
1378 {"clrw", 2,	one(0041100),	one(0177700), "$s", m68000up | mcfisa_a },
1379+{"clrl", 2,	one(0070000),	one(0170477), "Dd", m68000 },
1380 {"clrl", 2,	one(0041200),	one(0177700), "$s", m68000up | mcfisa_a },
1381
1382 {"cmp2b", 4,	two(0000300,0), two(0177700,07777), "!sR1", m68020up | cpu32 },
1383@@ -263,11 +284,11 @@
1384 {"cmpaw", 2,	one(0130300),	one(0170700), "*wAd", m68000up },
1385 {"cmpal", 2,	one(0130700),	one(0170700), "*lAd", m68000up | mcfisa_a },
1386
1387-{"cmpib", 4,	one(0006000),	one(0177700), "#b@s", m68000up },
1388+{"cmpib", 4,	one(0006000),	one(0177700), "#b$s", m68000up },
1389 {"cmpib", 4,	one(0006000),	one(0177700), "#bDs", mcfisa_b },
1390-{"cmpiw", 4,	one(0006100),	one(0177700), "#w@s", m68000up },
1391+{"cmpiw", 4,	one(0006100),	one(0177700), "#w$s", m68000up },
1392 {"cmpiw", 4,	one(0006100),	one(0177700), "#wDs", mcfisa_b },
1393-{"cmpil", 6,	one(0006200),	one(0177700), "#l@s", m68000up },
1394+{"cmpil", 6,	one(0006200),	one(0177700), "#l$s", m68000up },
1395 {"cmpil", 6,	one(0006200),	one(0177700), "#lDs", mcfisa_a },
1396
1397 {"cmpmb", 2,	one(0130410),	one(0170770), "+s+d", m68000up },
1398@@ -275,18 +296,18 @@
1399 {"cmpml", 2,	one(0130610),	one(0170770), "+s+d", m68000up },
1400
1401 /* The cmp opcode can generate the cmpa, cmpm, and cmpi instructions.  */
1402-{"cmpb", 4,	one(0006000),	one(0177700), "#b@s", m68000up },
1403+{"cmpb", 4,	one(0006000),	one(0177700), "#b$s", m68000up },
1404 {"cmpb", 4,	one(0006000),	one(0177700), "#bDs", mcfisa_b },
1405 {"cmpb", 2,	one(0130410),	one(0170770), "+s+d", m68000up },
1406 {"cmpb", 2,	one(0130000),	one(0170700), ";bDd", m68000up },
1407 {"cmpb", 2,	one(0130000),	one(0170700), "*bDd", mcfisa_b },
1408 {"cmpw", 2,	one(0130300),	one(0170700), "*wAd", m68000up },
1409-{"cmpw", 4,	one(0006100),	one(0177700), "#w@s", m68000up },
1410+{"cmpw", 4,	one(0006100),	one(0177700), "#w$s", m68000up },
1411 {"cmpw", 4,	one(0006100),	one(0177700), "#wDs", mcfisa_b },
1412 {"cmpw", 2,	one(0130510),	one(0170770), "+s+d", m68000up },
1413 {"cmpw", 2,	one(0130100),	one(0170700), "*wDd", m68000up | mcfisa_b },
1414 {"cmpl", 2,	one(0130700),	one(0170700), "*lAd", m68000up | mcfisa_a },
1415-{"cmpl", 6,	one(0006200),	one(0177700), "#l@s", m68000up },
1416+{"cmpl", 6,	one(0006200),	one(0177700), "#l$s", m68000up },
1417 {"cmpl", 6,	one(0006200),	one(0177700), "#lDs", mcfisa_a },
1418 {"cmpl", 2,	one(0130610),	one(0170770), "+s+d", m68000up },
1419 {"cmpl", 2,	one(0130200),	one(0170700), "*lDd", m68000up | mcfisa_a },
1420@@ -2181,6 +2202,7 @@
1421
1422 const struct m68k_opcode_alias m68k_opcode_aliases[] =
1423 {
1424+  { "abcdb",	"abcd", }, /* (TIGCC 20030901) */
1425   { "add",	"addw", },
1426   { "adda",	"addaw", },
1427   { "addi",	"addiw", },
1428@@ -2188,22 +2210,6 @@
1429   { "addx",	"addxw", },
1430   { "asl",	"aslw", },
1431   { "asr",	"asrw", },
1432-  { "bhi",	"bhiw", },
1433-  { "bls",	"blsw", },
1434-  { "bcc",	"bccw", },
1435-  { "bcs",	"bcsw", },
1436-  { "bne",	"bnew", },
1437-  { "beq",	"beqw", },
1438-  { "bvc",	"bvcw", },
1439-  { "bvs",	"bvsw", },
1440-  { "bpl",	"bplw", },
1441-  { "bmi",	"bmiw", },
1442-  { "bge",	"bgew", },
1443-  { "blt",	"bltw", },
1444-  { "bgt",	"bgtw", },
1445-  { "ble",	"blew", },
1446-  { "bra",	"braw", },
1447-  { "bsr",	"bsrw", },
1448   { "bhib",	"bhis", },
1449   { "blsb",	"blss", },
1450   { "bccb",	"bccs", },
1451@@ -2220,17 +2226,17 @@
1452   { "bleb",	"bles", },
1453   { "brab",	"bras", },
1454   { "bsrb",	"bsrs", },
1455-  { "bhs",	"bccw" },
1456+  { "bhs",	"bcc" }, /* (TIGCC 20050130) No 'w'. */
1457   { "bhss",	"bccs" },
1458   { "bhsb",	"bccs" },
1459   { "bhsw",	"bccw" },
1460   { "bhsl",	"bccl" },
1461-  { "blo",	"bcsw" },
1462+  { "blo",	"bcs" }, /* (TIGCC 20050130) No 'w'. */
1463   { "blos",	"bcss" },
1464   { "blob",	"bcss" },
1465   { "blow",	"bcsw" },
1466   { "blol",	"bcsl" },
1467-  { "br",	"braw", },
1468+  { "br",	"bra", }, /* (TIGCC 20050130) No 'w'. */
1469   { "brs",	"bras", },
1470   { "brb",	"bras", },
1471   { "brw",	"braw", },
1472@@ -2279,6 +2285,7 @@
1473   { "tdivsl",	"divsl", },
1474   { "divs",	"divsw", },
1475   { "divu",	"divuw", },
1476+  { "exgl",	"exg", }, /* (TIGCC 20020512, 20030901) */
1477   { "ext",	"extw", },
1478   { "extbw",	"extw", },
1479   { "extwl",	"extl", },
1480