📄 700-nios2-2.15.patch
字号:
--- binutils-2.15/bfd/elf32-nios2.c 1970-01-01 01:00:00.000000000 +0100+++ binutils-2.15-nios2/bfd/elf32-nios2.c 2005-05-17 12:20:13.000000000 +0200@@ -0,0 +1,2188 @@+/* New Jersey-specific support for 32-bit ELF++ Copyright (C) 2003+ by Nigel Gray (ngray@altera.com).+++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. */++/* This file handles Altera New Jersey ELF targets */++#include "bfd.h"+#include "sysdep.h"+#include "libbfd.h"+#include "bfdlink.h"+#include "genlink.h"+#include "elf-bfd.h"+#include "elf/nios2.h"+#include "opcode/nios2.h"++/* use RELA relocations*/+#ifndef USE_RELA+#define USE_RELA+#endif++#ifdef USE_REL+#undef USE_REL+#endif++/* Function prototypes */++static reloc_howto_type *nios2_elf32_bfd_reloc_type_lookup+ (bfd *, bfd_reloc_code_real_type);++static bfd_boolean nios2_elf32_relax_section+ (bfd *, asection *, struct bfd_link_info *, bfd_boolean *);++static bfd_boolean nios2_elf32_relax_delete_bytes+ (bfd *, asection *, bfd_vma, int);++static reloc_howto_type *nios2_elf32_rtype_to_howto+ (unsigned int r_type, bfd_boolean rela_p);++static void nios2_elf32_info_to_howto+ (bfd * abfd, arelent * cache_ptr, Elf_Internal_Rela * dst);++static bfd_boolean nios2_elf32_relocate_section+ (bfd * output_bfd, struct bfd_link_info * info, bfd * input_bfd,+ asection * input_section, bfd_byte * contents,+ Elf_Internal_Rela * relocs, Elf_Internal_Sym * local_syms,+ asection ** local_sections);++static reloc_howto_type *lookup_howto (unsigned int rtype);++static bfd_reloc_status_type nios2_elf_final_gp+ (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *,+ struct bfd_link_info *);++static bfd_boolean nios2_elf_assign_gp+ (bfd *, bfd_vma *, struct bfd_link_info *);++static bfd_reloc_status_type nios2_elf32_ignore_reloc+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_hi16_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_lo16_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_hiadj16_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_pcrel16_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_call26_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_gprel_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_ujmp_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_cjmp_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_callr_relocate+ (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);++static bfd_reloc_status_type nios2_elf32_do_hi16_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);++static bfd_reloc_status_type nios2_elf32_do_lo16_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);++static bfd_reloc_status_type nios2_elf32_do_hiadj16_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);++static bfd_reloc_status_type nios2_elf32_do_pcrel16_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);++static bfd_reloc_status_type nios2_elf32_do_call26_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);++static bfd_reloc_status_type nios2_elf32_do_gprel_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);++static bfd_reloc_status_type nios2_elf32_do_ujmp_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);++static bfd_reloc_status_type nios2_elf32_do_cjmp_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);++static bfd_reloc_status_type nios2_elf32_do_callr_relocate+ (bfd *, reloc_howto_type *, asection *,+ bfd_byte *, bfd_vma, bfd_vma, bfd_vma);+++static void nios2_elf32_post_process_headers+ (bfd *, struct bfd_link_info *);++static bfd_boolean nios2_elf32_section_from_shdr+ (bfd *, Elf_Internal_Shdr *, const char *name);++static bfd_boolean nios2_elf32_section_flags+ (flagword *, Elf_Internal_Shdr *);++static bfd_boolean nios2_elf32_fake_sections+ (bfd *, Elf_Internal_Shdr *, asection *);++++static bfd_boolean nios2_elf32_check_relocs+ (bfd *, struct bfd_link_info *, asection *,+ const Elf_Internal_Rela *);++static asection *nios2_elf32_gc_mark_hook (asection * sec,+ struct bfd_link_info *+ info,+ Elf_Internal_Rela * rel,+ struct elf_link_hash_entry+ * h,+ Elf_Internal_Sym * sym);+++/* target vector */+extern const bfd_target bfd_elf32_littlenios2_vec;++/* The relocation table used for SHT_REL sections. */++static reloc_howto_type elf_nios2_howto_table_rel[] = {+ /* No relocation. */+ HOWTO (R_NIOS2_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_NIOS2_NONE", /* name */+ FALSE, /* partial_inplace */+ 0, /* src_mask */+ 0, /* dst_mask */+ FALSE), /* pcrel_offset */++ /* 16-bit signed immediate relocation */+ HOWTO (R_NIOS2_S16, /* type */+ 0, /* rightshift */+ 2, /* size (0 = byte, 1 = short, 2 = long) */+ 16, /* bitsize */+ FALSE, /* pc_relative */+ 6, /* bitpos */+ complain_overflow_signed, /* complain on overflow */+ bfd_elf_generic_reloc, /* special function */+ "R_NIOS2_S16", /* name */+ FALSE, /* partial_inplace */+ 0x003fffc0, /* src_mask */+ 0x003fffc0, /* dest_mask */+ FALSE), /* pcrel_offset */++ /* 16-bit unsigned immediate relocation */+ HOWTO (R_NIOS2_U16, /* type */+ 0, /* rightshift */+ 2, /* size (0 = byte, 1 = short, 2 = long) */+ 16, /* bitsize */+ FALSE, /* pc_relative */+ 6, /* bitpos */+ complain_overflow_unsigned, /* complain on overflow */+ bfd_elf_generic_reloc, /* special function */+ "R_NIOS2_U16", /* name */+ FALSE, /* partial_inplace */+ 0x003fffc0, /* src_mask */+ 0x003fffc0, /* dest_mask */+ FALSE), /* pcrel_offset */++ HOWTO (R_NIOS2_PCREL16, /* type */+ 0, /* rightshift */+ 2, /* size (0 = byte, 1 = short, 2 = long) */+ 16, /* bitsize */+ TRUE, /* pc_relative */+ 6, /* bitpos */+ complain_overflow_signed, /* complain on overflow */+ nios2_elf32_pcrel16_relocate, /* special function */+ "R_NIOS2_PCREL16", /* name */+ FALSE, /* partial_inplace */+ 0x003fffc0, /* src_mask */+ 0x003fffc0, /* dest_mask */+ TRUE), /* pcrel_offset */++ HOWTO (R_NIOS2_CALL26, /* type */+ 2, /* rightshift */+ 2, /* size (0 = byte, 1 = short, 2 = long) */+ 26, /* bitsize */+ FALSE, /* pc_relative */+ 6, /* bitpos */+ complain_overflow_dont, /* complain on overflow */+ nios2_elf32_call26_relocate, /* special function */+ "R_NIOS2_CALL26", /* name */+ FALSE, /* partial_inplace */+ 0xffffffc0, /* src_mask */+ 0xffffffc0, /* dst_mask */+ FALSE), /* pcrel_offset */++ HOWTO (R_NIOS2_IMM5,+ 0,+ 2,+ 5,+ FALSE,+ 6,+ complain_overflow_bitfield,+ bfd_elf_generic_reloc,+ "R_NIOS2_IMM5",+ FALSE,+ 0x000007c0,+ 0x000007c0,+ FALSE),++ HOWTO (R_NIOS2_CACHE_OPX,+ 0,+ 2,+ 5,+ FALSE,+ 22,+ complain_overflow_bitfield,+ bfd_elf_generic_reloc,+ "R_NIOS2_CACHE_OPX",+ FALSE,+ 0x07c00000,+ 0x07c00000,+ FALSE),++ HOWTO (R_NIOS2_IMM6,+ 0,+ 2,+ 6,+ FALSE,+ 6,+ complain_overflow_bitfield,+ bfd_elf_generic_reloc,+ "R_NIOS2_IMM6",+ FALSE,+ 0x00000fc0,+ 0x00000fc0,+ FALSE),++ HOWTO (R_NIOS2_IMM8,+ 0,+ 2,+ 8,+ FALSE,+ 6,+ complain_overflow_bitfield,+ bfd_elf_generic_reloc,+ "R_NIOS2_IMM8",+ FALSE,+ 0x00003fc0,+ 0x00003fc0,+ FALSE),++ HOWTO (R_NIOS2_HI16,+ 0,+ 2,+ 32,+ FALSE,+ 6,+ complain_overflow_dont,+ nios2_elf32_hi16_relocate,+ "R_NIOS2_HI16",+ FALSE,+ 0x003fffc0,+ 0x003fffc0,+ FALSE),++ HOWTO (R_NIOS2_LO16,+ 0,+ 2,+ 32,+ FALSE,+ 6,+ complain_overflow_dont,+ nios2_elf32_lo16_relocate,+ "R_NIOS2_LO16",+ FALSE,+ 0x003fffc0,+ 0x003fffc0,+ FALSE),++ HOWTO (R_NIOS2_HIADJ16,+ 0,+ 2,+ 32,+ FALSE,+ 6,+ complain_overflow_dont,+ nios2_elf32_hiadj16_relocate,+ "R_NIOS2_HIADJ16",+ FALSE,+ 0x003fffc0,+ 0x003fffc0,+ FALSE),++ HOWTO (R_NIOS2_BFD_RELOC_32,+ 0,+ 2, /* long */+ 32,+ FALSE,+ 0,+ complain_overflow_dont,+ bfd_elf_generic_reloc,+ "R_NIOS2_BFD_RELOC32",+ FALSE,+ 0xffffffff,+ 0xffffffff,+ FALSE),++ HOWTO (R_NIOS2_BFD_RELOC_16,+ 0,+ 1, /* short */+ 16,+ FALSE,+ 0,+ complain_overflow_bitfield,+ bfd_elf_generic_reloc,+ "R_NIOS2_BFD_RELOC16",+ FALSE,+ 0x0000ffff,+ 0x0000ffff,+ FALSE),++ HOWTO (R_NIOS2_BFD_RELOC_8,+ 0,+ 0, /* byte */+ 8,+ FALSE,+ 0,+ complain_overflow_bitfield,+ bfd_elf_generic_reloc,+ "R_NIOS2_BFD_RELOC8",+ FALSE,+ 0x000000ff,+ 0x000000ff,+ FALSE),++ HOWTO (R_NIOS2_GPREL,+ 0,+ 2,+ 32,+ FALSE,+ 6,+ complain_overflow_dont,+ nios2_elf32_gprel_relocate,+ "R_NIOS2_GPREL",+ FALSE,+ 0x003fffc0,+ 0x003fffc0,+ FALSE),++ HOWTO (R_NIOS2_GNU_VTINHERIT,+ 0,+ 2, /* short */+ 0,+ FALSE,+ 0,+ complain_overflow_dont,+ NULL,+ "R_NIOS2_GNU_VTINHERIT",+ FALSE,+ 0,+ 0,+ FALSE),++ HOWTO (R_NIOS2_GNU_VTENTRY,+ 0,+ 2, /* byte */+ 0,+ FALSE,+ 0,+ complain_overflow_dont,+ _bfd_elf_rel_vtable_reloc_fn,+ "R_NIOS2_GNU_VTENTRY",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -