Subject: Re: The ELF ABI issue
To: None <port-arm@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-arm
Date: 03/25/2002 16:13:12
--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Mar 25, 2002 at 03:36:04PM -0800, Jason R Thorpe wrote:

 > 	* Mark our ELF objects/execuables as ELFOSABI_NETBSD, to distinguish
 > 	  it from the official ARM ABI.  This is the correct use of the
 > 	  EI_OSABI field in the ELF header.

The toolchain changes for this part are really easy.  Diff attached.

(Not yet tested -- I'll do that after I get back from the gym... by then,
the build I have going already will be done.)

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Description: elfarm-nbsd-patch
Content-Disposition: attachment; filename=foo

Index: Makefile.am
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/bfd/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- Makefile.am	2001/12/15 02:18:24	1.6
+++ Makefile.am	2002/03/26 00:10:01
@@ -178,6 +178,7 @@
 	elf32-arc.lo \
 	elfarm-oabi.lo \
 	elfarm-nabi.lo \
+	elfarm-nbsd.lo \
 	elf32-avr.lo \
 	elf32-cris.lo \
 	elf32-d10v.lo \
@@ -320,6 +321,7 @@
 	elf32-arc.c \
 	elfarm-oabi.c \
 	elfarm-nabi.c \
+	elfarm-nbsd.c \
 	elf32-avr.c \
 	elf32-cris.c \
 	elf32-d10v.c \
@@ -977,6 +979,10 @@
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-arm.h elf32-target.h
 elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
+  $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+  elf32-arm.h elf32-target.h
+elfarm-nbsd.lo: elfarm-nbsd.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
   $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-arm.h elf32-target.h
Index: Makefile.in
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/bfd/Makefile.in,v
retrieving revision 1.6
diff -u -r1.6 Makefile.in
--- Makefile.in	2001/12/15 02:18:24	1.6
+++ Makefile.in	2002/03/26 00:10:07
@@ -301,6 +301,7 @@
 	elf32-arc.lo \
 	elfarm-oabi.lo \
 	elfarm-nabi.lo \
+	elfarm-nbsd.lo \
 	elf32-avr.lo \
 	elf32-cris.lo \
 	elf32-d10v.lo \
@@ -444,6 +445,7 @@
 	elf32-arc.c \
 	elfarm-oabi.c \
 	elfarm-nabi.c \
+	elfarm-nbsd.c \
 	elf32-avr.c \
 	elf32-cris.c \
 	elf32-d10v.c \
@@ -1515,6 +1517,10 @@
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-arm.h elf32-target.h
 elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
+  $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
+  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
+  elf32-arm.h elf32-target.h
+elfarm-nbsd.lo: elfarm-nbsd.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
   $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
   elf32-arm.h elf32-target.h
Index: config.bfd
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/bfd/config.bfd,v
retrieving revision 1.11
diff -u -r1.11 config.bfd
--- config.bfd	2001/12/15 02:18:24	1.11
+++ config.bfd	2002/03/26 00:10:08
@@ -105,8 +105,8 @@
     ;;
 
   arm-*-netbsdelf*)
-    targ_defvec=bfd_elf32_littlearm_vec
-    targ_selvecs=armnetbsd_vec
+    targ_defvec=bfd_elf32_littlearm_nbsd_vec
+    targ_selvecs="bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec bfd_elf32_bigarm_nbsd_vec armnetbsd_vec"
     ;;
   arm-*-netbsd*)
     targ_defvec=armnetbsd_vec
Index: configure
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/bfd/configure,v
retrieving revision 1.14
diff -u -r1.14 configure
--- configure	2001/12/19 21:32:49	1.14
+++ configure	2002/03/26 00:10:15
@@ -5931,9 +5931,11 @@
     bfd_elf32_avr_vec)		tb="$tb elf32-avr.lo elf32.lo $elf" ;;
     bfd_elf32_littlearc_vec)	tb="$tb elf32-arc.lo elf32.lo $elf" ;;
     bfd_elf32_littlearm_vec)	tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
+    bfd_elf32_littlearm_nbsd_vec) tb="$tb elfarm-nbsd.lo elf32.lo $elf" ;;
     bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
     bfd_elf32_bigarc_vec)	tb="$tb elf32-arc.lo elf32.lo $elf" ;;
     bfd_elf32_bigarm_vec)	tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
