Subject: binutils 2.8.1.0.4 patch

From: Philip Blundell <[email-masked]>
Date: Thu, 12 Jun 1997 12:14:40 +0100 (BST)

You need this patch to compile binutils 2.8.1.0.4 with arm-linuxaout
support.  It also makes '$' synonymous with '#' for introducing immediate
constants, which fell through the cracks when I merged my last patches
with HJ.

Hopefully this will be in the next binutils beta release.

p.

diff -u --recursive clean/binutils-2.8.1.0.4/bfd/ChangeLog.linux binutils-2.8.1.0.4/bfd/ChangeLog.linux
--- clean/binutils-2.8.1.0.4/bfd/ChangeLog.linux	Sat Jun  7 18:11:00 1997
+++ binutils-2.8.1.0.4/bfd/ChangeLog.linux	Thu Jun 12 02:53:42 1997
@@ -1,3 +1,7 @@
+Thu Jun 12 02:53:25 1997  Philip Blundell  <[email-masked]>
+
+	* bfd-in2.h: regenerated.
+
 Sat Jun  7 08:10:39 1997  H.J. Lu  ([email-masked])
 
 	* cpu-arm.c (compatible, scan):
@@ -11,10 +15,11 @@
 	From Russell King <[email-masked]>:
 	* armlinux.c: New file.
 	* config.bfd: add support for Linux/ARM.
-	* configure: regenerated.
 	* configure.in: likewise.
 	* targets.c: likewise.
 	* hosts/armlinux.h: New file.
+
+	* configure: regenerated.
 
 Fri Apr 11 22:24:12 1997  Geoff Keating  <[email-masked]>
 
diff -u --recursive clean/binutils-2.8.1.0.4/bfd/bfd-in2.h binutils-2.8.1.0.4/bfd/bfd-in2.h
--- clean/binutils-2.8.1.0.4/bfd/bfd-in2.h	Sat May 31 20:35:55 1997
+++ binutils-2.8.1.0.4/bfd/bfd-in2.h	Thu Jun 12 02:10:30 1997
@@ -1817,6 +1817,12 @@
   BFD_RELOC_SH_DATA,
   BFD_RELOC_SH_LABEL,
 
+/* Thumb 23-, 12- and 9-bit pc-relative branches.  The lowest bit must
+be zero and is not stored in the instruction. */
+  BFD_RELOC_THUMB_PCREL_BRANCH9,
+  BFD_RELOC_THUMB_PCREL_BRANCH12,
+  BFD_RELOC_THUMB_PCREL_BRANCH23,
+
 
 /* Mitsubishi D10V relocs.
 This is a 10-bit reloc with the right 2 bits
diff -u --recursive clean/binutils-2.8.1.0.4/bfd/libbfd.h binutils-2.8.1.0.4/bfd/libbfd.h
--- clean/binutils-2.8.1.0.4/bfd/libbfd.h	Wed Apr 30 17:56:13 1997
+++ binutils-2.8.1.0.4/bfd/libbfd.h	Thu Jun 12 02:10:31 1997
@@ -143,6 +143,9 @@
 bfd *	bfd_generic_openr_next_archived_file PARAMS ((bfd *archive,
 						     bfd *last_file));
 
+struct ar_hdr * bfd_special_undocumented_glue PARAMS ((bfd *,
+							const char *));
+
 int	bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
 
 #define _bfd_read_ar_hdr(abfd) \
@@ -740,6 +743,9 @@
   "BFD_RELOC_SH_CODE",
   "BFD_RELOC_SH_DATA",
   "BFD_RELOC_SH_LABEL",
+  "BFD_RELOC_THUMB_PCREL_BRANCH9",
+  "BFD_RELOC_THUMB_PCREL_BRANCH12",
+  "BFD_RELOC_THUMB_PCREL_BRANCH23",
 
   "BFD_RELOC_D10V_10_PCREL_R",
   "BFD_RELOC_D10V_10_PCREL_L",
diff -u --recursive clean/binutils-2.8.1.0.4/binutils/ChangeLog.linux binutils-2.8.1.0.4/binutils/ChangeLog.linux
--- clean/binutils-2.8.1.0.4/binutils/ChangeLog.linux	Thu Jun 12 02:55:34 1997
+++ binutils-2.8.1.0.4/binutils/ChangeLog.linux	Thu Jun 12 02:55:04 1997
@@ -0,0 +1,5 @@
+Thu Jun 12 02:54:18 1997  Philip Blundell  <[email-masked]>
+
+	* ar.c (bfd_special_undocumented_glue): keep in step with
+	libbfd.h.
+	
\ No newline at end of file
diff -u --recursive clean/binutils-2.8.1.0.4/binutils/ar.c binutils-2.8.1.0.4/binutils/ar.c
--- clean/binutils-2.8.1.0.4/binutils/ar.c	Wed Apr 30 17:59:03 1997
+++ binutils-2.8.1.0.4/binutils/ar.c	Thu Jun 12 02:14:23 1997
@@ -52,7 +52,7 @@
 /* Kludge declaration from BFD!  This is ugly!  FIXME!  XXX */
 
 struct ar_hdr *
