elfarm-nabi.c

来自「基于4个mips核的noc设计」· C语言 代码 · 共 678 行 · 第 1/2 页

C
678
字号
/* 32-bit ELF support for ARM new abi option.   Copyright 1999, 2000, 2001 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_vec#define TARGET_LITTLE_NAME              "elf32-littlearm"#define TARGET_BIG_SYM                  bfd_elf32_bigarm_vec#define TARGET_BIG_NAME                 "elf32-bigarm"#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_ARMstatic 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 */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?