+    bfd_elf32_bigarm_nbsd_vec)	tb="$tb elfarm-nbsd.lo elf32.lo $elf" ;;
     bfd_elf32_bigarm_oabi_vec)	tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
     bfd_elf32_big_generic_vec) 	tb="$tb elf32-gen.lo elf32.lo $elf" ;;
     bfd_elf32_bigmips_vec) 	tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
Index: configure.in
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/bfd/configure.in,v
retrieving revision 1.13
diff -u -r1.13 configure.in
--- configure.in	2002/02/26 18:38:38	1.13
+++ configure.in	2002/03/26 00:10:16
@@ -504,9 +504,11 @@
     bfd_elf32_avr_vec)		tb="$tb elf32-avr.lo elf32.lo $elf" ;;
     bfd_elf32_littlearc_vec)	tb="$tb elf32-arc.lo elf32.lo $elf" ;;
     bfd_elf32_littlearm_vec)	tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
+    bfd_elf32_littlearm_nbsd_vec) tb="$tb elfarm-nbsd.lo elf32.lo $elf" ;;
     bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
     bfd_elf32_bigarc_vec)	tb="$tb elf32-arc.lo elf32.lo $elf" ;;
     bfd_elf32_bigarm_vec)	tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
+    bfd_elf32_bigarm_nbsd_vec)	tb="$tb elfarm-nbsd.lo elf32.lo $elf" ;;
     bfd_elf32_bigarm_oabi_vec)	tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
     bfd_elf32_big_generic_vec) 	tb="$tb elf32-gen.lo elf32.lo $elf" ;;
     bfd_elf32_bigmips_vec) 	tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