-  bfd_special_undocumented_glue PARAMS ((bfd * abfd, char *filename));
+  bfd_special_undocumented_glue PARAMS ((bfd * abfd, const char *filename));
 
 /* Static declarations */
 
diff -u --recursive clean/binutils-2.8.1.0.4/gas/ChangeLog.linux binutils-2.8.1.0.4/gas/ChangeLog.linux
--- clean/binutils-2.8.1.0.4/gas/ChangeLog.linux	Sat Jun  7 18:11:01 1997
+++ binutils-2.8.1.0.4/gas/ChangeLog.linux	Thu Jun 12 02:52:01 1997
@@ -1,3 +1,7 @@
+Thu Jun 12 02:51:12 1997  Philip Blundell  <[email-masked]>
+
+	* config/tc-arm.c: make '$' a synonym for '#'.
+
 Sat Jun  7 08:10:39 1997  H.J. Lu  ([email-masked])
 
 	* config/tc-arm.c: add prototypes.
@@ -37,5 +41,6 @@
 	From Russell King <[email-masked]>:
 	* config/tc-arm.c: allow ';' to separate lines under Linux.
 	* config/tc-arm.h: add support for Linux/ARM.
-	* configure: regenerated.
 	* configure.in: likewise.
+
+	* configure: regenerated.
diff -u --recursive clean/binutils-2.8.1.0.4/gas/config/tc-arm.c binutils-2.8.1.0.4/gas/config/tc-arm.c
--- clean/binutils-2.8.1.0.4/gas/config/tc-arm.c	Sat Jun  7 18:11:02 1997
+++ binutils-2.8.1.0.4/gas/config/tc-arm.c	Thu Jun 12 02:48:17 1997
@@ -1482,7 +1482,7 @@
   while (**str == ' ')
     (*str)++;
 
-  if (**str != '#')
+  if (**str != '#' && **str != '$')
     {
       inst.error = "immediate expression expected";
       return FAIL;
@@ -1690,8 +1690,9 @@
       if ((reg = reg_required_here (&str, 0)) != FAIL)
 	;
       /* Immediate expression */
-      else if (*(str++) == '#')
+      else if (*str == '#' || *str == '$')
 	{
+	  str++;
 	  inst.error = NULL;
 	  if (my_get_expression (&inst.reloc.exp, &str))
 	    {
@@ -1720,6 +1721,7 @@
 	}
       else
 	{
+	  str++;
 	  inst.error = "Error: the other";
 	  return;
 	}
@@ -2089,7 +2091,7 @@
 	  *str = p;
 	  return SUCCESS;
 	}
-      else if (*p == '#')
+      else if (*p == '#' || *p == '$') 
 	{
 	  inst.error = NULL;
 	  p++;
@@ -2255,8 +2257,9 @@
   else
     {
       /* Immediate expression */
-      if (*((*str)++) == '#')
+      if (**str == '#' || **str == '$')
 	{
+	  (*str)++;
 	  inst.error = NULL;
 	  if (my_get_expression (&inst.reloc.exp, str))
 	    return FAIL;
@@ -2317,6 +2320,7 @@
 	  return SUCCESS;
 	}
 
+      (*str)++;
       inst.error = "Register or shift expression expected";
       return FAIL;
     }
@@ -2501,6 +2505,7 @@
   switch (**str)
     {
     case '#':
+    case '$':
       (*str)++;
       if (my_get_expression (&inst.reloc.exp, str))
 	return FAIL;
@@ -2967,7 +2972,7 @@
   /* Allow optional leading '#'.  */
   while (*str == ' ')
     str++;
-  if (*str == '#')
+  if (*str == '#' || *str == '$')
     str++;
 
   if (my_get_expression (&inst.reloc.exp, &str))
@@ -3710,7 +3715,7 @@
       return;
     }
 
-  if (*str == '#')
+  if (*str == '#' || *str == '$')
     {
       Rs = Rd;
       str++;
@@ -3729,7 +3734,7 @@
 	  Rn = Rs;
 	  Rs = Rd;
 	}
-      else if (*str == '#')
+      else if (*str == '#' || *str == '$')
 	{
 	  str++;
 	  if (my_get_expression (&inst.reloc.exp, &str))
@@ -3878,7 +3883,7 @@
       return;
     }
 
-  if (*str == '#')
+  if (*str == '#' || *str == '$')
     {
       /* Two operand immediate format, set Rs to Rd.  */
       Rs = Rd;