xref: /minix3/external/gpl3/binutils/patches/0000-binutils_nbsd.patch (revision b5e2faaaaf60a8b9a02f8d72f64caa56a87eb312)
1diff -rNU3 dist.orig/bfd/aoutx.h dist.nbsd/bfd/aoutx.h
2--- dist.orig/bfd/aoutx.h	Tue May  1 16:07:33 2012
3+++ dist.nbsd/bfd/aoutx.h	Wed Feb 19 16:39:32 2014
4@@ -762,7 +762,7 @@
5       break;
6
7     case bfd_arch_arm:
8-      if (machine == 0)
9+      if (machine == 0 || machine == 5)
10 	arch_flags = M_ARM;
11       break;
12
13diff -rNU3 dist.orig/bfd/archive.c dist.nbsd/bfd/archive.c
14--- dist.orig/bfd/archive.c	Mon Mar 25 08:06:19 2013
15+++ dist.nbsd/bfd/archive.c	Wed Feb 19 16:39:32 2014
16@@ -157,6 +157,9 @@
17 #define ar_maxnamelen(abfd) ((abfd)->xvec->ar_max_namelen)
18
19 #define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
20+
21+static const char * normalize (bfd *, const char *);
22+
23 #define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata (bfd)->arch_header)
24
25 /* True iff NAME designated a BSD 4.4 extended name.  */
26@@ -760,7 +763,9 @@
27       /* Pad to an even boundary...
28 	 Note that last_file->origin can be odd in the case of
29 	 BSD-4.4-style element with a long odd size.  */
30-      filestart += filestart % 2;
31+      if (!strncmp(arch_hdr (last_file)->ar_name, "#1/", 3))
32+	size += strlen(normalize(last_file, last_file->filename));
33+      filestart += size % 2;
34     }
35
36   return _bfd_get_elt_at_filepos (archive, filestart);
37@@ -2180,11 +2185,22 @@
38        current = current->archive_next)
39     {
40       char buffer[DEFAULT_BUFFERSIZE];
41-      bfd_size_type remaining = arelt_size (current);
42+      bfd_size_type saved_size = arelt_size (current);
43+      bfd_size_type remaining = saved_size;
44+      struct ar_hdr *hdr = arch_hdr (current);
45
46       /* Write ar header.  */
47       if (!_bfd_write_ar_hdr (arch, current))
48-	return FALSE;
49+        return FALSE;
50+      /* Write filename if it is a 4.4BSD extended file, and add to size.  */
51+      if (!strncmp (hdr->ar_name, "#1/", 3))
52+	{
53+	  const char *normal = normalize (current, current->filename);
54+	  unsigned int thislen = strlen (normal);
55+	  if (bfd_write (normal, 1, thislen, arch) != thislen)
56+	    return FALSE;
57+	  saved_size += thislen;
58+	}
59       if (bfd_is_thin_archive (arch))
60 	continue;
61       if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
62@@ -2457,11 +2473,19 @@
63 	{
64 	  do
65 	    {
66+#if 1
67+	      bfd_size_type size = arelt_size (current);
68+	      if (!strncmp(arch_hdr (current)->ar_name, "#1/", 3))
69+		size += strlen(normalize(current, current->filename));
70+	      firstreal += size + sizeof (struct ar_hdr);
71+	      firstreal += size % 2;
72+#else
73 	      struct areltdata *ared = arch_eltdata (current);
74
75 	      firstreal += (ared->parsed_size + ared->extra_size
76 			    + sizeof (struct ar_hdr));
77 	      firstreal += firstreal % 2;
78+#endif
79 	      current = current->archive_next;
80 	    }
81 	  while (current != map[count].u.abfd);
82diff -rNU3 dist.orig/bfd/bfd-in2.h dist.nbsd/bfd/bfd-in2.h
83--- dist.orig/bfd/bfd-in2.h	Tue Sep  4 12:53:41 2012
84+++ dist.nbsd/bfd/bfd-in2.h	Wed Feb 19 16:39:32 2014
85@@ -5788,6 +5788,11 @@
86   /* This BFD has been created by the linker and doesn't correspond
87      to any input file.  */
88 #define BFD_LINKER_CREATED 0x2000
89+  /* This may be set before writing out a BFD to request that it
90+  be written using values for UIDs, GIDs, timestamps, etc. that
91+  will be consistent from run to run.  */
92+#define BFD_DETERMINISTIC_OUTPUT 0x4000
93+
94
95   /* This may be set before writing out a BFD to request that it
96      be written using values for UIDs, GIDs, timestamps, etc. that
97diff -rNU3 dist.orig/bfd/coff-alpha.c dist.nbsd/bfd/coff-alpha.c
98--- dist.orig/bfd/coff-alpha.c	Fri Jul 13 14:22:42 2012
99+++ dist.nbsd/bfd/coff-alpha.c	Wed Feb 19 16:39:32 2014
100@@ -642,7 +642,9 @@
101     case ALPHA_R_OP_STORE:
102       /* The STORE reloc needs the size and offset fields.  We store
103 	 them in the addend.  */
104+#if 0
105       BFD_ASSERT (intern->r_offset <= 256);
106+#endif
107       rptr->addend = (intern->r_offset << 8) + intern->r_size;
108       break;
109
110diff -rNU3 dist.orig/bfd/config.bfd dist.nbsd/bfd/config.bfd
111--- dist.orig/bfd/config.bfd	Tue Sep  4 14:14:59 2012
112+++ dist.nbsd/bfd/config.bfd	Wed Feb 19 16:39:32 2014
113@@ -86,6 +86,7 @@
114 i[3-7]86)	 targ_archs=bfd_i386_arch ;;
115 i370)		 targ_archs=bfd_i370_arch ;;
116 lm32)	         targ_archs=bfd_lm32_arch ;;
117+m5200|m5407)	 targ_archs=bfd_m68k_arch ;;
118 m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
119 m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
120 m68*)		 targ_archs=bfd_m68k_arch ;;
121@@ -250,17 +251,17 @@
122     targ64_selvecs="bfd_elf32_x86_64_nacl_vec bfd_elf64_x86_64_nacl_vec"
123     targ_archs="$targ_archs bfd_i386_arch"
124     ;;
125-  armeb-*-netbsdelf*)
126+  arm*eb-*-netbsdelf*)
127     targ_defvec=bfd_elf32_bigarm_vec
128-    targ_selvecs="bfd_elf32_littlearm_vec armnetbsd_vec"
129+    targ_selvecs="bfd_elf32_littlearm_vec armnetbsd_vec armcoff_little_vec armcoff_big_vec"
130     ;;
131-  arm-*-netbsdelf*)
132+  arm*-*-netbsdelf*)
133     targ_defvec=bfd_elf32_littlearm_vec
134-    targ_selvecs="bfd_elf32_bigarm_vec armnetbsd_vec"
135+    targ_selvecs="bfd_elf32_bigarm_vec armnetbsd_vec armcoff_little_vec armcoff_big_vec"
136     ;;
137   arm-*-netbsd* | arm-*-openbsd*)
138     targ_defvec=armnetbsd_vec
139-    targ_selvecs="bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec"
140+    targ_selvecs="bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec armcoff_little_vec armcoff_big_vec"
141     targ_underscore=yes
142     targ_cflags=-D__QNXTARGET__
143     ;;
144@@ -845,12 +846,12 @@
145     # targ_selvecs=m68kmach3_vec
146     # targ_cflags=-DSTAT_FOR_EXEC
147     ;;
148-  m68*-hp*-netbsd*)
149+  m68k4k*-*-netbsd*)
150     targ_defvec=m68k4knetbsd_vec
151-    targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
152+    targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec bfd_elf32_m68k_vec"
153     targ_underscore=yes
154     ;;
155-  m68*-*-netbsdelf*)
156+  m68*-*-netbsdelf* | m5407-*-netbsdelf*)
157     targ_defvec=bfd_elf32_m68k_vec
158     targ_selvecs="m68knetbsd_vec m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
159     ;;
160@@ -923,6 +924,16 @@
161     targ_defvec=ecoff_big_vec
162     targ_selvecs=ecoff_little_vec
163     ;;
164+#ifdef BFD64
165+  mips64*el-*-netbsd*)
166+    targ_defvec=bfd_elf32_ntradlittlemips_vec
167+    targ_selvecs="bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec"
168+    ;;
169+  mips64*-*-netbsd*)
170+    targ_defvec=bfd_elf32_ntradbigmips_vec
171+    targ_selvecs="bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec"
172+    ;;
173+#endif
174   mips*el-*-netbsd*)
175     targ_defvec=bfd_elf32_tradlittlemips_vec
176     targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_little_vec ecoff_big_vec"
177@@ -1347,6 +1358,8 @@
178     want64=true
179     ;;
180
181+#endif
182+
183   sh*l*-*-netbsdelf*)
184     targ_defvec=bfd_elf32_shlnbsd_vec
185     targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
186@@ -1357,8 +1370,6 @@
187     targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
188     want64=true
189     ;;
190-#endif
191-
192   sh*-*-netbsdelf*)
193     targ_defvec=bfd_elf32_shnbsd_vec
194     targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
195@@ -1448,11 +1459,11 @@
196     ;;
197   sparc-*-netbsdelf*)
198     targ_defvec=bfd_elf32_sparc_vec
199-    targ_selvecs=sparcnetbsd_vec
200+    targ_selvecs="sparcnetbsd_vec sunos_big_vec"
201     ;;
202-  sparc-*-netbsdaout* | sparc-*-netbsd*)
203+  sparc-*-netbsd*)
204     targ_defvec=sparcnetbsd_vec
205-    targ_selvecs=bfd_elf32_sparc_vec
206+    targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
207     targ_underscore=yes
208     ;;
209   sparc-*-openbsd[0-2].* | sparc-*-openbsd3.[0-1])
210@@ -1499,6 +1510,10 @@
211     targ_defvec=bfd_elf64_sparc_vec
212     targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
213     want64=true
214+    ;;
215+  sparc64-*-netbsd*)
216+    targ_defvec=bfd_elf64_sparc_vec
217+    targ_selvecs="bfd_elf32_sparc_vec sparcnetbsd_vec sunos_big_vec"
218     ;;
219   sparc64-*-elf* | sparc64-*-rtems* )
220     targ_defvec=bfd_elf64_sparc_vec
221diff -rNU3 dist.orig/bfd/configure dist.nbsd/bfd/configure
222--- dist.orig/bfd/configure	Mon Mar 25 09:08:07 2013
223+++ dist.nbsd/bfd/configure	Wed Feb 19 16:39:32 2014
224@@ -12101,10 +12101,10 @@
225   withval=$with_pkgversion; case "$withval" in
226       yes) as_fn_error "package version not specified" "$LINENO" 5 ;;
227       no)  PKGVERSION= ;;
228-      *)   PKGVERSION="($withval) " ;;
229+      *)   PKGVERSION="($withval)\ " ;;
230      esac
231 else
232-  PKGVERSION="(GNU Binutils) "
233+  PKGVERSION="(GNU Binutils)\ "
234
235 fi
236
237@@ -13861,6 +13861,7 @@
238 	COREFILE=netbsd-core.lo
239 	;;
240   arm-*-riscix)		COREFILE=trad-core.lo ;;
241+  arm*-*-netbsd*)	COREFILE=netbsd-core.lo ;;
242   hppa*-*-hpux*)	COREFILE=hpux-core.lo ;;
243   hppa*-*-hiux*)	COREFILE=hpux-core.lo ;;
244   hppa*-*-mpeix*)	COREFILE=hpux-core.lo ;;
245@@ -13923,7 +13924,7 @@
246 	COREFILE=trad-core.lo
247 	TRAD_HEADER='"hosts/i860mach3.h"'
248 	;;
249-  mips-*-netbsd* | mips*-*-openbsd*)
250+  mips*-*-netbsd* | mips*-*-openbsd*)
251 	COREFILE=netbsd-core.lo
252 	;;
253   mips-dec-*)
254diff -rNU3 dist.orig/bfd/configure.host dist.nbsd/bfd/configure.host
255--- dist.orig/bfd/configure.host	Fri Dec 31 11:00:52 2010
256+++ dist.nbsd/bfd/configure.host	Wed Feb 19 16:39:32 2014
257@@ -57,6 +57,18 @@
258
259 m68*-hp-hpux*)		HDEFINES=-DHOST_HP300HPUX ;;
260
261+sparc64*-*-netbsd*)	host64=true; HOST_64BIT_TYPE=long ;;
262+
263+x86_64*-*-netbsd*)	host64=true; HOST_64BIT_TYPE=long ;;
264+
265+*-*-aix*)		HOST_64BIT_TYPE="long long"
266+			HOST_U_64BIT_TYPE="unsigned long long"
267+			;;
268+
269+*-*-solaris*)		HOST_64BIT_TYPE="long long"
270+			HOST_U_64BIT_TYPE="unsigned long long"
271+			;;
272+
273 # Some Solaris systems (osol0906 at least) have a libc that doesn't recognise
274 # the "MS-ANSI" code page name, so we define an override for CP_ACP (sets the
275 # default code page used by windres/windmc when not specified by a commandline
276diff -rNU3 dist.orig/bfd/configure.in dist.nbsd/bfd/configure.in
277--- dist.orig/bfd/configure.in	Mon Mar 25 09:08:05 2013
278+++ dist.nbsd/bfd/configure.in	Wed Feb 19 16:39:32 2014
279@@ -254,6 +254,7 @@
280 	COREFILE=netbsd-core.lo
281 	;;
282   arm-*-riscix)		COREFILE=trad-core.lo ;;
283+  arm*-*-netbsd*)	COREFILE=netbsd-core.lo ;;
284   hppa*-*-hpux*)	COREFILE=hpux-core.lo ;;
285   hppa*-*-hiux*)	COREFILE=hpux-core.lo ;;
286   hppa*-*-mpeix*)	COREFILE=hpux-core.lo ;;
287@@ -340,7 +341,7 @@
288 	COREFILE=trad-core.lo
289 	TRAD_HEADER='"hosts/i860mach3.h"'
290 	;;
291-  mips-*-netbsd* | mips*-*-openbsd*)
292+  mips*-*-netbsd* | mips*-*-openbsd*)
293 	COREFILE=netbsd-core.lo
294 	;;
295   mips-dec-*)
296diff -rNU3 dist.orig/bfd/doc/Makefile.in dist.nbsd/bfd/doc/Makefile.in
297--- dist.orig/bfd/doc/Makefile.in	Mon Mar 25 09:08:08 2013
298+++ dist.nbsd/bfd/doc/Makefile.in	Wed Feb 19 16:39:32 2014
299@@ -417,7 +417,9 @@
300 clean-libtool:
301 	-rm -rf .libs _libs
302
303-bfd.info: bfd.texinfo $(bfd_TEXINFOS)
304+bfd.info:
305+	@echo "NOT REBUILDING $@"
306+NetBSD_DISABLED_bfd.info: bfd.texinfo $(bfd_TEXINFOS)
307 	restore=: && backupdir="$(am__leading_dot)am$$$$" && \
308 	rm -rf $$backupdir && mkdir $$backupdir && \
309 	if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
310diff -rNU3 dist.orig/bfd/doc/reloc.texi dist.nbsd/bfd/doc/reloc.texi
311--- dist.orig/bfd/doc/reloc.texi	Tue Nov 13 14:19:29 2012
312+++ dist.nbsd/bfd/doc/reloc.texi	Wed Feb 19 16:39:32 2014
313@@ -570,6 +570,12 @@
314 @deffnx {} BFD_RELOC_68K_TLS_LE8
315 Relocations used by 68K ELF.
316 @end deffn
317+@deffn {} BFD_RELOC_VAX_GLOB_DAT
318+@deffnx {} BFD_RELOC_VAX_GLOB_REF
319+@deffnx {} BFD_RELOC_VAX_JMP_SLOT
320+@deffnx {} BFD_RELOC_VAX_RELATIVE
321+Relocations used by VAX ELF.
322+@end deffn
323 @deffn {} BFD_RELOC_32_BASEREL
324 @deffnx {} BFD_RELOC_16_BASEREL
325 @deffnx {} BFD_RELOC_LO16_BASEREL
326diff -rNU3 dist.orig/bfd/elf.c dist.nbsd/bfd/elf.c
327--- dist.orig/bfd/elf.c	Mon Mar 25 08:06:19 2013
328+++ dist.nbsd/bfd/elf.c	Wed Feb 19 16:39:32 2014
329@@ -8756,6 +8756,23 @@
330 	  return TRUE;
331 	}
332
333+      /* On SuperH, PT_GETREGS == mach+3 and PT_GETFPREGS == mach+5.
334+	 There's also old PT___GETREGS40 == mach + 1 for old reg
335+	 structure which lacks GBR.  */
336+
337+    case bfd_arch_sh:
338+      switch (note->type)
339+	{
340+	case NT_NETBSDCORE_FIRSTMACH+3:
341+	  return elfcore_make_note_pseudosection (abfd, ".reg", note);
342+
343+	case NT_NETBSDCORE_FIRSTMACH+5:
344+	  return elfcore_make_note_pseudosection (abfd, ".reg2", note);
345+
346+	default:
347+	  return TRUE;
348+	}
349+
350       /* On all other arch's, PT_GETREGS == mach+1 and
351 	 PT_GETFPREGS == mach+3.  */
352
353diff -rNU3 dist.orig/bfd/elf32-arm.c dist.nbsd/bfd/elf32-arm.c
354--- dist.orig/bfd/elf32-arm.c	Mon Mar 25 08:06:19 2013
355+++ dist.nbsd/bfd/elf32-arm.c	Wed Feb 19 16:39:32 2014
356@@ -13475,6 +13475,10 @@
357 	{
358 	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
359
360+          if (info->warn_shared_textrel)
361+            (*_bfd_error_handler)
362+              (_("warning: dynamic relocation in readonly section `%s'"),
363+              h->root.root.string);
364 	  info->flags |= DF_TEXTREL;
365
366 	  /* Not an error, just cut short the traversal.  */
367diff -rNU3 dist.orig/bfd/elf32-hppa.c dist.nbsd/bfd/elf32-hppa.c
368--- dist.orig/bfd/elf32-hppa.c	Fri Jun 29 14:45:58 2012
369+++ dist.nbsd/bfd/elf32-hppa.c	Wed Feb 19 16:39:32 2014
370@@ -2191,6 +2191,10 @@
371 	{
372 	  struct bfd_link_info *info = inf;
373
374+          if (info->warn_shared_textrel)
375+            (*_bfd_error_handler)
376+              (_("warning: dynamic relocation in readonly section `%s'"),
377+              eh->root.root.string);
378 	  info->flags |= DF_TEXTREL;
379
380 	  /* Not an error, just cut short the traversal.  */
381diff -rNU3 dist.orig/bfd/elf32-i386.c dist.nbsd/bfd/elf32-i386.c
382--- dist.orig/bfd/elf32-i386.c	Mon Mar 25 08:06:19 2013
383+++ dist.nbsd/bfd/elf32-i386.c	Wed Feb 19 16:39:32 2014
384@@ -518,7 +518,7 @@
385 /* The name of the dynamic interpreter.  This is put in the .interp
386    section.  */
387
388-#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
389+#define ELF_DYNAMIC_INTERPRETER "/libexec/ld.elf_so"
390
391 /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
392    copying dynamic variables from a shared lib into an app's dynbss
393@@ -2552,7 +2552,10 @@
394       if (s != NULL && (s->flags & SEC_READONLY) != 0)
395 	{
396 	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
397-
398+	  if (info->warn_shared_textrel)
399+	    (*_bfd_error_handler)
400+	      (_("warning: dynamic relocation in readonly section `%s'"),
401+	      h->root.root.string);
402 	  info->flags |= DF_TEXTREL;
403
404 	  if (info->warn_shared_textrel && info->shared)
405diff -rNU3 dist.orig/bfd/elf32-m68k.c dist.nbsd/bfd/elf32-m68k.c
406--- dist.orig/bfd/elf32-m68k.c	Fri Jul 13 14:22:47 2012
407+++ dist.nbsd/bfd/elf32-m68k.c	Wed Feb 19 16:39:33 2014
408@@ -2532,7 +2532,7 @@
409   if (ind->got_entry_key != 0)
410     {
411       BFD_ASSERT (dir->got_entry_key == 0);
412-      /* Assert that GOTs aren't partioned yet.  */
413+      /* Assert that GOTs aren't partitioned yet.  */
414       BFD_ASSERT (ind->glist == NULL);
415
416       dir->got_entry_key = ind->got_entry_key;
417diff -rNU3 dist.orig/bfd/elf32-ppc.c dist.nbsd/bfd/elf32-ppc.c
418--- dist.orig/bfd/elf32-ppc.c	Mon Mar 25 08:06:19 2013
419+++ dist.nbsd/bfd/elf32-ppc.c	Wed Feb 19 16:39:32 2014
420@@ -3898,7 +3898,7 @@
421 	    sec->has_tls_get_addr_call = 1;
422 	}
423
424-      switch (r_type)
425+      switch ((int)r_type)
426 	{
427 	case R_PPC_TLSGD:
428 	case R_PPC_TLSLD:
429@@ -7766,7 +7766,7 @@
430       howto = NULL;
431       if (r_type < R_PPC_max)
432 	howto = ppc_elf_howto_table[r_type];
433-      switch (r_type)
434+      switch ((int)r_type)
435 	{
436 	default:
437 	  info->callbacks->einfo
438diff -rNU3 dist.orig/bfd/elf32-sh.c dist.nbsd/bfd/elf32-sh.c
439--- dist.orig/bfd/elf32-sh.c	Mon Mar 25 08:06:20 2013
440+++ dist.nbsd/bfd/elf32-sh.c	Wed Feb 19 16:39:32 2014
441@@ -3285,6 +3285,10 @@
442 	{
443 	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
444
445+          if (info->warn_shared_textrel)
446+            (*_bfd_error_handler)
447+              (_("warning: dynamic relocation in readonly section `%s'"),
448+              h->root.root.string);
449 	  info->flags |= DF_TEXTREL;
450
451 	  /* Not an error, just cut short the traversal.  */
452diff -rNU3 dist.orig/bfd/elf32-vax.c dist.nbsd/bfd/elf32-vax.c
453--- dist.orig/bfd/elf32-vax.c	Tue Sep  4 13:32:53 2012
454+++ dist.nbsd/bfd/elf32-vax.c	Wed Feb 19 16:39:32 2014
455@@ -490,6 +490,24 @@
456   return TRUE;
457 }
458
459+/* Copy vax-specific data from one module to another */
460+static bfd_boolean
461+elf32_vax_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
462+{
463+  flagword in_flags;
464+
465+  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
466+      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
467+    return TRUE;
468+
469+  in_flags = elf_elfheader (ibfd)->e_flags;
470+
471+  elf_elfheader (obfd)->e_flags = in_flags;
472+  elf_flags_init (obfd) = TRUE;
473+
474+  return TRUE;
475+}
476+
477 /* Merge backend specific data from an object file to the output
478    object file when linking.  */
479 static bfd_boolean
480@@ -752,7 +770,13 @@
481 		    return FALSE;
482
483 		  if (sec->flags & SEC_READONLY)
484-		    info->flags |= DF_TEXTREL;
485+		    {
486+			if (info->warn_shared_textrel)
487+			  (*_bfd_error_handler)
488+			    (_("warning: dynamic relocation in readonly section `%s'"),
489+			     sec->name);
490+			info->flags |= DF_TEXTREL;
491+		    }
492 		}
493
494 	      sreloc->size += sizeof (Elf32_External_Rela);
495@@ -1186,7 +1210,12 @@
496 	continue;
497
498       /* Allocate memory for the section contents.  */
499-      s->contents = (bfd_byte *) bfd_alloc (dynobj, s->size);
500+      /* FIXME: This should be a call to bfd_alloc not bfd_zalloc.
501+	 Unused entries should be reclaimed before the section's contents
502+	 are written out, but at the moment this does not happen.  Thus in
503+	 order to prevent writing out garbage, we initialise the section's
504+	 contents to zero.  */
505+      s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
506       if (s->contents == NULL)
507 	return FALSE;
508     }
509@@ -1285,6 +1314,7 @@
510
511   if (!elf_hash_table (info)->dynamic_sections_created
512       || (info->shared && info->symbolic)
513+      || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
514       || h->forced_local)
515     {
516       h->got.refcount = 0;
517@@ -1305,9 +1335,7 @@
518
519       dyn = elf_hash_table (info)->dynamic_sections_created;
520       /* Allocate space in the .got and .rela.got sections.  */
521-      if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
522-	  && (info->shared
523-	      || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
524+      if (info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
525 	{
526 	  sgot->size += 4;
527 	  srelgot->size += sizeof (Elf32_External_Rela);
528@@ -1631,9 +1659,9 @@
529 		    {
530 		      relocate = TRUE;
531 		      outrel.r_info = ELF32_R_INFO (0, R_VAX_RELATIVE);
532-		      BFD_ASSERT (bfd_get_signed_32 (input_bfd,
533-						     &contents[rel->r_offset]) == 0);
534-		      outrel.r_addend = relocation + rel->r_addend;
535+		      outrel.r_addend = bfd_get_signed_32(input_bfd,
536+							 &contents[rel->r_offset])
537+					+ relocation + rel->r_addend;
538 		    }
539 		  else
540 		    {
541@@ -1672,6 +1700,9 @@
542 		    }
543 		}
544
545+	      if (input_section->flags & SEC_CODE)
546+		 info->flags |= DF_TEXTREL;
547+
548 	      if ((input_section->flags & SEC_CODE) != 0
549 		  || (ELF32_R_TYPE (outrel.r_info) != R_VAX_32
550 		      && ELF32_R_TYPE (outrel.r_info) != R_VAX_RELATIVE
551@@ -2051,12 +2082,15 @@
552 #define TARGET_LITTLE_SYM		bfd_elf32_vax_vec
553 #define TARGET_LITTLE_NAME		"elf32-vax"
554 #define ELF_MACHINE_CODE		EM_VAX
555-#define ELF_MAXPAGESIZE			0x1000
556+#define ELF_MAXPAGESIZE			0x10000
557
558 #define elf_backend_create_dynamic_sections \
559 					_bfd_elf_create_dynamic_sections
560 #define bfd_elf32_bfd_link_hash_table_create \
561 					elf_vax_link_hash_table_create
562+#define bfd_elf32_bfd_copy_private_bfd_data \
563+					elf32_vax_copy_private_bfd_data
564+
565 #define bfd_elf32_bfd_final_link	bfd_elf_gc_common_final_link
566
567 #define elf_backend_check_relocs	elf_vax_check_relocs
568diff -rNU3 dist.orig/bfd/elf64-alpha.c dist.nbsd/bfd/elf64-alpha.c
569--- dist.orig/bfd/elf64-alpha.c	Tue Jul 24 21:06:58 2012
570+++ dist.nbsd/bfd/elf64-alpha.c	Wed Feb 19 16:39:32 2014
571@@ -100,6 +100,11 @@
572 #define PLT_ENTRY_SIZE \
573   (elf64_alpha_use_secureplt ? NEW_PLT_ENTRY_SIZE : OLD_PLT_ENTRY_SIZE)
574
575+/* ld --traditional-format uses this older format instead. */
576+#define OLD_PLT_ENTRY_WORD1	0x279f0000	/* ldah $28, 0($31) */
577+#define OLD_PLT_ENTRY_WORD2	0x239c0000	/* lda  $28, 0($28) */
578+#define OLD_PLT_ENTRY_WORD3	0xc3e00000	/* br   $31, plt0   */
579+
580 #define MAX_GOT_SIZE		(64*1024)
581
582 #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so"
583@@ -4820,6 +4825,32 @@
584
585 		plt_index = ((gotent->plt_offset - NEW_PLT_HEADER_SIZE)
586 			     / NEW_PLT_ENTRY_SIZE);
587+	      }
588+	    else if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
589+	      {
590+	        long hi, lo;
591+
592+	        /* decompose the reloc offset for the plt for ldah+lda */
593+	        hi = plt_index * sizeof(Elf64_External_Rela);
594+	        lo = ((hi & 0xffff) ^ 0x8000) - 0x8000;
595+	        hi = (hi - lo) >> 16;
596+
597+	        insn = INSN_ABO (INSN_LDAH, 28, 31, hi);
598+		bfd_put_32 (output_bfd, insn,
599+			    splt->contents + gotent->plt_offset);
600+
601+	        insn = INSN_ABO (INSN_LDA, 28, 28, lo);
602+		bfd_put_32 (output_bfd, insn,
603+			    splt->contents + gotent->plt_offset + 4);
604+
605+		disp = -(gotent->plt_offset + 12);
606+		insn = INSN_AD (INSN_BR, 31, disp);
607+
608+		bfd_put_32 (output_bfd, insn,
609+			    splt->contents + gotent->plt_offset + 8);
610+
611+		plt_index = ((gotent->plt_offset - OLD_PLT_HEADER_SIZE)
612+			     / OLD_PLT_ENTRY_SIZE);
613 	      }
614 	    else
615 	      {
616diff -rNU3 dist.orig/bfd/elf64-mips.c dist.nbsd/bfd/elf64-mips.c
617--- dist.orig/bfd/elf64-mips.c	Tue Sep  4 14:13:07 2012
618+++ dist.nbsd/bfd/elf64-mips.c	Wed Feb 19 16:39:32 2014
619@@ -123,6 +123,8 @@
620   (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
621 static bfd_boolean mips_elf64_object_p
622   (bfd *);
623+static bfd_boolean mips_elf64_is_local_label_name
624+  (bfd *, const char *);
625 static irix_compat_t elf64_mips_irix_compat
626   (bfd *);
627 static bfd_boolean elf64_mips_grok_prstatus
628@@ -3917,7 +3919,18 @@
629   bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
630   return TRUE;
631 }
632+
633+/* MIPS ELF local labels start with "$L".  */
634+static bfd_boolean
635+mips_elf64_is_local_label_name (bfd *abfd, const char *name)
636+{
637+  if (name[0] == '$' && name[1] == 'L')
638+    return TRUE;
639
640+  /* We accept the generic ELF local label syntax as well.  */
641+  return _bfd_elf_is_local_label_name (abfd, name);
642+}
643+
644 /* Depending on the target vector we generate some version of Irix
645    executables or "normal" MIPS ELF ABI executables.  */
646 static irix_compat_t
647diff -rNU3 dist.orig/bfd/elf64-ppc.c dist.nbsd/bfd/elf64-ppc.c
648--- dist.orig/bfd/elf64-ppc.c	Mon Mar 25 08:06:20 2013
649+++ dist.nbsd/bfd/elf64-ppc.c	Wed Feb 19 16:39:33 2014
650@@ -9112,6 +9112,10 @@
651 	{
652 	  struct bfd_link_info *info = inf;
653
654+          if (info->warn_shared_textrel)
655+            (*_bfd_error_handler)
656+              (_("warning: dynamic relocation in readonly section `%s'"),
657+              h->root.root.string);
658 	  info->flags |= DF_TEXTREL;
659
660 	  /* Not an error, just cut short the traversal.  */
661diff -rNU3 dist.orig/bfd/elf64-x86-64.c dist.nbsd/bfd/elf64-x86-64.c
662--- dist.orig/bfd/elf64-x86-64.c	Mon Mar 25 08:06:20 2013
663+++ dist.nbsd/bfd/elf64-x86-64.c	Wed Feb 19 16:39:32 2014
664@@ -2589,6 +2589,10 @@
665 	{
666 	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
667
668+          if (info->warn_shared_textrel)
669+            (*_bfd_error_handler)
670+              (_("warning: dynamic relocation in readonly section `%s'"),
671+              h->root.root.string);
672 	  info->flags |= DF_TEXTREL;
673
674 	  if (info->warn_shared_textrel && info->shared)
675diff -rNU3 dist.orig/bfd/elflink.c dist.nbsd/bfd/elflink.c
676--- dist.orig/bfd/elflink.c	Mon Mar 25 08:06:20 2013
677+++ dist.nbsd/bfd/elflink.c	Wed Feb 19 16:39:32 2014
678@@ -10183,7 +10183,14 @@
679   if (bed->s->arch_size == 32)
680     irel[0].r_info = ELF32_R_INFO (indx, howto->type);
681   else
682-    irel[0].r_info = ELF64_R_INFO (indx, howto->type);
683+#ifdef BFD64
684+          {
685+            bfd_uint64_t indx64 = indx;
686+            irel[0].r_info = ELF64_R_INFO (indx64, howto->type);
687+          }
688+#else
689+          BFD_FAIL();
690+#endif
691
692   rel_hdr = reldata->hdr;
693   erel = rel_hdr->contents;
694diff -rNU3 dist.orig/bfd/elfn32-mips.c dist.nbsd/bfd/elfn32-mips.c
695--- dist.orig/bfd/elfn32-mips.c	Tue Sep  4 14:13:08 2012
696+++ dist.nbsd/bfd/elfn32-mips.c	Wed Feb 19 16:39:32 2014
697@@ -81,6 +81,8 @@
698   (bfd *, Elf_Internal_Note *);
699 static bfd_boolean elf32_mips_grok_psinfo
700   (bfd *, Elf_Internal_Note *);
701+static bfd_boolean mips_elf_n32_is_local_label_name
702+  (bfd *, const char *);
703 static irix_compat_t elf_n32_mips_irix_compat
704   (bfd *);
705
706@@ -3239,6 +3241,17 @@
707   }
708
709   return TRUE;
710+}
711+
712+/* MIPS ELF local labels start with "$L".  */
713+static bfd_boolean
714+mips_elf_n32_is_local_label_name (bfd *abfd, const char *name)
715+{
716+  if (name[0] == '$' && name[1] == 'L')
717+    return TRUE;
718+
719+  /* We accept the generic ELF local label syntax as well.  */
720+  return _bfd_elf_is_local_label_name (abfd, name);
721 }
722
723 /* Depending on the target vector we generate some version of Irix
724diff -rNU3 dist.orig/bfd/elfxx-mips.c dist.nbsd/bfd/elfxx-mips.c
725--- dist.orig/bfd/elfxx-mips.c	Mon Mar 25 08:06:20 2013
726+++ dist.nbsd/bfd/elfxx-mips.c	Wed Feb 19 16:39:32 2014
727@@ -8191,10 +8191,24 @@
728 		     reloc types into the output file as R_MIPS_REL32
729 		     relocs.  Make room for this reloc in .rel(a).dyn.  */
730 		  mips_elf_allocate_dynamic_relocations (dynobj, info, 1);
731-		  if (MIPS_ELF_READONLY_SECTION (sec))
732-		    /* We tell the dynamic linker that there are
733-		       relocations against the text segment.  */
734-		    info->flags |= DF_TEXTREL;
735+		  /* In the N32 and 64-bit ABIs there may be multiple
736+		     consecutive relocations for the same offset.  If we have
737+		     a R_MIPS_GPREL32 followed by a R_MIPS_64 then that
738+		     relocation is complete and needs no futher adjustment.  */
739+		  if ((rel == relocs
740+		      || rel[-1].r_offset != rel->r_offset
741+		      || r_type != R_MIPS_64
742+		      || ELF_R_TYPE(abfd, rel[-1].r_info) != R_MIPS_GPREL32)
743+		      && MIPS_ELF_READONLY_SECTION (sec))
744+		    {
745+		      /* We tell the dynamic linker that there are
746+		         relocations against the text segment.  */
747+		      info->flags |= DF_TEXTREL;
748+		      info->callbacks->warning
749+			(info,
750+			 _("relocation emitted against readonly section"),
751+			 NULL, abfd, sec, rel->r_offset);
752+		    }
753 		}
754 	      else
755 		{
756diff -rNU3 dist.orig/bfd/elfxx-sparc.c dist.nbsd/bfd/elfxx-sparc.c
757--- dist.orig/bfd/elfxx-sparc.c	Mon Mar 25 08:06:20 2013
758+++ dist.nbsd/bfd/elfxx-sparc.c	Wed Feb 19 16:39:32 2014
759@@ -2508,6 +2508,10 @@
760 	{
761 	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
762
763+          if (info->warn_shared_textrel)
764+            (*_bfd_error_handler)
765+              (_("warning: dynamic relocation in readonly section `%s'"),
766+              h->root.root.string);
767 	  info->flags |= DF_TEXTREL;
768
769 	  /* Not an error, just cut short the traversal.  */
770@@ -3460,10 +3464,8 @@
771 		memset (&outrel, 0, sizeof outrel);
772 	      /* h->dynindx may be -1 if the symbol was marked to
773 		 become local.  */
774-	      else if (h != NULL &&
775-		       h->dynindx != -1
776-		       && (! is_plt
777-			   || !info->shared
778+	      else if (h != NULL && h->dynindx != -1 && ! is_plt
779+		       && (!info->shared
780 			   || !SYMBOLIC_BIND (info, h)
781 			   || !h->def_regular))
782 		{
783diff -rNU3 dist.orig/bfd/libbfd.h dist.nbsd/bfd/libbfd.h
784--- dist.orig/bfd/libbfd.h	Tue Sep  4 12:53:42 2012
785+++ dist.nbsd/bfd/libbfd.h	Wed Feb 19 16:39:32 2014
786@@ -2313,6 +2313,7 @@
787   "BFD_RELOC_XC16X_SEG",
788   "BFD_RELOC_XC16X_SOF",
789   "BFD_RELOC_VAX_GLOB_DAT",
790+  "BFD_RELOC_VAX_GLOB_REF",
791   "BFD_RELOC_VAX_JMP_SLOT",
792   "BFD_RELOC_VAX_RELATIVE",
793   "BFD_RELOC_MT_PC16",
794diff -rNU3 dist.orig/bfd/reloc.c dist.nbsd/bfd/reloc.c
795--- dist.orig/bfd/reloc.c	Tue Sep  4 12:53:42 2012
796+++ dist.nbsd/bfd/reloc.c	Wed Feb 19 16:39:32 2014
797@@ -1776,6 +1776,17 @@
798   Relocations used by 68K ELF.
799
800 ENUM
801+  BFD_RELOC_VAX_GLOB_DAT
802+ENUMX
803+  BFD_RELOC_VAX_GLOB_REF
804+ENUMX
805+  BFD_RELOC_VAX_JMP_SLOT
806+ENUMX
807+  BFD_RELOC_VAX_RELATIVE
808+ENUMDOC
809+  Relocations used by VAX ELF.
810+
811+ENUM
812   BFD_RELOC_32_BASEREL
813 ENUMX
814   BFD_RELOC_16_BASEREL
815diff -rNU3 dist.orig/binutils/Makefile.in dist.nbsd/binutils/Makefile.in
816--- dist.orig/binutils/Makefile.in	Thu May 17 22:23:39 2012
817+++ dist.nbsd/binutils/Makefile.in	Wed Feb 19 16:39:33 2014
818@@ -1,4 +1,4 @@
819-# Makefile.in generated by automake 1.11.1 from Makefile.am.
820+# Makefile.in generated by automake 1.11 from Makefile.am.
821 # @configure_input@
822
823 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
824@@ -49,10 +49,12 @@
825 DIST_COMMON = NEWS README ChangeLog $(srcdir)/Makefile.in \
826 	$(srcdir)/Makefile.am $(top_srcdir)/configure \
827 	$(am__configure_deps) $(srcdir)/config.in \
828-	$(srcdir)/../mkinstalldirs $(top_srcdir)/po/Make-in arparse.h \
829-	arparse.c arlex.c defparse.h defparse.c deflex.c nlmheader.h \
830-	nlmheader.c arparse.h arparse.c arlex.c mcparse.h mcparse.c \
831-	rcparse.h rcparse.c $(srcdir)/../depcomp $(srcdir)/../ylwrap
832+	$(srcdir)/../mkinstalldirs $(srcdir)/../mkinstalldirs \
833+	$(top_srcdir)/po/Make-in arparse.h arparse.c arlex.c \
834+	defparse.h defparse.c deflex.c nlmheader.h nlmheader.c \
835+	arparse.h arparse.c arlex.c mcparse.h mcparse.c rcparse.h \
836+	rcparse.c $(srcdir)/../depcomp $(srcdir)/../depcomp \
837+	$(srcdir)/../ylwrap $(srcdir)/../ylwrap
838 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
839 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
840 	$(top_srcdir)/../config/zlib.m4 \
841@@ -385,6 +387,7 @@
842 libexecdir = @libexecdir@
843 localedir = @localedir@
844 localstatedir = @localstatedir@
845+lt_ECHO = @lt_ECHO@
846 mandir = @mandir@
847 mkdir_p = @mkdir_p@
848 oldincludedir = @oldincludedir@
849@@ -931,7 +934,7 @@
850 #     (which will cause the Makefiles to be regenerated when you run `make');
851 # (2) otherwise, pass the desired values on the `make' command line.
852 $(RECURSIVE_TARGETS):
853-	@fail= failcom='exit 1'; \
854+	@failcom='exit 1'; \
855 	for f in x $$MAKEFLAGS; do \
856 	  case $$f in \
857 	    *=* | --[!k]*);; \
858@@ -956,7 +959,7 @@
859 	fi; test -z "$$fail"
860
861 $(RECURSIVE_CLEAN_TARGETS):
862-	@fail= failcom='exit 1'; \
863+	@failcom='exit 1'; \
864 	for f in x $$MAKEFLAGS; do \
865 	  case $$f in \
866 	    *=* | --[!k]*);; \
867diff -rNU3 dist.orig/binutils/aclocal.m4 dist.nbsd/binutils/aclocal.m4
868--- dist.orig/binutils/aclocal.m4	Thu May 17 22:23:39 2012
869+++ dist.nbsd/binutils/aclocal.m4	Wed Feb 19 16:39:33 2014
870@@ -1,4 +1,4 @@
871-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
872+# generated automatically by aclocal 1.11 -*- Autoconf -*-
873
874 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
875 # 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
876@@ -19,6 +19,31 @@
877 If you have problems, you may need to regenerate the build system entirely.
878 To do so, use the procedure documented by the package, typically `autoreconf'.])])
879
880+# isc-posix.m4 serial 2 (gettext-0.11.2)
881+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
882+dnl This file is free software; the Free Software Foundation
883+dnl gives unlimited permission to copy and/or distribute it,
884+dnl with or without modifications, as long as this notice is preserved.
885+
886+# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
887+
888+# This test replaces the one in autoconf.
889+# Currently this macro should have the same name as the autoconf macro
890+# because gettext's gettext.m4 (distributed in the automake package)
891+# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
892+# give these diagnostics:
893+#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
894+#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
895+
896+undefine([AC_ISC_POSIX])
897+
898+AC_DEFUN([AC_ISC_POSIX],
899+  [
900+    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
901+    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
902+  ]
903+)
904+
905 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
906 #
907 # This file is free software; the Free Software Foundation
908@@ -34,7 +59,7 @@
909 [am__api_version='1.11'
910 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
911 dnl require some minimum version.  Point them to the right macro.
912-m4_if([$1], [1.11.1], [],
913+m4_if([$1], [1.11], [],
914       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
915 ])
916
917@@ -50,7 +75,7 @@
918 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
919 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
920 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
921-[AM_AUTOMAKE_VERSION([1.11.1])dnl
922+[AM_AUTOMAKE_VERSION([1.11])dnl
923 m4_ifndef([AC_AUTOCONF_VERSION],
924   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
925 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
926diff -rNU3 dist.orig/binutils/bucomm.c dist.nbsd/binutils/bucomm.c
927--- dist.orig/binutils/bucomm.c	Fri Jun 29 12:59:49 2012
928+++ dist.nbsd/binutils/bucomm.c	Wed Feb 19 16:39:33 2014
929@@ -580,7 +580,14 @@
930 		   file_name, strerror (errno));
931     }
932   else if (! S_ISREG (statbuf.st_mode))
933-    non_fatal (_("Warning: '%s' is not an ordinary file"), file_name);
934+    {
935+      if (!S_ISCHR(statbuf.st_mode))
936+	{
937+	  non_fatal (_("Warning: '%s' is not an ordinary file"), file_name);
938+	  return 0;
939+	}
940+      return statbuf.st_size ? statbuf.st_size : 1;
941+    }
942   else if (statbuf.st_size < 0)
943     non_fatal (_("Warning: '%s' has negative size, probably it is too large"),
944                file_name);
945diff -rNU3 dist.orig/binutils/doc/Makefile.am dist.nbsd/binutils/doc/Makefile.am
946--- dist.orig/binutils/doc/Makefile.am	Wed Jan  6 16:52:14 2010
947+++ dist.nbsd/binutils/doc/Makefile.am	Wed Feb 19 16:39:33 2014
948@@ -42,6 +42,8 @@
949
950 # Man page generation from texinfo
951 addr2line.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
952+	@echo "NOT REBUILDING $@"
953+NetBSD_DISABLED_addr2line.1:
954 	touch $@
955 	-$(TEXI2POD) $(MANCONF) -Daddr2line < $(binutils_TEXI) > addr2line.pod
956 	-($(POD2MAN) addr2line.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
957@@ -49,6 +51,8 @@
958 	rm -f addr2line.pod
959
960 ar.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
961+	@echo "NOT REBUILDING $@"
962+NetBSD_DISABLED_ar.1:
963 	touch $@
964 	-$(TEXI2POD) $(MANCONF) -Dar < $(binutils_TEXI) > ar.pod
965 	-($(POD2MAN) ar.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
966@@ -56,6 +60,8 @@
967 	rm -f ar.pod
968
969 dlltool.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
970+	@echo "NOT REBUILDING $@"
971+NetBSD_DISABLED_dlltool.1:
972 	touch $@
973 	-$(TEXI2POD) $(MANCONF) -Ddlltool < $(binutils_TEXI) > dlltool.pod
974 	-($(POD2MAN) dlltool.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
975@@ -63,6 +69,8 @@
976 	rm -f dlltool.pod
977
978 nlmconv.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
979+	@echo "NOT REBUILDING $@"
980+NetBSD_DISABLED_nlmconv.1:
981 	touch $@
982 	-$(TEXI2POD) $(MANCONF) -Dnlmconv < $(binutils_TEXI) > nlmconv.pod
983 	-($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
984@@ -70,6 +78,8 @@
985 	rm -f nlmconv.pod
986
987 nm.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
988+	@echo "NOT REBUILDING $@"
989+NetBSD_DISABLED_nm.1:
990 	touch $@
991 	-$(TEXI2POD) $(MANCONF) -Dnm < $(binutils_TEXI) > nm.pod
992 	-($(POD2MAN) nm.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
993@@ -77,6 +87,8 @@
994 	rm -f nm.pod
995
996 objcopy.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
997+	@echo "NOT REBUILDING $@"
998+NetBSD_DISABLED_objcopy.1:
999 	touch $@
1000 	-$(TEXI2POD) $(MANCONF) -Dobjcopy < $(binutils_TEXI) > objcopy.pod
1001 	-($(POD2MAN) objcopy.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1002@@ -84,6 +96,8 @@
1003 	rm -f objcopy.pod
1004
1005 objdump.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1006+	@echo "NOT REBUILDING $@"
1007+NetBSD_DISABLED_objdump.1:
1008 	touch $@
1009 	-$(TEXI2POD) $(MANCONF) -Dobjdump < $(binutils_TEXI) > objdump.pod
1010 	-($(POD2MAN) objdump.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1011@@ -91,6 +105,8 @@
1012 	rm -f objdump.pod
1013
1014 ranlib.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1015+	@echo "NOT REBUILDING $@"
1016+NetBSD_DISABLED_ranlib.1:
1017 	touch $@
1018 	-$(TEXI2POD) $(MANCONF) -Dranlib < $(binutils_TEXI) > ranlib.pod
1019 	-($(POD2MAN) ranlib.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1020@@ -98,6 +114,8 @@
1021 	rm -f ranlib.pod
1022
1023 readelf.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1024+	@echo "NOT REBUILDING $@"
1025+NetBSD_DISABLED_readelf.1:
1026 	touch $@
1027 	-$(TEXI2POD) $(MANCONF) -Dreadelf < $(binutils_TEXI) > readelf.pod
1028 	-($(POD2MAN) readelf.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1029@@ -105,6 +123,8 @@
1030 	rm -f readelf.pod
1031
1032 size.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1033+	@echo "NOT REBUILDING $@"
1034+NetBSD_DISABLED_size.1:
1035 	touch $@
1036 	-$(TEXI2POD) $(MANCONF) -Dsize < $(binutils_TEXI) > size.pod
1037 	-($(POD2MAN) size.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1038@@ -112,6 +132,8 @@
1039 	rm -f size.pod
1040
1041 strings.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1042+	@echo "NOT REBUILDING $@"
1043+NetBSD_DISABLED_strings.1:
1044 	touch $@
1045 	-$(TEXI2POD) $(MANCONF) -Dstrings < $(binutils_TEXI) > strings.pod
1046 	-($(POD2MAN) strings.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1047@@ -119,6 +141,8 @@
1048 	rm -f strings.pod
1049
1050 strip.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1051+	@echo "NOT REBUILDING $@"
1052+NetBSD_DISABLED_strip.1:
1053 	touch $@
1054 	-$(TEXI2POD) $(MANCONF) -Dstrip < $(binutils_TEXI) > strip.pod
1055 	-($(POD2MAN) strip.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1056@@ -133,6 +157,8 @@
1057 	rm -f elfedit.pod
1058
1059 windres.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1060+	@echo "NOT REBUILDING $@"
1061+NetBSD_DISABLED_windres.1:
1062 	touch $@
1063 	-$(TEXI2POD) $(MANCONF) -Dwindres < $(binutils_TEXI) > windres.pod
1064 	-($(POD2MAN) windres.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1065@@ -140,6 +166,8 @@
1066 	rm -f windres.pod
1067
1068 windmc.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1069+	@echo "NOT REBUILDING $@"
1070+NetBSD_DISABLED_windmc.1:
1071 	touch $@
1072 	-$(TEXI2POD) $(MANCONF) -Dwindmc < $(binutils_TEXI) > windmc.pod
1073 	-($(POD2MAN) windmc.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1074@@ -147,6 +175,8 @@
1075 	rm -f windmc.pod
1076
1077 cxxfilt.man:	$(binutils_TEXI) $(binutils_TEXINFOS)
1078+	@echo "NOT REBUILDING $@"
1079+NetBSD_DISABLED_cxxfilt.man:
1080 	touch $@
1081 	-$(TEXI2POD) $(MANCONF) -Dcxxfilt < $(binutils_TEXI) > $(DEMANGLER_NAME).pod
1082 	-($(POD2MAN) $(DEMANGLER_NAME).pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1083diff -rNU3 dist.orig/binutils/doc/Makefile.in dist.nbsd/binutils/doc/Makefile.in
1084--- dist.orig/binutils/doc/Makefile.in	Tue Sep  4 12:53:44 2012
1085+++ dist.nbsd/binutils/doc/Makefile.in	Wed Feb 19 16:39:33 2014
1086@@ -1,4 +1,4 @@
1087-# Makefile.in generated by automake 1.11.1 from Makefile.am.
1088+# Makefile.in generated by automake 1.11 from Makefile.am.
1089 # @configure_input@
1090
1091 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
1092@@ -242,6 +242,7 @@
1093 libexecdir = @libexecdir@
1094 localedir = @localedir@
1095 localstatedir = @localstatedir@
1096+lt_ECHO = @lt_ECHO@
1097 mandir = @mandir@
1098 mkdir_p = @mkdir_p@
1099 oldincludedir = @oldincludedir@
1100@@ -349,6 +350,8 @@
1101 	-rm -rf .libs _libs
1102
1103 binutils.info: binutils.texi
1104+	@echo "NOT REBUILDING $@"
1105+NetBSD_DISABLED_binutils.info: binutils.texi
1106 	restore=: && backupdir="$(am__leading_dot)am$$$$" && \
1107 	rm -rf $$backupdir && mkdir $$backupdir && \
1108 	if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
1109@@ -735,6 +738,8 @@
1110
1111 # Man page generation from texinfo
1112 addr2line.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1113+	@echo "NOT REBUILDING $@"
1114+NetBSD_DISABLED_addr2line.1:
1115 	touch $@
1116 	-$(TEXI2POD) $(MANCONF) -Daddr2line < $(binutils_TEXI) > addr2line.pod
1117 	-($(POD2MAN) addr2line.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1118@@ -742,6 +747,8 @@
1119 	rm -f addr2line.pod
1120
1121 ar.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1122+	@echo "NOT REBUILDING $@"
1123+NetBSD_DISABLED_ar.1:
1124 	touch $@
1125 	-$(TEXI2POD) $(MANCONF) -Dar < $(binutils_TEXI) > ar.pod
1126 	-($(POD2MAN) ar.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1127@@ -749,6 +756,8 @@
1128 	rm -f ar.pod
1129
1130 dlltool.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1131+	@echo "NOT REBUILDING $@"
1132+NetBSD_DISABLED_dlltool.1:
1133 	touch $@
1134 	-$(TEXI2POD) $(MANCONF) -Ddlltool < $(binutils_TEXI) > dlltool.pod
1135 	-($(POD2MAN) dlltool.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1136@@ -756,6 +765,8 @@
1137 	rm -f dlltool.pod
1138
1139 nlmconv.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1140+	@echo "NOT REBUILDING $@"
1141+NetBSD_DISABLED_nlmconv.1:
1142 	touch $@
1143 	-$(TEXI2POD) $(MANCONF) -Dnlmconv < $(binutils_TEXI) > nlmconv.pod
1144 	-($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1145@@ -763,6 +774,8 @@
1146 	rm -f nlmconv.pod
1147
1148 nm.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1149+	@echo "NOT REBUILDING $@"
1150+NetBSD_DISABLED_nm.1:
1151 	touch $@
1152 	-$(TEXI2POD) $(MANCONF) -Dnm < $(binutils_TEXI) > nm.pod
1153 	-($(POD2MAN) nm.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1154@@ -770,6 +783,8 @@
1155 	rm -f nm.pod
1156
1157 objcopy.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1158+	@echo "NOT REBUILDING $@"
1159+NetBSD_DISABLED_objcopy.1:
1160 	touch $@
1161 	-$(TEXI2POD) $(MANCONF) -Dobjcopy < $(binutils_TEXI) > objcopy.pod
1162 	-($(POD2MAN) objcopy.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1163@@ -777,6 +792,8 @@
1164 	rm -f objcopy.pod
1165
1166 objdump.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1167+	@echo "NOT REBUILDING $@"
1168+NetBSD_DISABLED_objdump.1:
1169 	touch $@
1170 	-$(TEXI2POD) $(MANCONF) -Dobjdump < $(binutils_TEXI) > objdump.pod
1171 	-($(POD2MAN) objdump.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1172@@ -784,6 +801,8 @@
1173 	rm -f objdump.pod
1174
1175 ranlib.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1176+	@echo "NOT REBUILDING $@"
1177+NetBSD_DISABLED_ranlib.1:
1178 	touch $@
1179 	-$(TEXI2POD) $(MANCONF) -Dranlib < $(binutils_TEXI) > ranlib.pod
1180 	-($(POD2MAN) ranlib.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1181@@ -791,6 +810,8 @@
1182 	rm -f ranlib.pod
1183
1184 readelf.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1185+	@echo "NOT REBUILDING $@"
1186+NetBSD_DISABLED_readelf.1:
1187 	touch $@
1188 	-$(TEXI2POD) $(MANCONF) -Dreadelf < $(binutils_TEXI) > readelf.pod
1189 	-($(POD2MAN) readelf.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1190@@ -798,6 +819,8 @@
1191 	rm -f readelf.pod
1192
1193 size.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1194+	@echo "NOT REBUILDING $@"
1195+NetBSD_DISABLED_size.1:
1196 	touch $@
1197 	-$(TEXI2POD) $(MANCONF) -Dsize < $(binutils_TEXI) > size.pod
1198 	-($(POD2MAN) size.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1199@@ -805,6 +828,8 @@
1200 	rm -f size.pod
1201
1202 strings.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1203+	@echo "NOT REBUILDING $@"
1204+NetBSD_DISABLED_strings.1:
1205 	touch $@
1206 	-$(TEXI2POD) $(MANCONF) -Dstrings < $(binutils_TEXI) > strings.pod
1207 	-($(POD2MAN) strings.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1208@@ -812,6 +837,8 @@
1209 	rm -f strings.pod
1210
1211 strip.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1212+	@echo "NOT REBUILDING $@"
1213+NetBSD_DISABLED_strip.1:
1214 	touch $@
1215 	-$(TEXI2POD) $(MANCONF) -Dstrip < $(binutils_TEXI) > strip.pod
1216 	-($(POD2MAN) strip.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1217@@ -819,6 +846,8 @@
1218 	rm -f strip.pod
1219
1220 elfedit.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1221+	@echo "NOT REBUILDING $@"
1222+NetBSD_DISABLED_elfedit.1:
1223 	touch $@
1224 	-$(TEXI2POD) $(MANCONF) -Delfedit < $(binutils_TEXI) > elfedit.pod
1225 	-($(POD2MAN) elfedit.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1226@@ -826,6 +855,8 @@
1227 	rm -f elfedit.pod
1228
1229 windres.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1230+	@echo "NOT REBUILDING $@"
1231+NetBSD_DISABLED_windres.1:
1232 	touch $@
1233 	-$(TEXI2POD) $(MANCONF) -Dwindres < $(binutils_TEXI) > windres.pod
1234 	-($(POD2MAN) windres.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1235@@ -833,6 +864,8 @@
1236 	rm -f windres.pod
1237
1238 windmc.1:	$(binutils_TEXI) $(binutils_TEXINFOS)
1239+	@echo "NOT REBUILDING $@"
1240+NetBSD_DISABLED_windmc.1:
1241 	touch $@
1242 	-$(TEXI2POD) $(MANCONF) -Dwindmc < $(binutils_TEXI) > windmc.pod
1243 	-($(POD2MAN) windmc.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1244@@ -840,6 +873,8 @@
1245 	rm -f windmc.pod
1246
1247 cxxfilt.man:	$(binutils_TEXI) $(binutils_TEXINFOS)
1248+	@echo "NOT REBUILDING $@"
1249+NetBSD_DISABLED_cxxfilt.man:
1250 	touch $@
1251 	-$(TEXI2POD) $(MANCONF) -Dcxxfilt < $(binutils_TEXI) > $(DEMANGLER_NAME).pod
1252 	-($(POD2MAN) $(DEMANGLER_NAME).pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
1253diff -rNU3 dist.orig/binutils/doc/strings.1 dist.nbsd/binutils/doc/strings.1
1254--- dist.orig/binutils/doc/strings.1	Mon Mar 25 09:10:26 2013
1255+++ dist.nbsd/binutils/doc/strings.1	Wed Feb 19 16:39:33 2014
1256@@ -208,7 +208,7 @@
1257 characters (\s-1ASCII\s0, \s-1ISO\s0 8859, etc., default), \fBS\fR =
1258 single\-8\-bit\-byte characters, \fBb\fR = 16\-bit bigendian, \fBl\fR =
1259 16\-bit littleendian, \fBB\fR = 32\-bit bigendian, \fBL\fR = 32\-bit
1260-littleendian.  Useful for finding wide character strings. (\fBl\fR
1261+littleendian.  Useful for finding wide-character strings. (\fBl\fR
1262 and \fBb\fR apply to, for example, Unicode \s-1UTF\-16/UCS\-2\s0 encodings).
1263 .IP "\fB\-T\fR \fIbfdname\fR" 4
1264 .IX Item "-T bfdname"
1265diff -rNU3 dist.orig/binutils/objcopy.c dist.nbsd/binutils/objcopy.c
1266--- dist.orig/binutils/objcopy.c	Mon Mar 25 08:06:21 2013
1267+++ dist.nbsd/binutils/objcopy.c	Wed Feb 19 16:39:33 2014
1268@@ -30,6 +30,8 @@
1269 #include "filenames.h"
1270 #include "fnmatch.h"
1271 #include "elf-bfd.h"
1272+#include <sys/stat.h>
1273+#include <ctype.h>
1274 #include "libbfd.h"
1275 #include "coff/internal.h"
1276 #include "libcoff.h"
1277diff -rNU3 dist.orig/binutils/readelf.c dist.nbsd/binutils/readelf.c
1278--- dist.orig/binutils/readelf.c	Mon Mar 25 08:06:21 2013
1279+++ dist.nbsd/binutils/readelf.c	Wed Feb 19 16:39:33 2014
1280@@ -3801,7 +3801,7 @@
1281       if (elf_header.e_phnum > 1)
1282 	printf (_("\nProgram Headers:\n"));
1283       else
1284-	printf (_("\nProgram Headers:\n"));
1285+	printf (_("\nProgram Header:\n"));
1286
1287       if (is_32bit_elf)
1288 	printf
1289@@ -6974,6 +6974,11 @@
1290
1291       remaining = 4;
1292     }
1293+  else
1294+    {
1295+      addr.section = SHN_UNDEF;
1296+      addr.offset = 0;
1297+    }
1298
1299   if ((word & 0x80000000) == 0)
1300     {
1301@@ -12665,6 +12670,38 @@
1302   return buff;
1303 }
1304
1305+static int
1306+process_netbsd_elf_note (Elf_Internal_Note * pnote)
1307+{
1308+  unsigned int version;
1309+
1310+  switch (pnote->type)
1311+    {
1312+    case NT_NETBSD_IDENT:
1313+      version = byte_get((unsigned char *)pnote->descdata, sizeof(version));
1314+      if ((version / 10000) % 100)
1315+        printf ("  NetBSD\t0x%08lx\tIDENT %u (%u.%u%s%c)\n", pnote->descsz,
1316+		version, version / 100000000, (version / 1000000) % 100,
1317+		(version / 10000) % 100 > 26 ? "Z" : "",
1318+		'A' + (version / 10000) % 26);
1319+      else
1320+	printf ("  NetBSD\t0x%08lx\tIDENT %u (%u.%u.%u)\n", pnote->descsz,
1321+	        version, version / 100000000, (version / 1000000) % 100,
1322+		(version / 100) % 100);
1323+      return 1;
1324+    case NT_NETBSD_MARCH:
1325+      printf ("  NetBSD\t0x%08lx\tMARCH <%s>\n", pnote->descsz,
1326+	      pnote->descdata);
1327+      return 1;
1328+    default:
1329+      break;
1330+    }
1331+
1332+  printf ("  NetBSD\t0x%08lx\tUnknown note type: (0x%08lx)\n", pnote->descsz,
1333+	  pnote->type);
1334+  return 1;
1335+}
1336+
1337 static int
1338 print_gnu_note (Elf_Internal_Note *pnote)
1339 {
1340@@ -12765,6 +12802,23 @@
1341 	}
1342       break;
1343
1344+    /* On SuperH, PT_GETREGS == mach+3 and PT_GETFPREGS == mach+5.
1345+       There's also old PT___GETREGS40 == mach + 1 for old reg
1346+       structure which lacks GBR.  */
1347+    case EM_SH:
1348+      switch (e_type)
1349+	{
1350+	case NT_NETBSDCORE_FIRSTMACH + 1:
1351+	  return _("PT___GETREGS40 (old reg structure)");
1352+	case NT_NETBSDCORE_FIRSTMACH + 3:
1353+	  return _("PT_GETREGS (reg structure)");
1354+	case NT_NETBSDCORE_FIRSTMACH + 5:
1355+	  return _("PT_GETFPREGS (fpreg structure)");
1356+	default:
1357+	  break;
1358+	}
1359+      break;
1360+
1361     /* On all other arch's, PT_GETREGS == mach+1 and
1362        PT_GETFPREGS == mach+3.  */
1363     default:
1364@@ -12970,6 +13024,10 @@
1365   else if (const_strneq (pnote->namedata, "GNU"))
1366     /* GNU-specific object file notes.  */
1367     nt = get_gnu_elf_note_type (pnote->type);
1368+
1369+  else if (const_strneq (pnote->namedata, "NetBSD"))
1370+    /* NetBSD-specific core file notes.  */
1371+    return process_netbsd_elf_note (pnote);
1372
1373   else if (const_strneq (pnote->namedata, "NetBSD-CORE"))
1374     /* NetBSD-specific core file notes.  */
1375diff -rNU3 dist.orig/binutils/strings.c dist.nbsd/binutils/strings.c
1376--- dist.orig/binutils/strings.c	Thu Feb  9 04:51:44 2012
1377+++ dist.nbsd/binutils/strings.c	Wed Feb 19 16:39:33 2014
1378@@ -598,7 +598,7 @@
1379 	    else
1380 #elif !BFD_HOST_64BIT_LONG
1381 	    if (start != (unsigned long) start)
1382-	      printf ("++%7ld ", (unsigned long) start);
1383+	      printf ("++%7llu ", (unsigned long) start);
1384 	    else
1385 #endif
1386 	      printf ("%7ld ", (long) start);
1387diff -rNU3 dist.orig/config.guess dist.nbsd/config.guess
1388--- dist.orig/config.guess	Mon Jun  6 10:36:06 2011
1389+++ dist.nbsd/config.guess	Wed Feb 19 16:39:33 2014
1390@@ -160,14 +160,28 @@
1391 	case "${UNAME_MACHINE_ARCH}" in
1392 	    armeb) machine=armeb-unknown ;;
1393 	    arm*) machine=arm-unknown ;;
1394+	    coldfire) machine=m5407-unknown ;;
1395+	    earm*eb*) machine=armeb-unknown ;;
1396+	    earm*) machine=arm-unknown ;;
1397 	    sh3el) machine=shl-unknown ;;
1398 	    sh3eb) machine=sh-unknown ;;
1399 	    sh5el) machine=sh5le-unknown ;;
1400 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
1401 	esac
1402 	# The Operating System including object format, if it has switched
1403-	# to ELF recently, or will in the future.
1404+	# to ELF recently, or will in the future and ABI.
1405 	case "${UNAME_MACHINE_ARCH}" in
1406+	    coldfire) os=netbsdelf ;;
1407+	    earm*)
1408+		eval $set_cc_for_build
1409+		if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1410+			| grep -q __ARM_PCS_VFP
1411+		then
1412+		    os=netbsdelf-eabi
1413+		else
1414+		    os=netbsdelf-eabihf
1415+		fi
1416+		;;
1417 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
1418 		eval $set_cc_for_build
1419 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
1420diff -rNU3 dist.orig/config.sub dist.nbsd/config.sub
1421--- dist.orig/config.sub	Wed Apr 25 15:53:25 2012
1422+++ dist.nbsd/config.sub	Wed Feb 19 16:39:33 2014
1423@@ -122,9 +122,9 @@
1424 # Here we must recognize all the valid KERNEL-OS combinations.
1425 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
1426 case $maybe_os in
1427-  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
1428-  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
1429-  knetbsd*-gnu* | netbsd*-gnu* | \
1430+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
1431+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | \
1432+  netbsd*-gnu* | netbsd*-eabi* | \
1433   kopensolaris*-gnu* | \
1434   storm-chaos* | os2-emx* | rtmk-nova*)
1435     os=-$maybe_os
1436@@ -332,7 +332,8 @@
1437 		basic_machine=$basic_machine-unknown
1438 		os=-none
1439 		;;
1440-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
1441+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | m5407 \
1442+	| v70 | w65 | z8k)
1443 		;;
1444 	ms1)
1445 		basic_machine=mt-unknown
1446@@ -375,7 +376,7 @@
1447 	| avr-* | avr32-* \
1448 	| be32-* | be64-* \
1449 	| bfin-* | bs2000-* \
1450-	| c[123]* | c30-* | [cjt]90-* | c4x-* \
1451+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
1452 	| clipper-* | craynv-* | cydra-* \
1453 	| d10v-* | d30v-* | dlx-* \
1454 	| elxsi-* \
1455@@ -388,6 +389,7 @@
1456 	| le32-* | le64-* \
1457 	| lm32-* \
1458 	| m32c-* | m32r-* | m32rle-* \
1459+	| m5200-* | m5407-* \
1460 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
1461 	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
1462 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
1463@@ -528,15 +530,6 @@
1464 		basic_machine=powerpc-ibm
1465 		os=-cnk
1466 		;;
1467-	c54x-*)
1468-		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
1469-		;;
1470-	c55x-*)
1471-		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
1472-		;;
1473-	c6x-*)
1474-		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
1475-		;;
1476 	c90)
1477 		basic_machine=c90-cray
1478 		os=-unicos
1479@@ -1541,15 +1534,6 @@
1480 		os=-aout
1481 		;;
1482 	c4x-* | tic4x-*)
1483-		os=-coff
1484-		;;
1485-	tic54x-*)
1486-		os=-coff
1487-		;;
1488-	tic55x-*)
1489-		os=-coff
1490-		;;
1491-	tic6x-*)
1492 		os=-coff
1493 		;;
1494 	# This must come before the *-dec entry.
1495diff -rNU3 dist.orig/gas/atof-generic.c dist.nbsd/gas/atof-generic.c
1496--- dist.orig/gas/atof-generic.c	Wed Sep  2 07:24:19 2009
1497+++ dist.nbsd/gas/atof-generic.c	Wed Feb 19 16:39:28 2014
1498@@ -121,6 +121,32 @@
1499
1500   switch (first_digit[0])
1501     {
1502+    case 's':
1503+    case 'S':
1504+      if (!strncasecmp ("snan", first_digit, 4))
1505+	{
1506+	  address_of_generic_floating_point_number->sign = 0;
1507+	  address_of_generic_floating_point_number->exponent = 0;
1508+	  address_of_generic_floating_point_number->leader =
1509+	    address_of_generic_floating_point_number->low;
1510+	  *address_of_string_pointer = first_digit + 4;
1511+	  return 0;
1512+	}
1513+      break;
1514+
1515+    case 'q':
1516+    case 'Q':
1517+      if (!strncasecmp ("qnan", first_digit, 4))
1518+	{
1519+	  address_of_generic_floating_point_number->sign = 0;
1520+	  address_of_generic_floating_point_number->exponent = 0;
1521+	  address_of_generic_floating_point_number->leader =
1522+	    address_of_generic_floating_point_number->low;
1523+	  *address_of_string_pointer = first_digit + 4;
1524+	  return 0;
1525+	}
1526+      break;
1527+
1528     case 'n':
1529     case 'N':
1530       if (!strncasecmp ("nan", first_digit, 3))
1531diff -rNU3 dist.orig/gas/config/atof-vax.c dist.nbsd/gas/config/atof-vax.c
1532--- dist.orig/gas/config/atof-vax.c	Wed Oct 17 16:45:54 2007
1533+++ dist.nbsd/gas/config/atof-vax.c	Wed Feb 19 16:39:28 2014
1534@@ -268,10 +268,27 @@
1535 	  int exponent_skippage;
1536 	  LITTLENUM_TYPE word1;
1537
1538-	  /* JF: Deal with new Nan, +Inf and -Inf codes.  */
1539 	  if (f->sign != '-' && f->sign != '+')
1540 	    {
1541-	      make_invalid_floating_point_number (words);
1542+	      if (f->sign == 0)
1543+		{
1544+		  /* All NaNs are 0.  */
1545+		  memset (words, 0x00, sizeof (LITTLENUM_TYPE) * precision);
1546+		}
1547+	      else if (f->sign == 'P')
1548+		{
1549+		  /* Positive Infinity.  */
1550+		  memset (words, 0xff, sizeof (LITTLENUM_TYPE) * precision);
1551+		  words[0] &= 0x7fff;
1552+		}
1553+	      else if (f->sign == 'N')
1554+		{
1555+		  /* Negative Infinity.  */
1556+		  memset (words, 0x00, sizeof (LITTLENUM_TYPE) * precision);
1557+		  words[0] = 0x0080;
1558+		}
1559+	      else
1560+		make_invalid_floating_point_number (words);
1561 	      return return_value;
1562 	    }
1563
1564diff -rNU3 dist.orig/gas/config/tc-arm.c dist.nbsd/gas/config/tc-arm.c
1565--- dist.orig/gas/config/tc-arm.c	Mon Mar 25 08:06:21 2013
1566+++ dist.nbsd/gas/config/tc-arm.c	Wed Feb 19 16:39:28 2014
1567@@ -17290,12 +17290,16 @@
1568   asection *sect;
1569
1570   for (sect = stdoutput->sections; sect != NULL; sect = sect->next)
1571-    if (seg_info (sect)->tc_segment_info_data.current_it.state
1572-	== MANUAL_IT_BLOCK)
1573-      {
1574-	as_warn (_("section '%s' finished with an open IT block."),
1575-		 sect->name);
1576-      }
1577+    {
1578+      segment_info_type *seginfo = seg_info (sect);
1579+
1580+      if (seginfo && seginfo->tc_segment_info_data.current_it.state
1581+	  == MANUAL_IT_BLOCK)
1582+        {
1583+	  as_warn (_("section '%s' finished with an open IT block."),
1584+		   sect->name);
1585+        }
1586+    }
1587 #else
1588   if (now_it.state == MANUAL_IT_BLOCK)
1589     as_warn (_("file finished with an open IT block."));
1590diff -rNU3 dist.orig/gas/config/tc-m68k.c dist.nbsd/gas/config/tc-m68k.c
1591--- dist.orig/gas/config/tc-m68k.c	Wed May 16 10:26:47 2012
1592+++ dist.nbsd/gas/config/tc-m68k.c	Wed Feb 19 16:39:28 2014
1593@@ -7426,12 +7426,12 @@
1594 	}
1595     }
1596
1597-  /* Remove 'm' or 'mc' prefix from 68k variants.  */
1598+  /* Remove 'm' or 'mc' prefix from 68k or coldfire variants.  */
1599   if (allow_m)
1600     {
1601       if (arg[0] == 'm')
1602 	{
1603-	  if (arg[1] == '6')
1604+	  if (arg[1] == '6' || arg[1] == '5')
1605 	    arg += 1;
1606 	  else if (arg[1] == 'c'  && arg[2] == '6')
1607 	    arg += 2;
1608diff -rNU3 dist.orig/gas/config/tc-mips.c dist.nbsd/gas/config/tc-mips.c
1609--- dist.orig/gas/config/tc-mips.c	Tue Sep  4 14:21:03 2012
1610+++ dist.nbsd/gas/config/tc-mips.c	Wed Feb 19 16:39:28 2014
1611@@ -909,6 +909,9 @@
1612   NUM_FIX_VR4120_CLASSES
1613 };
1614
1615+/* ...likewise -mtrap-zero-jump.  */
1616+static bfd_boolean mips_trap_zero_jump;
1617+
1618 /* ...likewise -mfix-loongson2f-jump.  */
1619 static bfd_boolean mips_fix_loongson2f_jump;
1620
1621@@ -941,6 +944,8 @@
1622    efficient expansion.  */
1623
1624 static int mips_relax_branch;
1625+
1626+static int mips_fix_loongson2f_btb;
1627
1628 /* The expansion of many macros depends on the type of symbol that
1629    they refer to.  For example, when generating position-dependent code,
1630@@ -1316,6 +1321,7 @@
1631 static void mips16_macro_build
1632   (expressionS *, const char *, const char *, va_list *);
1633 static void load_register (int, expressionS *, int);
1634+static void macro_build (expressionS *, const char *, const char *, ...);
1635 static void macro_start (void);
1636 static void macro_end (void);
1637 static void macro (struct mips_cl_insn * ip);
1638@@ -3626,6 +3632,35 @@
1639   return nops;
1640 }
1641
1642+static void
1643+trap_zero_jump (struct mips_cl_insn * ip)
1644+{
1645+  if (strcmp (ip->insn_mo->name, "j") == 0
1646+      || strcmp (ip->insn_mo->name, "jr") == 0
1647+      || strcmp (ip->insn_mo->name, "jalr") == 0)
1648+    {
1649+      int sreg;
1650+
1651+      if (mips_opts.warn_about_macros)
1652+        return;
1653+
1654+      sreg = EXTRACT_OPERAND (0, RS, *ip);
1655+      if (mips_opts.isa == ISA_MIPS32
1656+          || mips_opts.isa == ISA_MIPS32R2
1657+          || mips_opts.isa == ISA_MIPS64
1658+          || mips_opts.isa == ISA_MIPS64R2)
1659+	{
1660+	  expressionS ep;
1661+	  ep.X_op = O_constant;
1662+	  ep.X_add_number = 4096;
1663+	  macro_build (&ep, "tltiu", "s,j", sreg, BFD_RELOC_LO16);
1664+	}
1665+      else if (mips_opts.isa != ISA_UNKNOWN
1666+	       && mips_opts.isa != ISA_MIPS1)
1667+	macro_build (NULL, "teq", "s,t", sreg, 0);
1668+  }
1669+}
1670+
1671 /* Fix NOP issue: Replace nops by "or at,at,zero".  */
1672
1673 static void
1674@@ -3663,6 +3698,16 @@
1675       ep.X_add_number = 0xffff;
1676       macro_build (&ep, "ori", "t,r,i", ATREG, ATREG, BFD_RELOC_LO16);
1677       macro_build (NULL, "and", "d,v,t", sreg, sreg, ATREG);
1678+      /* Hide these three instructions to avoid getting a ``macro expanded into
1679+         multiple instructions'' warning. */
1680+      if (mips_relax.sequence != 2) {
1681+        mips_macro_warning.sizes[0] -= 3 * 4;
1682+        mips_macro_warning.insns[0] -= 3;
1683+      }
1684+      if (mips_relax.sequence != 1) {
1685+        mips_macro_warning.sizes[1] -= 3 * 4;
1686+        mips_macro_warning.insns[1] -= 3;
1687+      }
1688     }
1689 }
1690
1691@@ -3718,6 +3763,11 @@
1692   if (mips_opts.mips16 && history[0].fixp[0])
1693     return FALSE;
1694
1695+  if (mips_fix_loongson2f)
1696+    fix_loongson2f (ip);
1697+  if (mips_trap_zero_jump)
1698+    trap_zero_jump (ip);
1699+
1700   /* If the branch is itself the target of a branch, we can not swap.
1701      We cheat on this; all we check for is whether there is a label on
1702      this instruction.  If there are any branches to anything other than
1703@@ -4764,6 +4814,45 @@
1704       r[i] = (bfd_reloc_code_real_type) va_arg (*args, int);
1705 }
1706
1707+/* Fix jump through register issue on loongson2f processor for kernel code:
1708+   force a BTB clear before the jump to prevent it from being incorrectly
1709+   prefetched by the branch prediction engine. */
1710+
1711+static void
1712+macro_build_jrpatch (expressionS *ep, unsigned int sreg)
1713+{
1714+  if (!mips_fix_loongson2f_btb)
1715+    return;
1716+
1717+  if (sreg == ZERO || sreg == KT0 || sreg == KT1 || sreg == AT)
1718+    return;
1719+
1720+  if (!mips_opts.at)
1721+    {
1722+      as_warn (_("unable to apply loongson2f BTB workaround when .set noat"));
1723+      return;
1724+    }
1725+
1726+  /* li $at, COP_0_BTB_CLEAR | COP_0_RAS_DISABLE */
1727+  ep->X_op = O_constant;
1728+  ep->X_add_number = 3;
1729+  macro_build (ep, "ori", "t,r,i", AT, ZERO, BFD_RELOC_LO16);
1730+
1731+  /* dmtc0 $at, COP_0_DIAG */
1732+  macro_build (NULL, "dmtc0", "t,G", AT, 22);
1733+
1734+  /* Hide these two instructions to avoid getting a ``macro expanded into
1735+     multiple instructions'' warning. */
1736+  if (mips_relax.sequence != 2) {
1737+    mips_macro_warning.sizes[0] -= 2 * 4;
1738+    mips_macro_warning.insns[0] -= 2;
1739+  }
1740+  if (mips_relax.sequence != 1) {
1741+    mips_macro_warning.sizes[1] -= 2 * 4;
1742+    mips_macro_warning.insns[0] -= 2;
1743+  }
1744+}
1745+
1746 /* Build an instruction created by a macro expansion.  This is passed
1747    a pointer to the count of instructions created so far, an
1748    expression, the name of the instruction to build, an operand format
1749@@ -7637,6 +7726,26 @@
1750 	macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", treg, tempreg, breg);
1751       break;
1752
1753+    case M_JR_S:
1754+      macro_build_jrpatch (&expr1, sreg);
1755+      macro_build (NULL, "jr", "s", sreg);
1756+      return;	/* didn't modify $at */
1757+
1758+    case M_J_S:
1759+      macro_build_jrpatch (&expr1, sreg);
1760+      macro_build (NULL, "j", "s", sreg);
1761+      return;	/* didn't modify $at */
1762+
1763+    case M_JALR_S:
1764+      macro_build_jrpatch (&expr1, sreg);
1765+      macro_build (NULL, "jalr", "s", sreg);
1766+      return;	/* didn't modify $at */
1767+
1768+    case M_JALR_DS:
1769+      macro_build_jrpatch (&expr1, sreg);
1770+      macro_build (NULL, "jalr", "d,s", dreg, sreg);
1771+      return;	/* didn't modify $at */
1772+
1773     case M_MSGSND:
1774       gas_assert (!mips_opts.micromips);
1775       {
1776@@ -14350,6 +14459,8 @@
1777     OPTION_SINGLE_FLOAT,
1778     OPTION_DOUBLE_FLOAT,
1779     OPTION_32,
1780+    OPTION_TRAP_ZERO_JUMP,
1781+    OPTION_NO_TRAP_ZERO_JUMP,
1782 #ifdef OBJ_ELF
1783     OPTION_CALL_SHARED,
1784     OPTION_CALL_NONPIC,
1785@@ -14364,6 +14475,8 @@
1786     OPTION_NO_PDR,
1787     OPTION_MVXWORKS_PIC,
1788 #endif /* OBJ_ELF */
1789+    OPTION_FIX_LOONGSON2F_BTB,
1790+    OPTION_NO_FIX_LOONGSON2F_BTB,
1791     OPTION_END_OF_ENUM
1792   };
1793
1794@@ -14421,6 +14534,8 @@
1795   {"mno-fix-loongson2f-jump", no_argument, NULL, OPTION_NO_FIX_LOONGSON2F_JUMP},
1796   {"mfix-loongson2f-nop", no_argument, NULL, OPTION_FIX_LOONGSON2F_NOP},
1797   {"mno-fix-loongson2f-nop", no_argument, NULL, OPTION_NO_FIX_LOONGSON2F_NOP},
1798+  {"mfix-loongson2f-btb", no_argument, NULL, OPTION_FIX_LOONGSON2F_BTB},
1799+  {"mno-fix-loongson2f-btb", no_argument, NULL, OPTION_NO_FIX_LOONGSON2F_BTB},
1800   {"mfix-vr4120",    no_argument, NULL, OPTION_FIX_VR4120},
1801   {"mno-fix-vr4120", no_argument, NULL, OPTION_NO_FIX_VR4120},
1802   {"mfix-vr4130",    no_argument, NULL, OPTION_FIX_VR4130},
1803@@ -14459,6 +14574,9 @@
1804      make testing easier.  */
1805   {"32",          no_argument, NULL, OPTION_32},
1806
1807+  {"mtrap-zero-jump", no_argument, NULL, OPTION_TRAP_ZERO_JUMP},
1808+  {"mno-trap-zero-jump", no_argument, NULL, OPTION_NO_TRAP_ZERO_JUMP},
1809+
1810   /* ELF-specific options.  */
1811 #ifdef OBJ_ELF
1812   {"KPIC",        no_argument, NULL, OPTION_CALL_SHARED},
1813@@ -14750,6 +14868,14 @@
1814       mips_fix_vr4130 = 0;
1815       break;
1816
1817+    case OPTION_FIX_LOONGSON2F_BTB:
1818+      mips_fix_loongson2f_btb = 1;
1819+      break;
1820+
1821+    case OPTION_NO_FIX_LOONGSON2F_BTB:
1822+      mips_fix_loongson2f_btb = 0;
1823+      break;
1824+
1825     case OPTION_FIX_CN63XXP1:
1826       mips_fix_cn63xxp1 = TRUE;
1827       break;
1828@@ -14782,6 +14908,14 @@
1829       mips_opts.sym32 = FALSE;
1830       break;
1831
1832+    case OPTION_TRAP_ZERO_JUMP:
1833+      mips_trap_zero_jump = TRUE;
1834+      break;
1835+
1836+    case OPTION_NO_TRAP_ZERO_JUMP:
1837+      mips_trap_zero_jump = FALSE;
1838+      break;
1839+
1840 #ifdef OBJ_ELF
1841       /* When generating ELF code, we permit -KPIC and -call_shared to
1842 	 select SVR4_PIC, and -non_shared to select no PIC.  This is
1843@@ -19411,6 +19545,7 @@
1844   fprintf (stream, _("\
1845 -mfix-loongson2f-jump	work around Loongson2F JUMP instructions\n\
1846 -mfix-loongson2f-nop	work around Loongson2F NOP errata\n\
1847+-mfix-loongson2f-btb	work around Loongson2F BTB errata\n\
1848 -mfix-vr4120		work around certain VR4120 errata\n\
1849 -mfix-vr4130		work around VR4130 mflo/mfhi errata\n\
1850 -mfix-24k		insert a nop after ERET and DERET instructions\n\
1851diff -rNU3 dist.orig/gas/config/tc-vax.c dist.nbsd/gas/config/tc-vax.c
1852--- dist.orig/gas/config/tc-vax.c	Mon Jun 28 14:06:57 2010
1853+++ dist.nbsd/gas/config/tc-vax.c	Wed Feb 19 16:39:28 2014
1854@@ -392,6 +392,9 @@
1855 	      && (PLT_symbol == NULL || fragP->fr_symbol != PLT_symbol)
1856 	      && fragP->fr_symbol != NULL
1857 	      && flag_want_pic
1858+#ifdef OBJ_ELF
1859+	      && ELF_ST_VISIBILITY (S_GET_OTHER (fragP->fr_symbol)) != STV_HIDDEN
1860+#endif
1861 	      && (!S_IS_DEFINED (fragP->fr_symbol)
1862 	          || S_IS_WEAK (fragP->fr_symbol)
1863 	          || S_IS_EXTERNAL (fragP->fr_symbol)))
1864@@ -1073,6 +1076,154 @@
1865   return retval;
1866 }
1867
1868+#ifdef OBJ_AOUT
1869+#ifndef BFD_ASSEMBLER
1870+void
1871+tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
1872+     char *where;
1873+     fixS *fixP;
1874+     relax_addressT segment_address_in_file;
1875+{
1876+  /*
1877+   * In: length of relocation (or of address) in chars: 1, 2 or 4.
1878+   * Out: GNU LD relocation length code: 0, 1, or 2.
1879+   */
1880+
1881+  static const unsigned char nbytes_r_length[] = {42, 0, 1, 42, 2};
1882+  int r_symbolnum;
1883+  int r_flags;
1884+
1885+  know (fixP->fx_addsy != NULL);
1886+
1887+  md_number_to_chars (where,
1888+       fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file,
1889+		      4);
1890+
1891+  r_symbolnum = (S_IS_DEFINED (fixP->fx_addsy)
1892+		 ? S_GET_TYPE (fixP->fx_addsy)
1893+		 : fixP->fx_addsy->sy_number);
1894+  r_flags = (fixP->fx_pcrel ? 1 : 0)
1895+      | (!S_IS_DEFINED (fixP->fx_addsy) ? 8 : 0)	/* extern */
1896+      | ((nbytes_r_length[fixP->fx_size] & 3) << 1);
1897+
1898+#if 0
1899+  r_flags |= ((!S_IS_DEFINED(fixP->fx_addsy)
1900+      && fixP->fx_pcrel
1901+      && fixP->fx_addsy != GOT_symbol
1902+      && fixP->fx_addsy != PLT_symbol
1903+      && flags_want_pic) ? 0x10 : 0);
1904+#endif
1905+
1906+  switch (fixP->fx_r_type) {
1907+	case NO_RELOC:
1908+		break;
1909+	case NO_RELOC2:
1910+		if (r_flags & 8)
1911+		    r_flags |= 0x80;		/* setting the copy bit */
1912+						/*   says we can convert */
1913+						/*   to gotslot if needed */
1914+		break;
1915+	case RELOC_32:
1916+		if (flag_want_pic && S_IS_EXTERNAL(fixP->fx_addsy)) {
1917+			r_symbolnum = fixP->fx_addsy->sy_number;
1918+			r_flags |= 8;		/* set extern bit */
1919+		}
1920+		break;
1921+	case RELOC_JMP_SLOT:
1922+		if (flag_want_pic) {
1923+			r_flags |= 0x20;	/* set jmptable */
1924+			r_flags &= ~0x08;	/* clear extern bit */
1925+		}
1926+		break;
1927+	case RELOC_JMP_TBL:
1928+		if (flag_want_pic) {
1929+			r_flags |= 0x20;	/* set jmptable */
1930+			r_flags |= 0x08;	/* set extern bit */
1931+		}
1932+		break;
1933+	case RELOC_GLOB_DAT:
1934+		if (flag_want_pic) {
1935+			r_flags |= 0x10;	/* set baserel bit */
1936+			r_symbolnum = fixP->fx_addsy->sy_number;
1937+			if (S_IS_EXTERNAL(fixP->fx_addsy))
1938+				r_flags |= 8;	/* set extern bit */
1939+		}
1940+		break;
1941+  }
1942+
1943+  where[4] = (r_symbolnum >>  0) & 0xff;
1944+  where[5] = (r_symbolnum >>  8) & 0xff;
1945+  where[6] = (r_symbolnum >> 16) & 0xff;
1946+  where[7] = r_flags;
1947+}
1948+#endif /* !BFD_ASSEMBLER */
1949+#endif /* OBJ_AOUT */
1950+
1951+/*
1952+ *       BUGS, GRIPES,  APOLOGIA, etc.
1953+ *
1954+ * The opcode table 'votstrs' needs to be sorted on opcode frequency.
1955+ * That is, AFTER we hash it with hash_...(), we want most-used opcodes
1956+ * to come out of the hash table faster.
1957+ *
1958+ * I am sorry to inflict yet another VAX assembler on the world, but
1959+ * RMS says we must do everything from scratch, to prevent pin-heads
1960+ * restricting this software.
1961+ */
1962+
1963+/*
1964+ * This is a vaguely modular set of routines in C to parse VAX
1965+ * assembly code using DEC mnemonics. It is NOT un*x specific.
1966+ *
1967+ * The idea here is that the assembler has taken care of all:
1968+ *   labels
1969+ *   macros
1970+ *   listing
1971+ *   pseudo-ops
1972+ *   line continuation
1973+ *   comments
1974+ *   condensing any whitespace down to exactly one space
1975+ * and all we have to do is parse 1 line into a vax instruction
1976+ * partially formed. We will accept a line, and deliver:
1977+ *   an error message (hopefully empty)
1978+ *   a skeleton VAX instruction (tree structure)
1979+ *   textual pointers to all the operand expressions
1980+ *   a warning message that notes a silly operand (hopefully empty)
1981+ */
1982+
1983+/*
1984+ *		E D I T   H I S T O R Y
1985+ *
1986+ * 17may86 Dean Elsner. Bug if line ends immediately after opcode.
1987+ * 30apr86 Dean Elsner. New vip_op() uses arg block so change call.
1988+ *  6jan86 Dean Elsner. Crock vip_begin() to call vip_op_defaults().
1989+ *  2jan86 Dean Elsner. Invent synthetic opcodes.
1990+ *	Widen vax_opcodeT to 32 bits. Use a bit for VIT_OPCODE_SYNTHETIC,
1991+ *	which means this is not a real opcode, it is like a macro; it will
1992+ *	be relax()ed into 1 or more instructions.
1993+ *	Use another bit for VIT_OPCODE_SPECIAL if the op-code is not optimised
1994+ *	like a regular branch instruction. Option added to vip_begin():
1995+ *	exclude	synthetic opcodes. Invent synthetic_votstrs[].
1996+ * 31dec85 Dean Elsner. Invent vit_opcode_nbytes.
1997+ *	Also make vit_opcode into a char[]. We now have n-byte vax opcodes,
1998+ *	so caller's don't have to know the difference between a 1-byte & a
1999+ *	2-byte op-code. Still need vax_opcodeT concept, so we know how
2000+ *	big an object must be to hold an op.code.
2001+ * 30dec85 Dean Elsner. Widen typedef vax_opcodeT in "vax-inst.h"
2002+ *	because vax opcodes may be 16 bits. Our crufty C compiler was
2003+ *	happily initialising 8-bit vot_codes with 16-bit numbers!
2004+ *	(Wouldn't the 'phone company like to compress data so easily!)
2005+ * 29dec85 Dean Elsner. New static table vax_operand_width_size[].
2006+ *	Invented so we know hw many bytes a "I^#42" needs in its immediate
2007+ *	operand. Revised struct vop in "vax-inst.h": explicitly include
2008+ *	byte length of each operand, and it's letter-code datum type.
2009+ * 17nov85 Dean Elsner. Name Change.
2010+ *	Due to ar(1) truncating names, we learned the hard way that
2011+ *	"vax-inst-parse.c" -> "vax-inst-parse." dropping the "o" off
2012+ *	the archived object name. SO... we shortened the name of this
2013+ *	source file, and changed the makefile.
2014+ */
2015+
2016 /* Parse a vax operand in DEC assembler notation.
2017    For speed, expect a string of whitespace to be reduced to a single ' '.
2018    This is the case for GNU AS, and is easy for other DEC-compatible
2019@@ -3150,7 +3301,7 @@
2020 			  if (flag_want_pic && operandP->vop_mode == 8
2021 				&& this_add_symbol != NULL)
2022 			    {
2023-			      as_warn (_("Symbol %s used as immediate operand in PIC mode."),
2024+			      as_warn (_("Symbol '%s' used as immediate operand in PIC mode."),
2025 				       S_GET_NAME (this_add_symbol));
2026 			    }
2027 #endif
2028@@ -3226,7 +3377,15 @@
2029 			      length = 4;
2030 			    }
2031 			}
2032+#ifdef OBJ_ELF
2033+		      if (flag_want_pic && this_add_symbol != NULL)
2034+		        {
2035+			  as_warn (_("Symbol '%s' used as displacement in PIC mode."),
2036+			       S_GET_NAME (this_add_symbol));
2037+		        }
2038+#endif
2039 		      p = frag_more (1 + length);
2040+		      know (operandP->vop_reg != 0xf);
2041 		      know (operandP->vop_reg >= 0);
2042 		      p[0] = operandP->vop_reg
2043 			| ((at | "?\12\14?\16"[length]) << 4);
2044diff -rNU3 dist.orig/gas/config/te-armnbsd.h dist.nbsd/gas/config/te-armnbsd.h
2045--- dist.orig/gas/config/te-armnbsd.h	Thu Jan  1 00:00:00 1970
2046+++ dist.nbsd/gas/config/te-armnbsd.h	Wed Feb 19 16:39:28 2014
2047@@ -0,0 +1,22 @@
2048+/* Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
2049+
2050+   This file is part of GAS, the GNU Assembler.
2051+
2052+   GAS is free software; you can redistribute it and/or modify
2053+   it under the terms of the GNU General Public License as
2054+   published by the Free Software Foundation; either version 3,
2055+   or (at your option) any later version.
2056+
2057+   GAS is distributed in the hope that it will be useful, but
2058+   WITHOUT ANY WARRANTY; without even the implied warranty of
2059+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
2060+   the GNU General Public License for more details.
2061+
2062+   You should have received a copy of the GNU General Public License
2063+   along with GAS; see the file COPYING.  If not, write to the Free
2064+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
2065+   02110-1301, USA.  */
2066+
2067+#include "te-nbsd.h"
2068+
2069+#define CPU_DEFAULT ARM_ARCH_V4
2070diff -rNU3 dist.orig/gas/config/te-armnbsdeabi.h dist.nbsd/gas/config/te-armnbsdeabi.h
2071--- dist.orig/gas/config/te-armnbsdeabi.h	Thu Jan  1 00:00:00 1970
2072+++ dist.nbsd/gas/config/te-armnbsdeabi.h	Wed Feb 19 16:39:28 2014
2073@@ -0,0 +1,25 @@
2074+/* Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
2075+
2076+   This file is part of GAS, the GNU Assembler.
2077+
2078+   GAS is free software; you can redistribute it and/or modify
2079+   it under the terms of the GNU General Public License as
2080+   published by the Free Software Foundation; either version 3,
2081+   or (at your option) any later version.
2082+
2083+   GAS is distributed in the hope that it will be useful, but
2084+   WITHOUT ANY WARRANTY; without even the implied warranty of
2085+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
2086+   the GNU General Public License for more details.
2087+
2088+   You should have received a copy of the GNU General Public License
2089+   along with GAS; see the file COPYING.  If not, write to the Free
2090+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
2091+   02110-1301, USA.  */
2092+
2093+#include "te-nbsd.h"
2094+
2095+/* The EABI requires the use of VFP.  */
2096+#define CPU_DEFAULT ARM_ARCH_V5TEJ
2097+#define FPU_DEFAULT FPU_ARCH_VFP
2098+#define EABI_DEFAULT EF_ARM_EABI_VER5
2099diff -rNU3 dist.orig/gas/config/te-armnbsdeabihf.h dist.nbsd/gas/config/te-armnbsdeabihf.h
2100--- dist.orig/gas/config/te-armnbsdeabihf.h	Thu Jan  1 00:00:00 1970
2101+++ dist.nbsd/gas/config/te-armnbsdeabihf.h	Wed Feb 19 16:39:28 2014
2102@@ -0,0 +1,25 @@
2103+/* Copyright 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
2104+
2105+   This file is part of GAS, the GNU Assembler.
2106+
2107+   GAS is free software; you can redistribute it and/or modify
2108+   it under the terms of the GNU General Public License as
2109+   published by the Free Software Foundation; either version 3,
2110+   or (at your option) any later version.
2111+
2112+   GAS is distributed in the hope that it will be useful, but
2113+   WITHOUT ANY WARRANTY; without even the implied warranty of
2114+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
2115+   the GNU General Public License for more details.
2116+
2117+   You should have received a copy of the GNU General Public License
2118+   along with GAS; see the file COPYING.  If not, write to the Free
2119+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
2120+   02110-1301, USA.  */
2121+
2122+#include "te-nbsd.h"
2123+
2124+/* The EABI requires the use of VFP.  */
2125+#define CPU_DEFAULT ARM_ARCH_V5TEJ
2126+#define FPU_DEFAULT FPU_ARCH_VFP_V2
2127+#define EABI_DEFAULT EF_ARM_EABI_VER5
2128diff -rNU3 dist.orig/gas/config/vax-inst.h dist.nbsd/gas/config/vax-inst.h
2129--- dist.orig/gas/config/vax-inst.h	Wed Sep  2 07:24:21 2009
2130+++ dist.nbsd/gas/config/vax-inst.h	Wed Feb 19 16:39:28 2014
2131@@ -66,6 +66,8 @@
2132 #define VAX_WIDEN_WORD (0x20)	/* Add this to byte branch to get word br.  */
2133 #define VAX_WIDEN_LONG (0x6)	/* Add this to byte branch to get long jmp.*/
2134 /* Needs VAX_PC_RELATIVE_MODE byte after it*/
2135+#define	VAX_CALLS (0xFB)	/* Call with arg list on stack	           */
2136+#define	VAX_CALLG (0xFA)	/* Call with arg list in memory		   */
2137
2138 struct vit			/* vax instruction tree                    */
2139 {
2140diff -rNU3 dist.orig/gas/configure.tgt dist.nbsd/gas/configure.tgt
2141--- dist.orig/gas/configure.tgt	Tue Sep  4 12:53:45 2012
2142+++ dist.nbsd/gas/configure.tgt	Wed Feb 19 16:39:28 2014
2143@@ -51,7 +51,7 @@
2144   m32c)			cpu_type=m32c endian=little ;;
2145   m32r)			cpu_type=m32r endian=big ;;
2146   m32rle)		cpu_type=m32r endian=little ;;
2147-  m5200)		cpu_type=m68k ;;
2148+  m5200|m5407)		cpu_type=m68k ;;
2149   m68008)		cpu_type=m68k ;;
2150   m680[012346]0)	cpu_type=m68k ;;
2151   m6811|m6812|m68hc12)	cpu_type=m68hc11 ;;
2152@@ -111,9 +111,11 @@
2153   arc-*-elf*)				fmt=elf ;;
2154
2155   arm-*-aout)				fmt=aout ;;
2156-  arm-*-coff)				fmt=coff ;;
2157-  arm-*-rtems*)				fmt=elf ;;
2158-  arm-*-elf)				fmt=elf ;;
2159+  arm-*-coff | thumb-*-coff)		fmt=coff ;;
2160+  arm-*-rtems* | thumb-*-rtems*)	fmt=elf ;;
2161+  arm-*-elf | thumb-*-elf)		fmt=elf ;;
2162+  arm-*-netbsdelf*-*eabihf*)		fmt=elf em=armnbsdeabihf ;;
2163+  arm-*-netbsdelf*-*eabi*)		fmt=elf em=armnbsdeabi ;;
2164   arm-*-eabi*)				fmt=elf em=armeabi ;;
2165   arm-*-symbianelf*)			fmt=elf em=symbian ;;
2166   arm-*-kaos*)				fmt=elf ;;
2167@@ -124,8 +126,8 @@
2168   arm-*-uclinux*eabi*)			fmt=elf  em=armlinuxeabi ;;
2169   arm-*-uclinux*)			fmt=elf  em=linux ;;
2170   arm-*-nacl*)				fmt=elf  em=nacl ;;
2171-  arm-*-netbsdelf*)			fmt=elf  em=nbsd ;;
2172-  arm-*-*n*bsd*)			fmt=aout em=nbsd ;;
2173+  arm-*-netbsdelf*)			fmt=elf  em=armnbsd ;;
2174+  arm-*-*n*bsd*)			fmt=aout em=armnbsd ;;
2175   arm-*-nto*)				fmt=elf ;;
2176   arm-epoc-pe)				fmt=coff em=epoc-pe ;;
2177   arm-wince-pe | arm-*-wince | arm*-*-mingw32ce* | arm*-*-cegcc*)
2178diff -rNU3 dist.orig/gas/doc/Makefile.am dist.nbsd/gas/doc/Makefile.am
2179--- dist.orig/gas/doc/Makefile.am	Tue Sep  4 12:53:45 2012
2180+++ dist.nbsd/gas/doc/Makefile.am	Wed Feb 19 16:39:28 2014
2181@@ -24,6 +24,8 @@
2182 		   -I "$(top_srcdir)/../bfd/doc" -I ../../bfd/doc
2183
2184 asconfig.texi: $(CONFIG).texi
2185+	@echo "NOT REBUILDING $@"
2186+NetBSD_DISABLED_asconfig.text:
2187 	rm -f asconfig.texi
2188 	cp $(srcdir)/$(CONFIG).texi ./asconfig.texi
2189 	chmod u+w ./asconfig.texi
2190@@ -103,6 +105,8 @@
2191 # The sed command removes the no-adjust Nroff command so that
2192 # the man output looks standard.
2193 as.1: $(srcdir)/as.texinfo asconfig.texi $(CPU_DOCS)
2194+	@echo "NOT REBUILDING $@"
2195+NetBSD_DISABLED_as.1:
2196 	touch $@
2197 	-$(TEXI2POD) $(MANCONF) < $(srcdir)/as.texinfo > as.pod
2198 	-($(POD2MAN) as.pod | \
2199diff -rNU3 dist.orig/gas/doc/Makefile.in dist.nbsd/gas/doc/Makefile.in
2200--- dist.orig/gas/doc/Makefile.in	Tue Sep  4 12:53:45 2012
2201+++ dist.nbsd/gas/doc/Makefile.in	Wed Feb 19 16:39:28 2014
2202@@ -374,6 +374,8 @@
2203 	-rm -rf .libs _libs
2204
2205 as.info: as.texinfo $(as_TEXINFOS)
2206+	@echo "NOT REBUILDING $@"
2207+NetBSD_DISABLED_as.info: as.texinfo $(as_TEXINFOS)
2208 	restore=: && backupdir="$(am__leading_dot)am$$$$" && \
2209 	rm -rf $$backupdir && mkdir $$backupdir && \
2210 	if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
2211@@ -756,6 +758,8 @@
2212
2213
2214 asconfig.texi: $(CONFIG).texi
2215+	@echo "NOT REBUILDING $@"
2216+NetBSD_DISABLED_asconfig.texi:
2217 	rm -f asconfig.texi
2218 	cp $(srcdir)/$(CONFIG).texi ./asconfig.texi
2219 	chmod u+w ./asconfig.texi
2220@@ -773,6 +777,8 @@
2221 # The sed command removes the no-adjust Nroff command so that
2222 # the man output looks standard.
2223 as.1: $(srcdir)/as.texinfo asconfig.texi $(CPU_DOCS)
2224+	@echo "NOT REBUILDING $@"
2225+NetBSD_DISABLED_as.1:
2226 	touch $@
2227 	-$(TEXI2POD) $(MANCONF) < $(srcdir)/as.texinfo > as.pod
2228 	-($(POD2MAN) as.pod | \
2229Binary files dist.orig/gas/doc/as.info and dist.nbsd/gas/doc/as.info differ
2230diff -rNU3 dist.orig/gas/doc/c-mips.texi dist.nbsd/gas/doc/c-mips.texi
2231--- dist.orig/gas/doc/c-mips.texi	Tue Sep  4 14:16:07 2012
2232+++ dist.nbsd/gas/doc/c-mips.texi	Wed Feb 19 16:39:28 2014
2233@@ -210,6 +210,14 @@
2234 @itemx -mno-fix-vr4130
2235 Insert nops to work around the VR4130 @samp{mflo}/@samp{mfhi} errata.
2236
2237+@item -mfix-loongson2f-btb
2238+@itemx -mno-fix-loongson2f-btb
2239+Clear the Branch Target Buffer before any jump through a register.  This
2240+option is intended to be used on kernel code for the Loongson 2F processor
2241+only; userland code compiled with this option will fault, and kernel code
2242+compiled with this option run on another processor than Loongson 2F will
2243+yield unpredictable results.
2244+
2245 @item -mfix-24k
2246 @itemx -mno-fix-24k
2247 Insert nops to work around the 24K @samp{eret}/@samp{deret} errata.
2248diff -rNU3 dist.orig/gas/remap.c dist.nbsd/gas/remap.c
2249--- dist.orig/gas/remap.c	Fri Mar 11 14:18:24 2011
2250+++ dist.nbsd/gas/remap.c	Wed Feb 19 16:39:30 2014
2251@@ -84,8 +84,8 @@
2252     return xstrdup (filename);
2253   name = filename + map->old_len;
2254   name_len = strlen (name) + 1;
2255-  s = (char *) alloca (name_len + map->new_len);
2256+  s = (char *) xmalloc (name_len + map->new_len);
2257   memcpy (s, map->new_prefix, map->new_len);
2258   memcpy (s + map->new_len, name, name_len);
2259-  return xstrdup (s);
2260+  return s;
2261 }
2262diff -rNU3 dist.orig/gprof/corefile.c dist.nbsd/gprof/corefile.c
2263--- dist.orig/gprof/corefile.c	Tue Mar  6 13:54:59 2012
2264+++ dist.nbsd/gprof/corefile.c	Wed Feb 19 16:39:31 2014
2265@@ -30,6 +30,8 @@
2266 #include "corefile.h"
2267 #include "safe-ctype.h"
2268
2269+#include <stdlib.h>
2270+
2271 bfd *core_bfd;
2272 static int core_num_syms;
2273 static asymbol **core_syms;
2274diff -rNU3 dist.orig/gprof/gprof.c dist.nbsd/gprof/gprof.c
2275--- dist.orig/gprof/gprof.c	Fri Jun 12 15:33:30 2009
2276+++ dist.nbsd/gprof/gprof.c	Wed Feb 19 16:39:31 2014
2277@@ -47,6 +47,8 @@
2278
2279 static void usage (FILE *, int) ATTRIBUTE_NORETURN;
2280
2281+#include <stdlib.h>
2282+
2283 const char * whoami;
2284 const char * function_mapping_file;
2285 static const char * external_symbol_table;
2286Binary files dist.orig/gprof/gprof.info and dist.nbsd/gprof/gprof.info differ
2287diff -rNU3 dist.orig/include/bfdlink.h dist.nbsd/include/bfdlink.h
2288--- dist.orig/include/bfdlink.h	Mon Apr  9 16:27:18 2012
2289+++ dist.nbsd/include/bfdlink.h	Wed Feb 19 16:39:28 2014
2290@@ -435,6 +435,10 @@
2291      option).  If this is NULL, no symbols are being wrapped.  */
2292   struct bfd_hash_table *wrap_hash;
2293
2294+  /* Hash table of symbols which may be left unresolved during
2295+     a link.  If this is NULL, no symbols can be left unresolved.  */
2296+  struct bfd_hash_table *ignore_hash;
2297+
2298   /* The output BFD.  */
2299   bfd *output_bfd;
2300
2301diff -rNU3 dist.orig/include/elf/common.h dist.nbsd/include/elf/common.h
2302--- dist.orig/include/elf/common.h	Tue Sep  4 12:53:47 2012
2303+++ dist.nbsd/include/elf/common.h	Wed Feb 19 16:39:28 2014
2304@@ -607,6 +607,7 @@
2305 /* Values for NetBSD .note.netbsd.ident notes.  Note name is "NetBSD".  */
2306
2307 #define NT_NETBSD_IDENT		1
2308+#define NT_NETBSD_MARCH		5
2309
2310 /* Values for OpenBSD .note.openbsd.ident notes.  Note name is "OpenBSD".  */
2311
2312diff -rNU3 dist.orig/include/objalloc.h dist.nbsd/include/objalloc.h
2313--- dist.orig/include/objalloc.h	Tue May 10 10:21:08 2005
2314+++ dist.nbsd/include/objalloc.h	Wed Feb 19 16:39:28 2014
2315@@ -1,5 +1,5 @@
2316 /* objalloc.h -- routines to allocate memory for objects
2317-   Copyright 1997, 2001 Free Software Foundation, Inc.
2318+   Copyright 1997-2012 Free Software Foundation, Inc.
2319    Written by Ian Lance Taylor, Cygnus Solutions.
2320
2321 This program is free software; you can redistribute it and/or modify it
2322@@ -91,7 +91,7 @@
2323      if (__len == 0)							\
2324        __len = 1;							\
2325      __len = (__len + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1);	\
2326-     (__len <= __o->current_space					\
2327+     (__len != 0 && __len <= __o->current_space				\
2328       ? (__o->current_ptr += __len,					\
2329 	 __o->current_space -= __len,					\
2330 	 (void *) (__o->current_ptr - __len))				\
2331diff -rNU3 dist.orig/include/opcode/mips.h dist.nbsd/include/opcode/mips.h
2332--- dist.orig/include/opcode/mips.h	Tue Sep  4 14:21:05 2012
2333+++ dist.nbsd/include/opcode/mips.h	Wed Feb 19 16:39:28 2014
2334@@ -1035,7 +1035,11 @@
2335   M_DSUB_I,
2336   M_DSUBU_I,
2337   M_DSUBU_I_2,
2338+  M_JR_S,
2339+  M_J_S,
2340   M_J_A,
2341+  M_JALR_S,
2342+  M_JALR_DS,
2343   M_JAL_1,
2344   M_JAL_2,
2345   M_JAL_A,
2346diff -rNU3 dist.orig/ld/Makefile.am dist.nbsd/ld/Makefile.am
2347--- dist.orig/ld/Makefile.am	Mon Mar 25 08:06:23 2013
2348+++ dist.nbsd/ld/Makefile.am	Wed Feb 19 16:39:31 2014
2349@@ -145,12 +145,14 @@
2350 	earmelf_linux_eabi.c \
2351 	earmelf_nacl.c \
2352 	earmelf_nbsd.c \
2353+	earmelf_nbsd_eabi.c \
2354 	earmelf_vxworks.c \
2355 	earmelfb.c \
2356 	earmelfb_linux.c \
2357 	earmelfb_linux_eabi.c \
2358 	earmelfb_nacl.c \
2359 	earmelfb_nbsd.c \
2360+	earmelfb_nbsd_eabi.c \
2361 	earmnbsd.c \
2362 	earmnto.c \
2363 	earmpe.c \
2364@@ -731,6 +733,11 @@
2365   $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
2366   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
2367 	${GENSCRIPTS} armelf_nbsd "$(tdir_armelf_nbsd)"
2368+earmelf_nbsd_abi.c: $(srcdir)/emulparams/armelf_nbsd_abi.sh \
2369+  $(srcdir)/emulparams/armelf.sh \
2370+  $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
2371+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
2372+	${GENSCRIPTS} armelf_nbsd_abi "$(tdir_armelf_nbsd_abi)"
2373 earmelf_vxworks.c: $(srcdir)/emulparams/armelf_vxworks.sh \
2374   $(srcdir)/emulparams/vxworks.sh $(srcdir)/emulparams/armelf.sh \
2375   $(ELF_DEPS) $(srcdir)/emultempl/vxworks.em \
2376@@ -766,6 +773,12 @@
2377   $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
2378   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
2379 	${GENSCRIPTS} armelfb_nbsd "$(tdir_armelfb_nbsd)"
2380+earmelfb_nbsd_abi.c: $(srcdir)/emulparams/armelfb_nbsd_abi.sh \
2381+  $(srcdir)/emulparams/armelf_nbsd_abi.sh \
2382+  $(srcdir)/emulparams/armelf.sh \
2383+  $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
2384+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
2385+	${GENSCRIPTS} armelfb_nbsd_abi "$(tdir_armelfb_nbsd_abi)"
2386 earmnbsd.c:	$(srcdir)/emulparams/armnbsd.sh \
2387   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
2388 	${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
2389@@ -2219,6 +2232,8 @@
2390 # because almost all configs use "gen" version of manual.
2391 #  Set DOCVER above to change.
2392 configdoc.texi:	${DOCVER}-doc.texi
2393+	@echo "NOT REBUILDING $@"
2394+NetBSD_DISABLED_configdoc.texi:
2395 	cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi
2396 	chmod u+w ./configdoc.texi
2397
2398@@ -2226,6 +2241,8 @@
2399 # The sed command removes the no-adjust Nroff command so that
2400 # the man output looks standard.
2401 ld.1: $(srcdir)/ld.texinfo configdoc.texi
2402+	@echo "NOT REBUILDING $@"
2403+NetBSD_DISABLED_ld.1:
2404 	touch $@
2405 	-$(TEXI2POD) $(MANCONF) < $(srcdir)/ld.texinfo > ld.pod
2406 	-($(POD2MAN) ld.pod | \
2407diff -rNU3 dist.orig/ld/Makefile.in dist.nbsd/ld/Makefile.in
2408--- dist.orig/ld/Makefile.in	Mon Mar 25 08:06:23 2013
2409+++ dist.nbsd/ld/Makefile.in	Wed Feb 19 16:39:31 2014
2410@@ -452,12 +452,14 @@
2411 	earmelf_linux_eabi.c \
2412 	earmelf_nacl.c \
2413 	earmelf_nbsd.c \
2414+	earmelf_nbsd_eabi.c \
2415 	earmelf_vxworks.c \
2416 	earmelfb.c \
2417 	earmelfb_linux.c \
2418 	earmelfb_linux_eabi.c \
2419 	earmelfb_nacl.c \
2420 	earmelfb_nbsd.c \
2421+	earmelfb_nbsd_eabi.c \
2422 	earmnbsd.c \
2423 	earmnto.c \
2424 	earmpe.c \
2425@@ -1078,12 +1080,14 @@
2426 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_linux_eabi.Po@am__quote@
2427 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nacl.Po@am__quote@
2428 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nbsd.Po@am__quote@
2429+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_nbsd_abi.Po@am__quote@
2430 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelf_vxworks.Po@am__quote@
2431 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb.Po@am__quote@
2432 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_linux.Po@am__quote@
2433 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_linux_eabi.Po@am__quote@
2434 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nacl.Po@am__quote@
2435 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nbsd.Po@am__quote@
2436+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmelfb_nbsd_eabi.Po@am__quote@
2437 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmnbsd.Po@am__quote@
2438 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmnto.Po@am__quote@
2439 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earmpe.Po@am__quote@
2440@@ -1490,6 +1494,8 @@
2441 	-rm -f libtool config.lt
2442
2443 ld.info: ld.texinfo $(ld_TEXINFOS)
2444+	@echo "NOT REBUILDING $@"
2445+NetBSD_DISABLED_ld.info: ld.texinfo $(ld_TEXINFOS)
2446 	restore=: && backupdir="$(am__leading_dot)am$$$$" && \
2447 	rm -rf $$backupdir && mkdir $$backupdir && \
2448 	if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
2449@@ -2201,6 +2207,11 @@
2450   $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
2451   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
2452 	${GENSCRIPTS} armelf_nbsd "$(tdir_armelf_nbsd)"
2453+earmelf_nbsd_eabi.c: $(srcdir)/emulparams/armelf_nbsd_eabi.sh \
2454+  $(srcdir)/emulparams/armelf.sh \
2455+  $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
2456+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
2457+	${GENSCRIPTS} armelf_nbsd_eabi "$(tdir_armelf_nbsd_eabi)"
2458 earmelf_vxworks.c: $(srcdir)/emulparams/armelf_vxworks.sh \
2459   $(srcdir)/emulparams/vxworks.sh $(srcdir)/emulparams/armelf.sh \
2460   $(ELF_DEPS) $(srcdir)/emultempl/vxworks.em \
2461@@ -2236,6 +2247,12 @@
2462   $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
2463   $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
2464 	${GENSCRIPTS} armelfb_nbsd "$(tdir_armelfb_nbsd)"
2465+earmelfb_nbsd_eabi.c: $(srcdir)/emulparams/armelfb_nbsd_eabi.sh \
2466+  $(srcdir)/emulparams/armelf_nbsd_eabi.sh \
2467+  $(srcdir)/emulparams/armelf.sh \
2468+  $(ELF_DEPS) $(srcdir)/emultempl/armelf.em \
2469+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
2470+	${GENSCRIPTS} armelfb_nbsd_eabi "$(tdir_armelfb_nbsd_eabi)"
2471 earmnbsd.c:	$(srcdir)/emulparams/armnbsd.sh \
2472   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
2473 	${GENSCRIPTS} armnbsd "$(tdir_armnbsd)"
2474@@ -3632,6 +3649,8 @@
2475 # because almost all configs use "gen" version of manual.
2476 #  Set DOCVER above to change.
2477 configdoc.texi:	${DOCVER}-doc.texi
2478+	@echo "NOT REBUILDING $@"
2479+NetBSD_DISABLED_configdoc.texi:
2480 	cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi
2481 	chmod u+w ./configdoc.texi
2482
2483@@ -3639,6 +3658,8 @@
2484 # The sed command removes the no-adjust Nroff command so that
2485 # the man output looks standard.
2486 ld.1: $(srcdir)/ld.texinfo configdoc.texi
2487+	@echo "NOT REBUILDING $@"
2488+NetBSD_DISABLED_ld.1:
2489 	touch $@
2490 	-$(TEXI2POD) $(MANCONF) < $(srcdir)/ld.texinfo > ld.pod
2491 	-($(POD2MAN) ld.pod | \
2492diff -rNU3 dist.orig/ld/configdoc.texi dist.nbsd/ld/configdoc.texi
2493--- dist.orig/ld/configdoc.texi	Tue Nov 13 14:19:33 2012
2494+++ dist.nbsd/ld/configdoc.texi	Thu Jan  1 00:00:00 1970
2495@@ -1,27 +0,0 @@
2496-@c ------------------------------ CONFIGURATION VARS:
2497-@c 1. Inclusiveness of this manual
2498-@set GENERIC
2499-
2500-@c 2. Specific target machines
2501-@set ARM
2502-@set C6X
2503-@set H8300
2504-@set HPPA
2505-@set I960
2506-@set M68HC11
2507-@set M68K
2508-@set MMIX
2509-@set MSP430
2510-@set POWERPC
2511-@set POWERPC64
2512-@set Renesas
2513-@set SPU
2514-@set TICOFF
2515-@set WIN32
2516-@set XTENSA
2517-
2518-@c 3. Properties of this configuration
2519-@clear SingleFormat
2520-@set UsesEnvVars
2521-@c ------------------------------ end CONFIGURATION VARS
2522-
2523diff -rNU3 dist.orig/ld/configure.tgt dist.nbsd/ld/configure.tgt
2524--- dist.orig/ld/configure.tgt	Tue Sep  4 12:53:47 2012
2525+++ dist.nbsd/ld/configure.tgt	Wed Feb 19 16:39:31 2014
2526@@ -64,7 +64,13 @@
2527 arm-*-freebsd* | arm-*-kfreebsd*-gnu)
2528 	       		targ_emul=armelf_fbsd
2529 			targ_extra_emuls="armelf" ;;
2530-armeb-*-netbsdelf*)	targ_emul=armelfb_nbsd;
2531+arm*eb-*-netbsdelf*-*eabi*)
2532+			targ_emul=armelfb_nbsd_eabi;
2533+			targ_extra_emuls="armelf_nbsd_eabi armelf armnbsd" ;;
2534+arm*-*-netbsdelf*-*eabi*)
2535+			targ_emul=armelf_nbsd_eabi;
2536+			targ_extra_emuls="armelfb_nbsd_eabi armelf armnbsd" ;;
2537+arm*eb-*-netbsdelf*)	targ_emul=armelfb_nbsd;
2538 			targ_extra_emuls="armelf_nbsd armelf armnbsd" ;;
2539 arm-*-netbsdelf*)	targ_emul=armelf_nbsd;
2540 			targ_extra_emuls="armelfb_nbsd armelf armnbsd" ;;
2541@@ -379,7 +385,8 @@
2542 m68*-*-gnu*)		targ_emul=m68kelf ;;
2543 m68*-*-netbsd*4k*)	targ_emul=m68k4knbsd
2544 			targ_extra_emuls="m68knbsd m68kelfnbsd" ;;
2545-m68*-*-netbsdelf*)	targ_emul=m68kelfnbsd
2546+m68*-*-netbsdelf* | m5407*-*-netbsdelf*)
2547+			targ_emul=m68kelfnbsd
2548 			targ_extra_emuls="m68knbsd m68k4knbsd" ;;
2549 m68*-*-netbsdaout* | m68*-*-netbsd*)
2550 			targ_emul=m68knbsd
2551@@ -409,12 +416,18 @@
2552 mips*-sgi-irix*)	targ_emul=mipsbig ;;
2553 mips*el-*-ecoff*)	targ_emul=mipsidtl ;;
2554 mips*-*-ecoff*)		targ_emul=mipsidt ;;
2555+mips64*el-*-netbsd*)	targ_emul=elf32ltsmipn32
2556+			targ_extra_emuls="elf64btsmip elf64ltsmip elf32ltsmip elf32btsmipn32 elf32btsmip"
2557+			;;
2558+mips64*-*-netbsd*)	targ_emul=elf32btsmipn32
2559+			targ_extra_emuls="elf64ltsmip elf64btsmip elf32btsmip elf32ltsmipn32 elf32ltsmip"
2560+			;;
2561 mips*el-*-netbsd*)	targ_emul=elf32ltsmip
2562 			targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip"
2563 			;;
2564 mips*-*-netbsd*)	targ_emul=elf32btsmip
2565 			targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip"
2566-  			;;
2567+			;;
2568 mips*-*-bsd*)		targ_emul=mipsbig ;;
2569 mips*vr4300el-*-elf*)	targ_emul=elf32l4300 ;;
2570 mips*vr4300-*-elf*)	targ_emul=elf32b4300 ;;
2571@@ -654,10 +667,15 @@
2572 			tdir_sparclinux=${targ_alias}aout
2573 			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
2574 			tdir_sun4=sparc-sun-sunos4 ;;
2575-sparc64-*-netbsd* | sparc64-*-openbsd*)
2576-			targ_emul=elf64_sparc
2577-			targ_extra_emuls="elf32_sparc" ;;
2578-sparc*-*-netbsd*elf*)	targ_emul=elf32_sparc ;;
2579+sparc64-*-netbsd*)	targ_emul=elf64_sparc
2580+			targ_extra_emuls="elf32_sparc sparcnbsd"
2581+			;;
2582+sparc64-*-openbsd*)	targ_emul=elf64_sparc
2583+			targ_extra_emuls="elf32_sparc"
2584+			;;
2585+sparc*-*-netbsd*elf*)	targ_emul=elf32_sparc
2586+			targ_extra_emuls=sparcnbsd
2587+			;;
2588 sparc*-*-netbsd*)	targ_emul=sparcnbsd ;;
2589 sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
2590 			targ_emul=elf32_sparc_sol2
2591diff -rNU3 dist.orig/ld/emulparams/armelf_nbsd.sh dist.nbsd/ld/emulparams/armelf_nbsd.sh
2592--- dist.orig/ld/emulparams/armelf_nbsd.sh	Tue May 30 16:45:32 2006
2593+++ dist.nbsd/ld/emulparams/armelf_nbsd.sh	Wed Feb 19 16:39:31 2014
2594@@ -3,5 +3,12 @@
2595 TEXT_START_ADDR=0x00008000
2596 TARGET2_TYPE=got-rel
2597
2598+unset DATA_START_SYMBOLS
2599 unset STACK_ADDR
2600 unset EMBEDDED
2601+
2602+case "$target" in
2603+  arm*-*-netbsdelf*-*eabi*)
2604+    LIB_PATH='=/usr/lib/oabi'
2605+    ;;
2606+esac
2607diff -rNU3 dist.orig/ld/emulparams/armelf_nbsd_eabi.sh dist.nbsd/ld/emulparams/armelf_nbsd_eabi.sh
2608--- dist.orig/ld/emulparams/armelf_nbsd_eabi.sh	Thu Jan  1 00:00:00 1970
2609+++ dist.nbsd/ld/emulparams/armelf_nbsd_eabi.sh	Wed Feb 19 16:39:31 2014
2610@@ -0,0 +1,18 @@
2611+. ${srcdir}/emulparams/armelf_nbsd.sh
2612+
2613+# Use the ARM ABI-compliant exception-handling sections.
2614+OTHER_READONLY_SECTIONS="
2615+  .ARM.extab ${RELOCATING-0} : { *(.ARM.extab${RELOCATING+* .gnu.linkonce.armextab.*}) }
2616+  ${RELOCATING+ PROVIDE_HIDDEN (__exidx_start = .); }
2617+  .ARM.exidx ${RELOCATING-0} : { *(.ARM.exidx${RELOCATING+* .gnu.linkonce.armexidx.*}) }
2618+  ${RELOCATING+ PROVIDE_HIDDEN (__exidx_end = .); }"
2619+
2620+unset LIB_PATH
2621+
2622+case "$target" in
2623+  arm*-*-netbsdelf*-*eabi*)
2624+    ;;
2625+  arm*-*-netbsdelf*)
2626+    LIB_PATH='=/usr/lib/eabi'
2627+    ;;
2628+esac
2629diff -rNU3 dist.orig/ld/emulparams/armelfb_nbsd_eabi.sh dist.nbsd/ld/emulparams/armelfb_nbsd_eabi.sh
2630--- dist.orig/ld/emulparams/armelfb_nbsd_eabi.sh	Thu Jan  1 00:00:00 1970
2631+++ dist.nbsd/ld/emulparams/armelfb_nbsd_eabi.sh	Wed Feb 19 16:39:31 2014
2632@@ -0,0 +1,2 @@
2633+. ${srcdir}/emulparams/armelf_nbsd_eabi.sh
2634+OUTPUT_FORMAT="elf32-bigarm"
2635diff -rNU3 dist.orig/ld/emulparams/elf32_sparc.sh dist.nbsd/ld/emulparams/elf32_sparc.sh
2636--- dist.orig/ld/emulparams/elf32_sparc.sh	Mon Sep 20 18:41:15 2010
2637+++ dist.nbsd/ld/emulparams/elf32_sparc.sh	Wed Feb 19 16:39:31 2014
2638@@ -13,6 +13,7 @@
2639 TEMPLATE_NAME=elf32
2640 DATA_PLT=
2641 GENERATE_SHLIB_SCRIPT=yes
2642+#ELFSIZE=32
2643 GENERATE_PIE_SCRIPT=yes
2644 NOP=0x01000000
2645 NO_SMALL_DATA=yes
2646diff -rNU3 dist.orig/ld/emulparams/elf32bmipn32-defs.sh dist.nbsd/ld/emulparams/elf32bmipn32-defs.sh
2647--- dist.orig/ld/emulparams/elf32bmipn32-defs.sh	Tue Sep  4 14:14:28 2012
2648+++ dist.nbsd/ld/emulparams/elf32bmipn32-defs.sh	Wed Feb 19 16:39:31 2014
2649@@ -6,6 +6,7 @@
2650
2651 # Handle both big- and little-ended 32-bit MIPS objects.
2652 ARCH=mips
2653+MACHINE=
2654 OUTPUT_FORMAT="elf32-bigmips"
2655 BIG_OUTPUT_FORMAT="elf32-bigmips"
2656 LITTLE_OUTPUT_FORMAT="elf32-littlemips"
2657diff -rNU3 dist.orig/ld/emulparams/elf64alpha_nbsd.sh dist.nbsd/ld/emulparams/elf64alpha_nbsd.sh
2658--- dist.orig/ld/emulparams/elf64alpha_nbsd.sh	Mon Dec 17 23:54:58 2001
2659+++ dist.nbsd/ld/emulparams/elf64alpha_nbsd.sh	Wed Feb 19 16:39:31 2014
2660@@ -1,2 +1,8 @@
2661 . ${srcdir}/emulparams/elf64alpha.sh
2662 ENTRY=__start
2663+
2664+NOP=0x47ff041f
2665+# XXX binutils 2.13
2666+# Note that the number is always big-endian, thus we have to
2667+# reverse the digit string.
2668+#NOP=0x0000fe2f1f04ff47		# unop; nop
2669diff -rNU3 dist.orig/ld/emulparams/elf_i386.sh dist.nbsd/ld/emulparams/elf_i386.sh
2670--- dist.orig/ld/emulparams/elf_i386.sh	Mon Jun 11 13:23:50 2012
2671+++ dist.nbsd/ld/emulparams/elf_i386.sh	Wed Feb 19 16:39:31 2014
2672@@ -9,7 +9,14 @@
2673 MACHINE=
2674 TEMPLATE_NAME=elf32
2675 GENERATE_SHLIB_SCRIPT=yes
2676+#ELFSIZE=32
2677 GENERATE_PIE_SCRIPT=yes
2678 NO_SMALL_DATA=yes
2679 SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 12 ? 12 : 0"
2680 IREL_IN_PLT=
2681+
2682+case "$target" in
2683+  x86_64-*-netbsd*)
2684+    LIB_PATH='=/usr/lib/i386'
2685+    ;;
2686+esac
2687diff -rNU3 dist.orig/ld/emulparams/hppalinux.sh dist.nbsd/ld/emulparams/hppalinux.sh
2688--- dist.orig/ld/emulparams/hppalinux.sh	Fri Feb 18 18:20:29 2011
2689+++ dist.nbsd/ld/emulparams/hppalinux.sh	Wed Feb 19 16:39:31 2014
2690@@ -1,5 +1,5 @@
2691 # If you change this file, please also look at files which source this one:
2692-# hppanbsd.sh
2693+# hppanbsd.sh hppaobsd.sh
2694
2695 SCRIPT_NAME=elf
2696 ELFSIZE=32
2697diff -rNU3 dist.orig/ld/emulparams/hppaobsd.sh dist.nbsd/ld/emulparams/hppaobsd.sh
2698--- dist.orig/ld/emulparams/hppaobsd.sh	Tue May 30 16:45:32 2006
2699+++ dist.nbsd/ld/emulparams/hppaobsd.sh	Wed Feb 19 16:39:31 2014
2700@@ -1,4 +1,4 @@
2701-. ${srcdir}/emulparams/hppanbsd.sh
2702+. ${srcdir}/emulparams/hppalinux.sh
2703
2704 OUTPUT_FORMAT="elf32-hppa"
2705 TEXT_START_ADDR=0x1000
2706diff -rNU3 dist.orig/ld/emulparams/m68kelf.sh dist.nbsd/ld/emulparams/m68kelf.sh
2707--- dist.orig/ld/emulparams/m68kelf.sh	Tue Sep 29 16:28:52 2009
2708+++ dist.nbsd/ld/emulparams/m68kelf.sh	Wed Feb 19 16:39:31 2014
2709@@ -10,5 +10,6 @@
2710 TEMPLATE_NAME=elf32
2711 EXTRA_EM_FILE=m68kelf
2712 GENERATE_SHLIB_SCRIPT=yes
2713+ELFSIZE=32
2714 GENERATE_PIE_SCRIPT=yes
2715 NO_SMALL_DATA=yes
2716diff -rNU3 dist.orig/ld/emulparams/m68kelfnbsd.sh dist.nbsd/ld/emulparams/m68kelfnbsd.sh
2717--- dist.orig/ld/emulparams/m68kelfnbsd.sh	Tue Dec 18 13:26:26 2001
2718+++ dist.nbsd/ld/emulparams/m68kelfnbsd.sh	Wed Feb 19 16:39:31 2014
2719@@ -1,4 +1,4 @@
2720 . ${srcdir}/emulparams/m68kelf.sh
2721 TEXT_START_ADDR=0x2000
2722 TARGET_PAGE_SIZE=0x2000
2723-MACHINE=
2724+NONPAGED_TEXT_START_ADDR=${TEXT_START_ADDR}
2725diff -rNU3 dist.orig/ld/emulparams/sh.sh dist.nbsd/ld/emulparams/sh.sh
2726--- dist.orig/ld/emulparams/sh.sh	Thu Nov 22 09:08:04 2001
2727+++ dist.nbsd/ld/emulparams/sh.sh	Wed Feb 19 16:39:31 2014
2728@@ -3,6 +3,6 @@
2729
2730 SCRIPT_NAME=sh
2731 OUTPUT_FORMAT="coff-sh"
2732-TEXT_START_ADDR=0x8000
2733-TARGET_PAGE_SIZE=128
2734+TEXT_START_ADDR=0x1000
2735+TARGET_PAGE_SIZE=0x1000
2736 ARCH=sh
2737diff -rNU3 dist.orig/ld/emulparams/shelf_nbsd.sh dist.nbsd/ld/emulparams/shelf_nbsd.sh
2738--- dist.orig/ld/emulparams/shelf_nbsd.sh	Tue Jan 15 23:05:46 2008
2739+++ dist.nbsd/ld/emulparams/shelf_nbsd.sh	Wed Feb 19 16:39:31 2014
2740@@ -9,7 +9,11 @@
2741
2742 DATA_START_SYMBOLS='PROVIDE (__data_start = .);';
2743
2744-ENTRY=_start
2745+ENTRY=__start
2746
2747 unset EMBEDDED
2748 unset OTHER_SECTIONS
2749+
2750+OTHER_READWRITE_SECTIONS='
2751+  .note.ABI-tag : { *(.note.ABI-tag) }
2752+'
2753diff -rNU3 dist.orig/ld/emultempl/elf32.em dist.nbsd/ld/emultempl/elf32.em
2754--- dist.orig/ld/emultempl/elf32.em	Mon Mar 25 08:06:23 2013
2755+++ dist.nbsd/ld/emultempl/elf32.em	Wed Feb 19 16:39:31 2014
2756@@ -72,6 +72,9 @@
2757
2758 if [ "x${USE_LIBPATH}" = xyes ] ; then
2759   case ${target} in
2760+    *-*-netbsd*)
2761+    ;;
2762+
2763     *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
2764   fragment <<EOF
2765 #ifdef HAVE_GLOB
2766@@ -103,6 +106,7 @@
2767 {
2768   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
2769   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
2770+  input_flags.add_DT_NEEDED_for_dynamic = TRUE;
2771   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
2772   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
2773 }
2774@@ -375,6 +379,9 @@
2775
2776 EOF
2777 case ${target} in
2778+    *-*-netbsd*)
2779+    ;;
2780+
2781   *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
2782     fragment <<EOF
2783 	  {
2784@@ -454,15 +461,25 @@
2785
2786 static bfd_boolean
2787 gld${EMULATION_NAME}_search_needed (const char *path,
2788-				    struct dt_needed *n, int force)
2789+				    struct dt_needed *n, int force, int prepend_sysroot)
2790 {
2791   const char *s;
2792   const char *name = n->name;
2793   size_t len;
2794   struct dt_needed needed;
2795
2796-  if (name[0] == '/')
2797+  if (name[0] == '/') {
2798+    if (prepend_sysroot && ld_sysroot) {
2799+      bfd_boolean rv;
2800+      needed.by = n->by;
2801+      char *filename= concat(ld_sysroot, n->name, (const char *)NULL);
2802+      needed.name = filename;
2803+      rv = gld${EMULATION_NAME}_try_needed (&needed, force);
2804+      free(filename);
2805+      return rv;
2806+    }
2807     return gld${EMULATION_NAME}_try_needed (n, force);
2808+  }
2809
2810   if (path == NULL || *path == '\0')
2811     return FALSE;
2812@@ -501,6 +518,13 @@
2813 	}
2814       strcpy (sset, name);
2815
2816+      if (prepend_sysroot && filename[0] == '=')
2817+        abort();
2818+      if (filename[0] == '/' && prepend_sysroot && ld_sysroot) {
2819+        char *filename2 = concat(ld_sysroot, filename, (const char *)NULL);
2820+        free(filename);
2821+        filename = filename2;
2822+      }
2823       needed.name = filename;
2824       if (gld${EMULATION_NAME}_try_needed (&needed, force))
2825 	return TRUE;
2826@@ -621,6 +645,9 @@
2827     # FreeBSD
2828     ;;
2829
2830+    *-*-netbsd*)
2831+    ;;
2832+
2833     *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
2834       fragment <<EOF
2835 /* For a native linker, check the file /etc/ld.so.conf for directories
2836@@ -1262,13 +1289,13 @@
2837 fragment <<EOF
2838
2839 	  if (gld${EMULATION_NAME}_search_needed (command_line.rpath_link,
2840-						  &n, force))
2841+						  &n, force, 0))
2842 	    break;
2843 EOF
2844 if [ "x${USE_LIBPATH}" = xyes ] ; then
2845 fragment <<EOF
2846 	  if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
2847-						  &n, force))
2848+						  &n, force, 1))
2849 	    break;
2850 EOF
2851 fi
2852@@ -1279,11 +1306,11 @@
2853 	    {
2854 	      lib_path = (const char *) getenv ("LD_RUN_PATH");
2855 	      if (gld${EMULATION_NAME}_search_needed (lib_path, &n,
2856-						      force))
2857+						      force, 0))
2858 		break;
2859 	    }
2860 	  lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
2861-	  if (gld${EMULATION_NAME}_search_needed (lib_path, &n, force))
2862+	  if (gld${EMULATION_NAME}_search_needed (lib_path, &n, force, 0))
2863 	    break;
2864 EOF
2865 fi
2866@@ -1293,12 +1320,10 @@
2867 	  rp = bfd_elf_get_runpath_list (link_info.output_bfd, &link_info);
2868 	  for (; !found && rp != NULL; rp = rp->next)
2869 	    {
2870-	      char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
2871 	      found = (rp->by == l->by
2872-		       && gld${EMULATION_NAME}_search_needed (tmpname,
2873+		       && gld${EMULATION_NAME}_search_needed (rp->name,
2874 							      &n,
2875-							      force));
2876-	      free (tmpname);
2877+							      force, 1));
2878 	    }
2879 	  if (found)
2880 	    break;
2881@@ -1315,6 +1340,9 @@
2882     # FreeBSD
2883     ;;
2884
2885+    *-*-netbsd*)
2886+    ;;
2887+
2888     *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
2889     # Linux
2890       fragment <<EOF
2891@@ -1515,7 +1543,8 @@
2892 	   a dep audit entry.  */
2893 	if (audit_libs && *audit_libs != '\0')
2894 	  {
2895-	    char *cp = xstrdup (audit_libs);
2896+	    char *cp, *fcp;
2897+	    fcp = cp = xstrdup (audit_libs);
2898 	    do
2899 	      {
2900 		int more = 0;
2901@@ -1533,6 +1562,7 @@
2902 		cp = more ? ++cp2 : NULL;
2903 	      }
2904 	    while (cp != NULL);
2905+	    free (fcp);
2906 	  }
2907       }
2908
2909diff -rNU3 dist.orig/ld/ldlex.h dist.nbsd/ld/ldlex.h
2910--- dist.orig/ld/ldlex.h	Mon Mar 25 08:06:23 2013
2911+++ dist.nbsd/ld/ldlex.h	Wed Feb 19 16:39:31 2014
2912@@ -136,6 +136,7 @@
2913 #endif /* ENABLE_PLUGINS */
2914   OPTION_DEFAULT_SCRIPT,
2915   OPTION_PRINT_OUTPUT_FORMAT,
2916+  OPTION_IGNORE_UNRESOLVED_SYMBOL
2917 };
2918
2919 /* The initial parser states.  */
2920diff -rNU3 dist.orig/ld/ldlex.l dist.nbsd/ld/ldlex.l
2921--- dist.orig/ld/ldlex.l	Tue Sep  4 14:14:15 2012
2922+++ dist.nbsd/ld/ldlex.l	Wed Feb 19 16:39:31 2014
2923@@ -60,10 +60,6 @@
2924 #undef YY_INPUT
2925 #define YY_INPUT(buf,result,max_size) result = yy_input (buf, max_size)
2926
2927-#ifndef YY_NO_UNPUT
2928-#define YY_NO_UNPUT
2929-#endif
2930-
2931 #define MAX_INCLUDE_DEPTH 10
2932 static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
2933 static const char *file_name_stack[MAX_INCLUDE_DEPTH];
2934@@ -93,6 +89,8 @@
2935 int yywrap (void) { return 1; }
2936 #endif
2937 %}
2938+
2939+%option nounput
2940
2941 %a 4000
2942 %o 5000
2943diff -rNU3 dist.orig/ld/ldmain.c dist.nbsd/ld/ldmain.c
2944--- dist.orig/ld/ldmain.c	Mon Mar 25 08:06:23 2013
2945+++ dist.nbsd/ld/ldmain.c	Wed Feb 19 16:39:31 2014
2946@@ -642,6 +642,23 @@
2947     einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
2948 }
2949
2950+void
2951+add_ignoresym (const char *name)
2952+{
2953+  if (link_info.ignore_hash == NULL)
2954+    {
2955+      link_info.ignore_hash = xmalloc (sizeof (struct bfd_hash_table));
2956+      if (! bfd_hash_table_init_n (link_info.ignore_hash,
2957+				   bfd_hash_newfunc,
2958+				   sizeof (struct bfd_hash_entry),
2959+				   61))
2960+	einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
2961+    }
2962+
2963+  if (bfd_hash_lookup (link_info.ignore_hash, name, TRUE, TRUE) == NULL)
2964+    einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
2965+}
2966+
2967 /* Record a symbol to be wrapped, from the --wrap option.  */
2968
2969 void
2970@@ -1239,24 +1256,25 @@
2971
2972 #define MAX_ERRORS_IN_A_ROW 5
2973
2974+  if (info->ignore_hash != NULL
2975+      && bfd_hash_lookup (info->ignore_hash, name, FALSE, FALSE) != NULL)
2976+    return TRUE;
2977+
2978   if (config.warn_once)
2979     {
2980-      static struct bfd_hash_table *hash;
2981-
2982       /* Only warn once about a particular undefined symbol.  */
2983-      if (hash == NULL)
2984+      if (info->ignore_hash == NULL)
2985 	{
2986-	  hash = (struct bfd_hash_table *)
2987-              xmalloc (sizeof (struct bfd_hash_table));
2988-	  if (!bfd_hash_table_init (hash, bfd_hash_newfunc,
2989+	  info->ignore_hash = xmalloc (sizeof (struct bfd_hash_table));
2990+	  if (!bfd_hash_table_init (info->ignore_hash, bfd_hash_newfunc,
2991 				    sizeof (struct bfd_hash_entry)))
2992 	    einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
2993 	}
2994
2995-      if (bfd_hash_lookup (hash, name, FALSE, FALSE) != NULL)
2996+      if (bfd_hash_lookup (info->ignore_hash, name, FALSE, FALSE) != NULL)
2997 	return TRUE;
2998
2999-      if (bfd_hash_lookup (hash, name, TRUE, TRUE) == NULL)
3000+      if (bfd_hash_lookup (info->ignore_hash, name, TRUE, TRUE) == NULL)
3001 	einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
3002     }
3003
3004diff -rNU3 dist.orig/ld/ldmain.h dist.nbsd/ld/ldmain.h
3005--- dist.orig/ld/ldmain.h	Fri Jul 13 13:20:26 2012
3006+++ dist.nbsd/ld/ldmain.h	Wed Feb 19 16:39:31 2014
3007@@ -41,6 +41,7 @@
3008
3009 extern void add_ysym (const char *);
3010 extern void add_wrap (const char *);
3011+extern void add_ignoresym (const char *);
3012 extern void add_keepsyms_file (const char *);
3013
3014 #endif
3015diff -rNU3 dist.orig/ld/lexsup.c dist.nbsd/ld/lexsup.c
3016--- dist.orig/ld/lexsup.c	Mon Mar 25 08:06:23 2013
3017+++ dist.nbsd/ld/lexsup.c	Wed Feb 19 16:39:31 2014
3018@@ -398,7 +398,7 @@
3019     ONE_DASH },
3020   { {"shared", no_argument, NULL, OPTION_SHARED},
3021     '\0', NULL, N_("Create a shared library"), ONE_DASH },
3022-  { {"Bshareable", no_argument, NULL, OPTION_SHARED }, /* FreeBSD.  */
3023+  { {"Bshareable", no_argument, NULL, OPTION_SHARED }, /* FreeBSD, NetBSD.  */
3024     '\0', NULL, NULL, ONE_DASH },
3025   { {"pie", no_argument, NULL, OPTION_PIE},
3026     '\0', NULL, N_("Create a position independent executable"), ONE_DASH },
3027@@ -496,8 +496,14 @@
3028   { {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE},
3029     '\0', NULL, N_("Include all objects from following archives"),
3030     TWO_DASHES },
3031+  { {"Bforcearchive", no_argument, NULL, OPTION_WHOLE_ARCHIVE},
3032+      '\0', NULL, NULL, TWO_DASHES },	/* NetBSD.  */
3033   { {"wrap", required_argument, NULL, OPTION_WRAP},
3034     '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
3035+  { {"ignore-unresolved-symbol", required_argument, NULL,
3036+    OPTION_IGNORE_UNRESOLVED_SYMBOL},
3037+    '\0', N_("SYMBOL"),
3038+    N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES },
3039 };
3040
3041 #define OPTION_COUNT ARRAY_SIZE (ld_options)
3042@@ -1343,6 +1349,9 @@
3043 	  break;
3044 	case OPTION_WRAP:
3045 	  add_wrap (optarg);
3046+	  break;
3047+	case OPTION_IGNORE_UNRESOLVED_SYMBOL:
3048+	  add_ignoresym (optarg);
3049 	  break;
3050 	case OPTION_DISCARD_NONE:
3051 	  link_info.discard = discard_none;
3052diff -rNU3 dist.orig/ld/scripttempl/elf.sc dist.nbsd/ld/scripttempl/elf.sc
3053--- dist.orig/ld/scripttempl/elf.sc	Mon Mar 25 08:06:23 2013
3054+++ dist.nbsd/ld/scripttempl/elf.sc	Wed Feb 19 16:39:31 2014
3055@@ -94,6 +94,8 @@
3056 #
3057 #  Each of these can also have corresponding .rel.* and .rela.* sections.
3058
3059+test -z "$TEXT_START_SYMBOLS" && TEXT_START_SYMBOLS="PROVIDE_HIDDEN (__eprol = .);"
3060+test -z "$ENTRY" && ENTRY=_start
3061 if test -n "$NOP"; then
3062   FILL="=$NOP"
3063 else
3064diff -rNU3 dist.orig/ld/scripttempl/sh.sc dist.nbsd/ld/scripttempl/sh.sc
3065--- dist.orig/ld/scripttempl/sh.sc	Wed Sep 25 17:06:09 2002
3066+++ dist.nbsd/ld/scripttempl/sh.sc	Wed Feb 19 16:39:31 2014
3067@@ -6,17 +6,14 @@
3068     ___dtors = . ;
3069     *(.dtors)
3070     ___dtors_end = . ;
3071-  } > ram"
3072+  }"
3073
3074+
3075 cat <<EOF
3076 OUTPUT_FORMAT("${OUTPUT_FORMAT}")
3077 OUTPUT_ARCH(${ARCH})
3078+${LIB_SEARCH_DIRS}
3079
3080-MEMORY
3081-{
3082-  ram : o = 0x1000, l = 512k
3083-}
3084-
3085 SECTIONS
3086 {
3087   .text :
3088@@ -24,9 +21,9 @@
3089     *(.text)
3090     *(.strings)
3091     ${RELOCATING+ _etext = . ; }
3092-  } ${RELOCATING+ > ram}
3093+  }
3094   ${CONSTRUCTING+${TORS}}
3095-  .data :
3096+  .data  ${RELOCATING+ ALIGN(${TARGET_PAGE_SIZE})} :
3097   {
3098     *(.data)
3099     ${RELOCATING+*(.gcc_exc*)}
3100@@ -35,19 +32,19 @@
3101     ${RELOCATING+___EH_FRAME_END__ = . ;}
3102     ${RELOCATING+LONG(0);}
3103     ${RELOCATING+ _edata = . ; }
3104-  } ${RELOCATING+ > ram}
3105-  .bss :
3106+  }
3107+  .bss ${RELOCATING+ ALIGN(${TARGET_PAGE_SIZE})} :
3108   {
3109     ${RELOCATING+ _bss_start = . ; }
3110     *(.bss)
3111     *(COMMON)
3112     ${RELOCATING+ _end = . ;  }
3113-  } ${RELOCATING+ > ram}
3114-  .stack ${RELOCATING+ 0x30000 }  :
3115+  }
3116+  .stack :
3117   {
3118     ${RELOCATING+ _stack = . ; }
3119     *(.stack)
3120-  } ${RELOCATING+ > ram}
3121+  }
3122   .stab 0 ${RELOCATING+(NOLOAD)} :
3123   {
3124     *(.stab)
3125diff -rNU3 dist.orig/libiberty/floatformat.c dist.nbsd/libiberty/floatformat.c
3126--- dist.orig/libiberty/floatformat.c	Mon Jan  3 21:05:58 2011
3127+++ dist.nbsd/libiberty/floatformat.c	Wed Feb 19 16:39:33 2014
3128@@ -489,7 +489,11 @@
3129       if (nan)
3130 	dto = NAN;
3131       else
3132+#ifdef __vax__
3133+	dto = HUGE_VAL;
3134+#else
3135 	dto = INFINITY;
3136+#endif
3137
3138       if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1))
3139 	dto = -dto;
3140diff -rNU3 dist.orig/libiberty/objalloc.c dist.nbsd/libiberty/objalloc.c
3141--- dist.orig/libiberty/objalloc.c	Fri Jul 22 03:26:05 2005
3142+++ dist.nbsd/libiberty/objalloc.c	Wed Feb 19 16:39:33 2014
3143@@ -1,5 +1,5 @@
3144 /* objalloc.c -- routines to allocate memory for objects
3145-   Copyright 1997 Free Software Foundation, Inc.
3146+   Copyright 1997-2012 Free Software Foundation, Inc.
3147    Written by Ian Lance Taylor, Cygnus Solutions.
3148
3149 This program is free software; you can redistribute it and/or modify it
3150@@ -112,14 +112,21 @@
3151 /* Allocate space from an objalloc structure.  */
3152
3153 PTR
3154-_objalloc_alloc (struct objalloc *o, unsigned long len)
3155+_objalloc_alloc (struct objalloc *o, unsigned long original_len)
3156 {
3157+  unsigned long len = original_len;
3158+
3159   /* We avoid confusion from zero sized objects by always allocating
3160      at least 1 byte.  */
3161   if (len == 0)
3162     len = 1;
3163
3164   len = (len + OBJALLOC_ALIGN - 1) &~ (OBJALLOC_ALIGN - 1);
3165+
3166+  /* Check for overflow in the alignment operation above and the
3167+     malloc argument below. */
3168+  if (len + CHUNK_HEADER_SIZE < original_len)
3169+    return NULL;
3170
3171   if (len <= o->current_space)
3172     {
3173diff -rNU3 dist.orig/libiberty/strerror.c dist.nbsd/libiberty/strerror.c
3174--- dist.orig/libiberty/strerror.c	Mon Mar 28 02:09:01 2005
3175+++ dist.nbsd/libiberty/strerror.c	Wed Feb 19 16:39:33 2014
3176@@ -347,7 +347,7 @@
3177   ENTRY(EPROTOTYPE, "EPROTOTYPE", "Protocol wrong type for socket"),
3178 #endif
3179 #if defined (ENOPROTOOPT)
3180-  ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol not available"),
3181+  ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol option not available"),
3182 #endif
3183 #if defined (EPROTONOSUPPORT)
3184   ENTRY(EPROTONOSUPPORT, "EPROTONOSUPPORT", "Protocol not supported"),
3185diff -rNU3 dist.orig/opcodes/cgen.sh dist.nbsd/opcodes/cgen.sh
3186--- dist.orig/opcodes/cgen.sh	Sun Jun 14 16:36:56 2009
3187+++ dist.nbsd/opcodes/cgen.sh	Wed Feb 19 16:39:30 2014
3188@@ -61,6 +61,7 @@
3189 shift ; extrafiles=$9
3190
3191 rootdir=${srcdir}/..
3192+move_if_change="${CONFIG_SHELL:-/bin/sh} ${rootdir}/move-if-change"
3193
3194 # $arch is $6, as passed on the command line.
3195 # $ARCH is the same argument but in all uppercase.
3196diff -rNU3 dist.orig/opcodes/configure dist.nbsd/opcodes/configure
3197--- dist.orig/opcodes/configure	Tue Sep  4 14:21:07 2012
3198+++ dist.nbsd/opcodes/configure	Wed Feb 19 16:39:30 2014
3199@@ -12551,6 +12551,14 @@
3200 	  # specified, as in sh3-elf, sh3b-linux-gnu, etc.
3201 	  # Include it just for ELF targets, since the SH5 bfd:s are ELF only.
3202 	  for t in $target $canon_targets; do
3203+	    # For NetBSD we do NOT want SH5 support unless sh5 or sh64
3204+	    # is specified
3205+	    case $t in
3206+	      sh5*-* | sh64*-*) # let the case below handle it
3207+				;;
3208+	      sh*-*-netbsd* | sh*l*-*-netbsd*)
3209+				continue ;;
3210+	      esac
3211 	    case $t in
3212 	      all |  sh5*-* | sh64*-* | sh-*-*elf* | shl*-*-*elf* | \
3213 	      sh-*-linux* | shl-*-linux*)
3214diff -rNU3 dist.orig/opcodes/configure.in dist.nbsd/opcodes/configure.in
3215--- dist.orig/opcodes/configure.in	Mon Nov  5 16:29:08 2012
3216+++ dist.nbsd/opcodes/configure.in	Wed Feb 19 16:39:30 2014
3217@@ -296,6 +296,14 @@
3218 	  # specified, as in sh3-elf, sh3b-linux-gnu, etc.
3219 	  # Include it just for ELF targets, since the SH5 bfd:s are ELF only.
3220 	  for t in $target $canon_targets; do
3221+	    # For NetBSD we do NOT want SH5 support unless sh5 or sh64
3222+	    # is specified
3223+	    case $t in
3224+	      sh5*-* | sh64*-*) # let the case below handle it
3225+				;;
3226+	      sh*-*-netbsd* | sh*l*-*-netbsd*)
3227+				continue ;;
3228+	      esac
3229 	    case $t in
3230 	      all |  sh5*-* | sh64*-* | sh-*-*elf* | shl*-*-*elf* | \
3231 	      sh-*-linux* | shl-*-linux*)
3232diff -rNU3 dist.orig/opcodes/mips-opc.c dist.nbsd/opcodes/mips-opc.c
3233--- dist.orig/opcodes/mips-opc.c	Tue Sep  4 14:21:10 2012
3234+++ dist.nbsd/opcodes/mips-opc.c	Wed Feb 19 16:39:30 2014
3235@@ -791,10 +791,12 @@
3236 {"hibernate","",        0x42000023, 0xffffffff,	0, 			0,		V1	},
3237 {"ins",     "t,r,+A,+B", 0x7c000004, 0xfc00003f, WR_t|RD_s,    		0,		I33	},
3238 {"iret",    "",		0x42000038, 0xffffffff,	NODS,			0,		MC	},
3239+{"jr",      "s",	0,        (int) M_JR_S, INSN_MACRO,		0,		I1	},
3240 {"jr",      "s",	0x00000008, 0xfc1fffff,	UBD|RD_s,		0,		I1	},
3241 /* jr.hb is officially MIPS{32,64}R2, but it works on R1 as jr with
3242    the same hazard barrier effect.  */
3243 {"jr.hb",   "s",	0x00000408, 0xfc1fffff,	UBD|RD_s,		0,		I32	},
3244+{"j",       "s",	0,         (int) M_J_S, INSN_MACRO,		0,		I1	},
3245 {"j",       "s",	0x00000008, 0xfc1fffff,	UBD|RD_s,		0,		I1	}, /* jr */
3246 /* SVR4 PIC code requires special handling for j, so it must be a
3247    macro.  */
3248@@ -803,7 +805,9 @@
3249    assembler, but will never match user input (because the line above
3250    will match first).  */
3251 {"j",       "a",	0x08000000, 0xfc000000,	UBD,			0,		I1	},
3252+{"jalr",    "s",	0,      (int) M_JALR_S, INSN_MACRO,             0,		I1	},
3253 {"jalr",    "s",	0x0000f809, 0xfc1fffff,	UBD|RD_s|WR_d,		0,		I1	},
3254+{"jalr",    "d,s",	0,     (int) M_JALR_DS, INSN_MACRO,		0,		I1	},
3255 {"jalr",    "d,s",	0x00000009, 0xfc1f07ff,	UBD|RD_s|WR_d,		0,		I1	},
3256 /* jalr.hb is officially MIPS{32,64}R2, but it works on R1 as jalr
3257    with the same hazard barrier effect.  */
3258