Subject: Re: binutils 2.8.1.0.19

From: Philip Blundell <[email-masked]>
Date: Fri, 16 Jan 1998 16:17:16 +0000

Philip Blundell writes:
>Pat Beirne sent me this small patch.  It is needed for BFD to generate
>working ELF code on the ARM.

That patch was no good (and my apologies to Pat, who wasn't actually the 
guilty author, contrary to what I wrote above).

I forgot that changing the reloc type has some other repercussions, and there 
were a few generated files that had apparently got missed somehow.

Here's another one.  With this I can generate apparently-working ELF files 
(as in ld doesn't dump core) though I haven't checked it out fully yet.  If 
somebody would like to give it a go and let me know what happens, I'd 
appreciate it.

I will try to make a new gcc patch against the 2.8.0 release this weekend, and 
see what needs to be done to make glibc support arm-elf.

p.

Index: gnu/binutils/bfd/ChangeLog.linux
diff -u gnu/binutils/bfd/ChangeLog.linux:1.4 gnu/binutils/bfd/ChangeLog.linux:1.5
--- gnu/binutils/bfd/ChangeLog.linux:1.4	Fri Jan 16 10:19:05 1998
+++ gnu/binutils/bfd/ChangeLog.linux	Fri Jan 16 15:55:55 1998
@@ -1,5 +1,8 @@
 Fri Jan 16 10:06:19 1998  Philip Blundell  <[email-masked]>
 
+	* bfd-in2.h: regenerated.
+	* libbfd.h: likewise.
+
 	* elf32-arm.c: Use REL relocs not RELA.
 
 Thu Dec 25 23:42:21 1997  Philip Blundell  <[email-masked]>
Index: gnu/binutils/bfd/bfd-in2.h
diff -u gnu/binutils/bfd/bfd-in2.h:1.2 gnu/binutils/bfd/bfd-in2.h:1.3
--- gnu/binutils/bfd/bfd-in2.h:1.2	Thu Dec 18 11:18:43 1997
+++ gnu/binutils/bfd/bfd-in2.h	Fri Jan 16 15:55:56 1998
@@ -1244,6 +1244,7 @@
   bfd_arch_arc,        /* Argonaut RISC Core */
 #define bfd_mach_arc_base 0
   bfd_arch_m32r,       /* Mitsubishi M32R/D */
+#define bfd_mach_m32r		0  /* backwards compatibility */
   bfd_arch_mn10200,    /* Matsushita MN10200 */
   bfd_arch_mn10300,    /* Matsushita MN10300 */
   bfd_arch_last
@@ -1828,6 +1829,10 @@
   BFD_RELOC_ARM_THUMB_IMM,
   BFD_RELOC_ARM_THUMB_SHIFT,
   BFD_RELOC_ARM_THUMB_OFFSET,
+  BFD_RELOC_ARM_GOTPC,
+  BFD_RELOC_ARM_GOT12,
+  BFD_RELOC_ARM_GOT32,
+  BFD_RELOC_ARM_JMPSLOT,
 
 /* Hitachi SH relocs.  Not all of these appear in object files. */
   BFD_RELOC_SH_PCDISP8BY2,
Index: gnu/binutils/bfd/elf32-arm.c
diff -u gnu/binutils/bfd/elf32-arm.c:1.1 gnu/binutils/bfd/elf32-arm.c:1.2
--- gnu/binutils/bfd/elf32-arm.c:1.1	Fri Jan 16 10:00:05 1998
+++ gnu/binutils/bfd/elf32-arm.c	Fri Jan 16 15:55:57 1998
@@ -23,7 +23,7 @@
 #include "libbfd.h"
 #include "elf-bfd.h"
 
-#define USE_RELA		/* we want RELA relocations, not REL */
+#define USE_REL			/* we want REL relocations, not RELA */
 
 /* ARM relocations */
 enum arm_reloc_type
@@ -170,11 +170,25 @@
      arelent *cache_ptr;
      Elf32_Internal_Rela *dst;
 {
-  if (!arm_elf_howto_table[ R_ARM_ADDR32 ])	/* Initialize howto table if needed */
+  abort();
+}
+
+static void
+arm_elf_info_to_howto_rel (abfd, cache_ptr, dst)
+     bfd *abfd;
+     arelent *cache_ptr;
+     Elf32_Internal_Rel *dst;
+{
+  enum arm_reloc_type type;
+
+  /* Initialize howto table if needed */
+  if (!arm_elf_howto_table[R_ARM_ADDR32])
     arm_elf_howto_init ();
 
-  BFD_ASSERT (ELF32_R_TYPE (dst->r_info) < (unsigned int) R_ARM_max);
-  cache_ptr->howto = arm_elf_howto_table[ELF32_R_TYPE (dst->r_info)];
+  type = (enum reloc_type) ELF32_R_TYPE (dst->r_info);
+  BFD_ASSERT (type < R_ARM_max);
+
+  cache_ptr->howto = arm_elf_howto_table[(int) type];
 }
 
 static reloc_howto_type *
@@ -190,14 +204,14 @@
 
   switch ((int)code)
     {
-    default:
-      return (reloc_howto_type *)NULL;
-
     case BFD_RELOC_NONE:		arm_reloc = R_ARM_NONE;			break;
     case BFD_RELOC_32:			arm_reloc = R_ARM_ADDR32;		break;
     case BFD_RELOC_16:			arm_reloc = R_ARM_ADDR16;		break;
     case BFD_RELOC_8:			arm_reloc = R_ARM_ADDR8;		break;
     case BFD_RELOC_ARM_PCREL_BRANCH:	arm_reloc = R_ARM_PCREL_BRANCH;		break;
+
+    default:
+      return (reloc_howto_type *)NULL;
     }
 
   return arm_elf_howto_table[ (int)arm_reloc ];
@@ -290,6 +304,7 @@
 #define ELF_ARCH		        bfd_arch_arm
 
 #define elf_info_to_howto		arm_elf_info_to_howto
+#define elf_info_to_howto_rel		arm_elf_info_to_howto_rel
 #define bfd_elf32_bfd_reloc_type_lookup	arm_elf_reloc_type_lookup
 
 #include "elf32-target.h"
Index: gnu/binutils/bfd/libbfd.h
diff -u gnu/binutils/bfd/libbfd.h:1.2 gnu/binutils/bfd/libbfd.h:1.3
--- gnu/binutils/bfd/libbfd.h:1.2	Thu Dec 18 11:18:59 1997
+++ gnu/binutils/bfd/libbfd.h	Fri Jan 16 15:55:58 1998
@@ -348,6 +348,11 @@
   PARAMS ((bfd *, asymbol **, asection *, bfd_vma, boolean *, const char **,
 	   const char **, unsigned int *, PTR *));
 
+/* Find the nearest line using DWARF 2 debugging information.  */
+extern boolean _bfd_dwarf2_find_nearest_line
+  PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
+	   const char **, unsigned int *));
+
 /* A routine to create entries for a bfd_link_hash_table.  */
 extern struct bfd_hash_entry *_bfd_link_hash_newfunc
   PARAMS ((struct bfd_hash_entry *entry,
@@ -728,6 +733,10 @@
   "BFD_RELOC_ARM_THUMB_IMM",
   "BFD_RELOC_ARM_THUMB_SHIFT",
   "BFD_RELOC_ARM_THUMB_OFFSET",
+  "BFD_RELOC_ARM_GOTPC",
+  "BFD_RELOC_ARM_GOT12",
+  "BFD_RELOC_ARM_GOT32",
+  "BFD_RELOC_ARM_JMPSLOT",
   "BFD_RELOC_SH_PCDISP8BY2",
   "BFD_RELOC_SH_PCDISP12BY2",
   "BFD_RELOC_SH_IMM4",

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]