Index: elfarm-nbsd.c
===================================================================
RCS file: elfarm-nbsd.c
diff -N elfarm-nbsd.c
--- /dev/null	Tue Mar 26 02:10:05 2002
+++ elfarm-nbsd.c	Tue Mar 26 02:10:17 2002
@@ -0,0 +1,677 @@
+/* 32-bit ELF support for ARM new abi option, NetBSD variant.
+   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include "elf/arm.h"
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+
+#ifndef NUM_ELEM
+#define NUM_ELEM(a)  (sizeof (a) / (sizeof (a)[0]))
+#endif
+
+#define USE_REL
+
+#define TARGET_LITTLE_SYM               bfd_elf32_littlearm_nbsd_vec
+#define TARGET_LITTLE_NAME              "elf32-littlearm-nbsd"
+#define TARGET_BIG_SYM                  bfd_elf32_bigarm_nbsd_vec
+#define TARGET_BIG_NAME                 "elf32-bigarm-nbsd"
+
+#define elf_info_to_howto               0
+#define elf_info_to_howto_rel           elf32_arm_info_to_howto
+
+#define ARM_ELF_ABI_VERSION		0
+#define ARM_ELF_OS_ABI_VERSION		ELFOSABI_NETBSD
+
+static reloc_howto_type * elf32_arm_reloc_type_lookup
+  PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
+
+/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g.
+   R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO
+   in that slot.  */
+
+static reloc_howto_type elf32_arm_howto_table[] =
+{
+  /* No relocation */
+  HOWTO (R_ARM_NONE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_NONE",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_PC24,		/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 24,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_PC24",		/* name */
+	 false,			/* partial_inplace */
+	 0x00ffffff,		/* src_mask */
+	 0x00ffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* 32 bit absolute */
+  HOWTO (R_ARM_ABS32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_ABS32",		/* name */
+	 false,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* standard 32bit pc-relative reloc */
+  HOWTO (R_ARM_REL32,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 32,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_REL32",		/* name */
+	 false,			/* partial_inplace */
+	 0xffffffff,		/* src_mask */
+	 0xffffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* 8 bit absolute */
+  HOWTO (R_ARM_PC13,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_PC13",		/* name */
+	 false,			/* partial_inplace */
+	 0x000000ff,		/* src_mask */
+	 0x000000ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+   /* 16 bit absolute */
+  HOWTO (R_ARM_ABS16,		/* type */
+	 0,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 16,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_ABS16",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* 12 bit absolute */
+  HOWTO (R_ARM_ABS12,		/* type */
+	 0,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 12,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_ABS12",		/* name */
+	 false,			/* partial_inplace */
+	 0x000008ff,		/* src_mask */
+	 0x000008ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_THM_ABS5,	/* type */
+	 6,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 5,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_THM_ABS5",	/* name */
+	 false,			/* partial_inplace */
+	 0x000007e0,		/* src_mask */
+	 0x000007e0,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* 8 bit absolute */
+  HOWTO (R_ARM_ABS8,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_bitfield,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_ABS8",		/* name */
+	 false,			/* partial_inplace */
+	 0x000000ff,		/* src_mask */
+	 0x000000ff,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_SBREL32,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_SBREL32",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_THM_PC22,	/* type */
+	 1,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 23,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_THM_PC22",	/* name */
+	 false,			/* partial_inplace */
+	 0x07ff07ff,		/* src_mask */
+	 0x07ff07ff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  HOWTO (R_ARM_THM_PC8,	        /* type */
+	 1,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_THM_PC8",	/* name */
+	 false,			/* partial_inplace */
+	 0x000000ff,		/* src_mask */
+	 0x000000ff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  HOWTO (R_ARM_AMP_VCALL9,	/* type */
+	 1,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_AMP_VCALL9",	/* name */
+	 false,			/* partial_inplace */
+	 0x000000ff,		/* src_mask */
+	 0x000000ff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  HOWTO (R_ARM_SWI24,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_SWI24",		/* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0x00000000,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_THM_SWI8,	/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_SWI8",		/* name */
+	 false,			/* partial_inplace */
+	 0x00000000,		/* src_mask */
+	 0x00000000,		/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* BLX instruction for the ARM.  */
+  HOWTO (R_ARM_XPC25,		/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 25,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_XPC25",		/* name */
+	 false,			/* partial_inplace */
+	 0x00ffffff,		/* src_mask */
+	 0x00ffffff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* BLX instruction for the Thumb.  */
+  HOWTO (R_ARM_THM_XPC22,	/* type */
+	 2,			/* rightshift */
+	 2,			/* size (0 = byte, 1 = short, 2 = long) */
+	 22,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_THM_XPC22",	/* name */
+	 false,			/* partial_inplace */
+	 0x07ff07ff,		/* src_mask */
+	 0x07ff07ff,		/* dst_mask */
+	 true),			/* pcrel_offset */
+
+  /* These next three relocs are not defined, but we need to fill the space.  */
+
+  HOWTO (R_ARM_NONE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_unknown_17",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_NONE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_unknown_18",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_NONE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_unknown_19",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  /* Relocs used in ARM Linux */
+
+  HOWTO (R_ARM_COPY,		/* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         32,                    /* bitsize */
+         false,                 /* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_bitfield,/* complain_on_overflow */
+         bfd_elf_generic_reloc, /* special_function */
+         "R_ARM_COPY",		/* name */
+         true,			/* partial_inplace */
+         0xffffffff,		/* src_mask */
+         0xffffffff,		/* dst_mask */
+         false),                /* pcrel_offset */
+
+  HOWTO (R_ARM_GLOB_DAT,	/* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         32,                    /* bitsize */
+         false,                 /* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_bitfield,/* complain_on_overflow */
+         bfd_elf_generic_reloc, /* special_function */
+         "R_ARM_GLOB_DAT",	/* name */
+         true,			/* partial_inplace */
+         0xffffffff,		/* src_mask */
+         0xffffffff,		/* dst_mask */
+         false),                /* pcrel_offset */
+
+  HOWTO (R_ARM_JUMP_SLOT,	/* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         32,                    /* bitsize */
+         false,                 /* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_bitfield,/* complain_on_overflow */
+         bfd_elf_generic_reloc, /* special_function */
+         "R_ARM_JUMP_SLOT",	/* name */
+         true,			/* partial_inplace */
+         0xffffffff,		/* src_mask */
+         0xffffffff,		/* dst_mask */
+         false),                /* pcrel_offset */
+
+  HOWTO (R_ARM_RELATIVE,	/* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         32,                    /* bitsize */
+         false,                 /* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_bitfield,/* complain_on_overflow */
+         bfd_elf_generic_reloc, /* special_function */
+         "R_ARM_RELATIVE",	/* name */
+         true,			/* partial_inplace */
+         0xffffffff,		/* src_mask */
+         0xffffffff,		/* dst_mask */
+         false),                /* pcrel_offset */
+
+  HOWTO (R_ARM_GOTOFF,		/* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         32,                    /* bitsize */
+         false,                 /* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_bitfield,/* complain_on_overflow */
+         bfd_elf_generic_reloc, /* special_function */
+         "R_ARM_GOTOFF",	/* name */
+         true,			/* partial_inplace */
+         0xffffffff,		/* src_mask */
+         0xffffffff,		/* dst_mask */
+         false),                /* pcrel_offset */
+
+  HOWTO (R_ARM_GOTPC,		/* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         32,                    /* bitsize */
+         true,			/* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_bitfield,/* complain_on_overflow */
+         bfd_elf_generic_reloc, /* special_function */
+         "R_ARM_GOTPC",		/* name */
+         true,			/* partial_inplace */
+         0xffffffff,		/* src_mask */
+         0xffffffff,		/* dst_mask */
+         true),			/* pcrel_offset */
+
+  HOWTO (R_ARM_GOT32,		/* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         32,                    /* bitsize */
+         false,			/* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_bitfield,/* complain_on_overflow */
+         bfd_elf_generic_reloc, /* special_function */
+         "R_ARM_GOT32",		/* name */
+         true,			/* partial_inplace */
+         0xffffffff,		/* src_mask */
+         0xffffffff,		/* dst_mask */
+         false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_PLT32,		/* type */
+         2,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         26,                    /* bitsize */
+         true,			/* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_bitfield,/* complain_on_overflow */
+         bfd_elf_generic_reloc, /* special_function */
+         "R_ARM_PLT32",		/* name */
+         true,			/* partial_inplace */
+         0x00ffffff,		/* src_mask */
+         0x00ffffff,		/* dst_mask */
+         true),			/* pcrel_offset */
+
+  /* End of relocs used in ARM Linux */
+
+  HOWTO (R_ARM_RREL32,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_RREL32",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_RABS32,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_RABS32",	/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_RPC24,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_RPC24",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+  HOWTO (R_ARM_RBASE,		/* type */
+	 0,			/* rightshift */
+	 0,			/* size (0 = byte, 1 = short, 2 = long) */
+	 0,			/* bitsize */
+	 false,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_dont,/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_RBASE",		/* name */
+	 false,			/* partial_inplace */
+	 0,			/* src_mask */
+	 0,			/* dst_mask */
+	 false),		/* pcrel_offset */
+
+};
+
+  /* GNU extension to record C++ vtable hierarchy */
+static reloc_howto_type elf32_arm_vtinherit_howto =
+  HOWTO (R_ARM_GNU_VTINHERIT, /* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         0,                     /* bitsize */
+         false,                 /* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_dont, /* complain_on_overflow */
+         NULL,                  /* special_function */
+         "R_ARM_GNU_VTINHERIT", /* name */
+         false,                 /* partial_inplace */
+         0,                     /* src_mask */
+         0,                     /* dst_mask */
+         false);                /* pcrel_offset */
+
+  /* GNU extension to record C++ vtable member usage */
+static reloc_howto_type elf32_arm_vtentry_howto =
+  HOWTO (R_ARM_GNU_VTENTRY,     /* type */
+         0,                     /* rightshift */
+         2,                     /* size (0 = byte, 1 = short, 2 = long) */
+         0,                     /* bitsize */
+         false,                 /* pc_relative */
+         0,                     /* bitpos */
+         complain_overflow_dont, /* complain_on_overflow */
+         _bfd_elf_rel_vtable_reloc_fn,  /* special_function */
+         "R_ARM_GNU_VTENTRY",   /* name */
+         false,                 /* partial_inplace */
+         0,                     /* src_mask */
+         0,                     /* dst_mask */
+         false);                /* pcrel_offset */
+
+  /* 12 bit pc relative */
+static reloc_howto_type elf32_arm_thm_pc11_howto =
+  HOWTO (R_ARM_THM_PC11,	/* type */
+	 1,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 11,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_THM_PC11",	/* name */
+	 false,			/* partial_inplace */
+	 0x000007ff,		/* src_mask */
+	 0x000007ff,		/* dst_mask */
+	 true);			/* pcrel_offset */
+
+  /* 12 bit pc relative */
+static reloc_howto_type elf32_arm_thm_pc9_howto =
+  HOWTO (R_ARM_THM_PC9,		/* type */
+	 1,			/* rightshift */
+	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+	 8,			/* bitsize */
+	 true,			/* pc_relative */
+	 0,			/* bitpos */
+	 complain_overflow_signed,	/* complain_on_overflow */
+	 bfd_elf_generic_reloc,	/* special_function */
+	 "R_ARM_THM_PC9",	/* name */
+	 false,			/* partial_inplace */
+	 0x000000ff,		/* src_mask */
+	 0x000000ff,		/* dst_mask */
+	 true);			/* pcrel_offset */
+
+static void
+elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
+     bfd * abfd ATTRIBUTE_UNUSED;
+     arelent * bfd_reloc;
+     Elf32_Internal_Rel * elf_reloc;
+{
+  unsigned int r_type;
+
+  r_type = ELF32_R_TYPE (elf_reloc->r_info);
+
+  switch (r_type)
+    {
+    case R_ARM_GNU_VTINHERIT:
+      bfd_reloc->howto = & elf32_arm_vtinherit_howto;
+      break;
+
+    case R_ARM_GNU_VTENTRY:
+      bfd_reloc->howto = & elf32_arm_vtentry_howto;
+      break;
+
+    case R_ARM_THM_PC11:
+      bfd_reloc->howto = & elf32_arm_thm_pc11_howto;
+      break;
+
+    case R_ARM_THM_PC9:
+      bfd_reloc->howto = & elf32_arm_thm_pc9_howto;
+      break;
+
+    default:
+      if (r_type >= NUM_ELEM (elf32_arm_howto_table))
+	bfd_reloc->howto = NULL;
+      else
+        bfd_reloc->howto = & elf32_arm_howto_table[r_type];
+      break;
+    }
+}
+
+struct elf32_arm_reloc_map
+  {
+    bfd_reloc_code_real_type  bfd_reloc_val;
+    unsigned char             elf_reloc_val;
+  };
+
+static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
+{
+  {BFD_RELOC_NONE,                 R_ARM_NONE},
+  {BFD_RELOC_ARM_PCREL_BRANCH,     R_ARM_PC24},
+  {BFD_RELOC_ARM_PCREL_BLX,        R_ARM_XPC25},
+  {BFD_RELOC_THUMB_PCREL_BLX,      R_ARM_THM_XPC22},
+  {BFD_RELOC_32,                   R_ARM_ABS32},
+  {BFD_RELOC_32_PCREL,             R_ARM_REL32},
+  {BFD_RELOC_8,                    R_ARM_ABS8},
+  {BFD_RELOC_16,                   R_ARM_ABS16},
+  {BFD_RELOC_ARM_OFFSET_IMM,       R_ARM_ABS12},
+  {BFD_RELOC_ARM_THUMB_OFFSET,     R_ARM_THM_ABS5},
+  {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22},
+  {BFD_RELOC_ARM_COPY,             R_ARM_COPY},
+  {BFD_RELOC_ARM_GLOB_DAT,         R_ARM_GLOB_DAT},
+  {BFD_RELOC_ARM_JUMP_SLOT,        R_ARM_JUMP_SLOT},
+  {BFD_RELOC_ARM_RELATIVE,         R_ARM_RELATIVE},
+  {BFD_RELOC_ARM_GOTOFF,           R_ARM_GOTOFF},
+  {BFD_RELOC_ARM_GOTPC,            R_ARM_GOTPC},
+  {BFD_RELOC_ARM_GOT32,            R_ARM_GOT32},
+  {BFD_RELOC_ARM_PLT32,            R_ARM_PLT32}
+};
+
+static reloc_howto_type *
+elf32_arm_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int i;
+
+  switch (code)
+    {
+    case BFD_RELOC_VTABLE_INHERIT:
+      return & elf32_arm_vtinherit_howto;
+
+    case BFD_RELOC_VTABLE_ENTRY:
+      return & elf32_arm_vtentry_howto;
+
+    case BFD_RELOC_THUMB_PCREL_BRANCH12:
+      return & elf32_arm_thm_pc11_howto;
+
+    case BFD_RELOC_THUMB_PCREL_BRANCH9:
+      return & elf32_arm_thm_pc9_howto;
+
+    default:
+      for (i = 0; i < NUM_ELEM (elf32_arm_reloc_map); i ++)
+	if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
+	  return & elf32_arm_howto_table[elf32_arm_reloc_map[i].elf_reloc_val];
+
+      return NULL;
+   }
+}
+
+#include "elf32-arm.h"

--fUYQa+Pmc3FrFX/N--