elf64-sparc.c
来自「基于4个mips核的noc设计」· C语言 代码 · 共 2,055 行 · 第 1/5 页
C
2,055 行
/* SPARC-specific support for 64-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 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 modifyit under the terms of the GNU General Public License as published bythe 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include "bfd.h"#include "sysdep.h"#include "libbfd.h"#include "elf-bfd.h"#include "opcode/sparc.h"/* This is defined if one wants to build upward compatible binaries with the original sparc64-elf toolchain. The support is kept in for now but is turned off by default. dje 970930 *//*#define SPARC64_OLD_RELOCS*/#include "elf/sparc.h"/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */#define MINUS_ONE (~ (bfd_vma) 0)static struct bfd_link_hash_table * sparc64_elf_bfd_link_hash_table_create PARAMS((bfd *));static reloc_howto_type *sparc64_elf_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));static void sparc64_elf_info_to_howto PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));static void sparc64_elf_build_plt PARAMS((bfd *, unsigned char *, int));static bfd_vma sparc64_elf_plt_entry_offset PARAMS((int));static bfd_vma sparc64_elf_plt_ptr_offset PARAMS((int, int));static boolean sparc64_elf_check_relocs PARAMS((bfd *, struct bfd_link_info *, asection *sec, const Elf_Internal_Rela *));static boolean sparc64_elf_adjust_dynamic_symbol PARAMS((struct bfd_link_info *, struct elf_link_hash_entry *));static boolean sparc64_elf_size_dynamic_sections PARAMS((bfd *, struct bfd_link_info *));static int sparc64_elf_get_symbol_type PARAMS (( Elf_Internal_Sym *, int));static boolean sparc64_elf_add_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *));static void sparc64_elf_symbol_processing PARAMS ((bfd *, asymbol *));static boolean sparc64_elf_copy_private_bfd_data PARAMS ((bfd *, bfd *));static boolean sparc64_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *));static boolean sparc64_elf_relax_section PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));static boolean sparc64_elf_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));static boolean sparc64_elf_object_p PARAMS ((bfd *));static long sparc64_elf_get_reloc_upper_bound PARAMS ((bfd *, asection *));static long sparc64_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));static boolean sparc64_elf_slurp_one_reloc_table PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, asymbol **, boolean));static boolean sparc64_elf_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **, boolean));static long sparc64_elf_canonicalize_dynamic_reloc PARAMS ((bfd *, arelent **, asymbol **));static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR));/* The relocation "howto" table. */static bfd_reloc_status_type sparc_elf_notsup_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));static bfd_reloc_status_type sparc_elf_wdisp16_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));static bfd_reloc_status_type sparc_elf_hix22_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));static bfd_reloc_status_type sparc_elf_lox10_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));static reloc_howto_type sparc64_elf_howto_table[] ={ HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true), HOWTO(R_SPARC_8, 0,0, 8,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_8", false,0,0x000000ff,true), HOWTO(R_SPARC_16, 0,1,16,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_16", false,0,0x0000ffff,true), HOWTO(R_SPARC_32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", false,0,0xffffffff,true), HOWTO(R_SPARC_DISP8, 0,0, 8,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP8", false,0,0x000000ff,true), HOWTO(R_SPARC_DISP16, 0,1,16,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP16", false,0,0x0000ffff,true), HOWTO(R_SPARC_DISP32, 0,2,32,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", false,0,0x00ffffff,true), HOWTO(R_SPARC_WDISP30, 2,2,30,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP30", false,0,0x3fffffff,true), HOWTO(R_SPARC_WDISP22, 2,2,22,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP22", false,0,0x003fffff,true), HOWTO(R_SPARC_HI22, 10,2,22,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HI22", false,0,0x003fffff,true), HOWTO(R_SPARC_22, 0,2,22,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_22", false,0,0x003fffff,true), HOWTO(R_SPARC_13, 0,2,13,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_13", false,0,0x00001fff,true), HOWTO(R_SPARC_LO10, 0,2,10,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LO10", false,0,0x000003ff,true), HOWTO(R_SPARC_GOT10, 0,2,10,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT10", false,0,0x000003ff,true), HOWTO(R_SPARC_GOT13, 0,2,13,false,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_GOT13", false,0,0x00001fff,true), HOWTO(R_SPARC_GOT22, 10,2,22,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT22", false,0,0x003fffff,true), HOWTO(R_SPARC_PC10, 0,2,10,true, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC10", false,0,0x000003ff,true), HOWTO(R_SPARC_PC22, 10,2,22,true, 0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PC22", false,0,0x003fffff,true), HOWTO(R_SPARC_WPLT30, 2,2,30,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WPLT30", false,0,0x3fffffff,true), HOWTO(R_SPARC_COPY, 0,0,00,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_COPY", false,0,0x00000000,true), HOWTO(R_SPARC_GLOB_DAT, 0,0,00,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GLOB_DAT",false,0,0x00000000,true), HOWTO(R_SPARC_JMP_SLOT, 0,0,00,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_JMP_SLOT",false,0,0x00000000,true), HOWTO(R_SPARC_RELATIVE, 0,0,00,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_RELATIVE",false,0,0x00000000,true), HOWTO(R_SPARC_UA32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA32", false,0,0xffffffff,true),#ifndef SPARC64_OLD_RELOCS /* These aren't implemented yet. */ HOWTO(R_SPARC_PLT32, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PLT32", false,0,0x00000000,true), HOWTO(R_SPARC_HIPLT22, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_HIPLT22", false,0,0x00000000,true), HOWTO(R_SPARC_LOPLT10, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_LOPLT10", false,0,0x00000000,true), HOWTO(R_SPARC_PCPLT32, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT32", false,0,0x00000000,true), HOWTO(R_SPARC_PCPLT22, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT22", false,0,0x00000000,true), HOWTO(R_SPARC_PCPLT10, 0,0,00,false,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT10", false,0,0x00000000,true),#endif HOWTO(R_SPARC_10, 0,2,10,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_10", false,0,0x000003ff,true), HOWTO(R_SPARC_11, 0,2,11,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_11", false,0,0x000007ff,true), HOWTO(R_SPARC_64, 0,4,64,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_64", false,0,MINUS_ONE, true), HOWTO(R_SPARC_OLO10, 0,2,13,false,0,complain_overflow_signed, sparc_elf_notsup_reloc, "R_SPARC_OLO10", false,0,0x00001fff,true), HOWTO(R_SPARC_HH22, 42,2,22,false,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_HH22", false,0,0x003fffff,true), HOWTO(R_SPARC_HM10, 32,2,10,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HM10", false,0,0x000003ff,true), HOWTO(R_SPARC_LM22, 10,2,22,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LM22", false,0,0x003fffff,true), HOWTO(R_SPARC_PC_HH22, 42,2,22,true, 0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_PC_HH22", false,0,0x003fffff,true), HOWTO(R_SPARC_PC_HM10, 32,2,10,true, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC_HM10", false,0,0x000003ff,true), HOWTO(R_SPARC_PC_LM22, 10,2,22,true, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC_LM22", false,0,0x003fffff,true), HOWTO(R_SPARC_WDISP16, 2,2,16,true, 0,complain_overflow_signed, sparc_elf_wdisp16_reloc,"R_SPARC_WDISP16", false,0,0x00000000,true), HOWTO(R_SPARC_WDISP19, 2,2,19,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP19", false,0,0x0007ffff,true), HOWTO(R_SPARC_UNUSED_42, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_UNUSED_42",false,0,0x00000000,true), HOWTO(R_SPARC_7, 0,2, 7,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_7", false,0,0x0000007f,true), HOWTO(R_SPARC_5, 0,2, 5,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_5", false,0,0x0000001f,true), HOWTO(R_SPARC_6, 0,2, 6,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", false,0,0x0000003f,true), HOWTO(R_SPARC_DISP64, 0,4,64,true, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP64", false,0,MINUS_ONE, true), HOWTO(R_SPARC_PLT64, 0,4,64,false,0,complain_overflow_bitfield,sparc_elf_notsup_reloc, "R_SPARC_PLT64", false,0,MINUS_ONE, false), HOWTO(R_SPARC_HIX22, 0,4, 0,false,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_HIX22", false,0,MINUS_ONE, false), HOWTO(R_SPARC_LOX10, 0,4, 0,false,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_LOX10", false,0,MINUS_ONE, false), HOWTO(R_SPARC_H44, 22,2,22,false,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_H44", false,0,0x003fffff,false), HOWTO(R_SPARC_M44, 12,2,10,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_M44", false,0,0x000003ff,false), HOWTO(R_SPARC_L44, 0,2,13,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_L44", false,0,0x00000fff,false), HOWTO(R_SPARC_REGISTER, 0,4, 0,false,0,complain_overflow_bitfield,sparc_elf_notsup_reloc, "R_SPARC_REGISTER",false,0,MINUS_ONE, false), HOWTO(R_SPARC_UA64, 0,4,64,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA64", false,0,MINUS_ONE, true), HOWTO(R_SPARC_UA16, 0,1,16,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA16", false,0,0x0000ffff,true)};struct elf_reloc_map { bfd_reloc_code_real_type bfd_reloc_val; unsigned char elf_reloc_val;};static CONST struct elf_reloc_map sparc_reloc_map[] ={ { BFD_RELOC_NONE, R_SPARC_NONE, }, { BFD_RELOC_16, R_SPARC_16, }, { BFD_RELOC_8, R_SPARC_8 }, { BFD_RELOC_8_PCREL, R_SPARC_DISP8 }, { BFD_RELOC_CTOR, R_SPARC_64 }, { BFD_RELOC_32, R_SPARC_32 }, { BFD_RELOC_32_PCREL, R_SPARC_DISP32 }, { BFD_RELOC_HI22, R_SPARC_HI22 }, { BFD_RELOC_LO10, R_SPARC_LO10, }, { BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 }, { BFD_RELOC_SPARC22, R_SPARC_22 }, { BFD_RELOC_SPARC13, R_SPARC_13 }, { BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 }, { BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 }, { BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 }, { BFD_RELOC_SPARC_PC10, R_SPARC_PC10 }, { BFD_RELOC_SPARC_PC22, R_SPARC_PC22 }, { BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 }, { BFD_RELOC_SPARC_COPY, R_SPARC_COPY }, { BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT }, { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT }, { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE }, { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 }, { BFD_RELOC_SPARC_UA16, R_SPARC_UA16 }, { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, { BFD_RELOC_SPARC_UA64, R_SPARC_UA64 }, { BFD_RELOC_SPARC_10, R_SPARC_10 }, { BFD_RELOC_SPARC_11, R_SPARC_11 }, { BFD_RELOC_SPARC_64, R_SPARC_64 }, { BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10 }, { BFD_RELOC_SPARC_HH22, R_SPARC_HH22 }, { BFD_RELOC_SPARC_HM10, R_SPARC_HM10 }, { BFD_RELOC_SPARC_LM22, R_SPARC_LM22 }, { BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22 }, { BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10 }, { BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22 }, { BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16 }, { BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19 }, { BFD_RELOC_SPARC_7, R_SPARC_7 }, { BFD_RELOC_SPARC_5, R_SPARC_5 }, { BFD_RELOC_SPARC_6, R_SPARC_6 }, { BFD_RELOC_SPARC_DISP64, R_SPARC_DISP64 }, { BFD_RELOC_SPARC_PLT64, R_SPARC_PLT64 }, { BFD_RELOC_SPARC_HIX22, R_SPARC_HIX22 }, { BFD_RELOC_SPARC_LOX10, R_SPARC_LOX10 }, { BFD_RELOC_SPARC_H44, R_SPARC_H44 }, { BFD_RELOC_SPARC_M44, R_SPARC_M44 }, { BFD_RELOC_SPARC_L44, R_SPARC_L44 }, { BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER }};static reloc_howto_type *sparc64_elf_reloc_type_lookup (abfd, code) bfd *abfd ATTRIBUTE_UNUSED; bfd_reloc_code_real_type code;{ unsigned int i; for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map); i++) { if (sparc_reloc_map[i].bfd_reloc_val == code) return &sparc64_elf_howto_table[(int) sparc_reloc_map[i].elf_reloc_val]; } return 0;}static voidsparc64_elf_info_to_howto (abfd, cache_ptr, dst) bfd *abfd ATTRIBUTE_UNUSED; arelent *cache_ptr; Elf64_Internal_Rela *dst;{ BFD_ASSERT (ELF64_R_TYPE_ID (dst->r_info) < (unsigned int) R_SPARC_max_std); cache_ptr->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (dst->r_info)];}/* Due to the way how we handle R_SPARC_OLO10, each entry in a SHT_RELA section can represent up to two relocs, we must tell the user to allocate more space. */static longsparc64_elf_get_reloc_upper_bound (abfd, sec) bfd *abfd ATTRIBUTE_UNUSED; asection *sec;{ return (sec->reloc_count * 2 + 1) * sizeof (arelent *);}static longsparc64_elf_get_dynamic_reloc_upper_bound (abfd) bfd *abfd;{ return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 2;}/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of them. We cannot use generic elf routines for this, because R_SPARC_OLO10 has secondary addend in ELF64_R_TYPE_DATA. We handle it as two relocations for the same location, R_SPARC_LO10 and R_SPARC_13. */static booleansparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) bfd *abfd; asection *asect; Elf_Internal_Shdr *rel_hdr; asymbol **symbols; boolean dynamic;{ PTR allocated = NULL; bfd_byte *native_relocs; arelent *relent; unsigned int i; int entsize; bfd_size_type count; arelent *relents; allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size); if (allocated == NULL) goto error_return; if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0 || (bfd_read (allocated, 1, rel_hdr->sh_size, abfd) != rel_hdr->sh_size)) goto error_return; native_relocs = (bfd_byte *) allocated; relents = asect->relocation + asect->reloc_count; entsize = rel_hdr->sh_entsize; BFD_ASSERT (entsize == sizeof (Elf64_External_Rela)); count = rel_hdr->sh_size / entsize; for (i = 0, relent = relents; i < count; i++, relent++, native_relocs += entsize) { Elf_Internal_Rela rela; bfd_elf64_swap_reloca_in (abfd, (Elf64_External_Rela *) native_relocs, &rela); /* The address of an ELF reloc is section relative for an object file, and absolute for an executable file or shared library. The address of a normal BFD reloc is always section relative, and the address of a dynamic reloc is absolute.. */ if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic) relent->address = rela.r_offset; else relent->address = rela.r_offset - asect->vma; if (ELF64_R_SYM (rela.r_info) == 0) relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; else { asymbol **ps, *s; ps = symbols + ELF64_R_SYM (rela.r_info) - 1; s = *ps; /* Canonicalize ELF section symbols. FIXME: Why? */ if ((s->flags & BSF_SECTION_SYM) == 0) relent->sym_ptr_ptr = ps; else relent->sym_ptr_ptr = s->section->symbol_ptr_ptr; } relent->addend = rela.r_addend; BFD_ASSERT (ELF64_R_TYPE_ID (rela.r_info) < (unsigned int) R_SPARC_max_std); if (ELF64_R_TYPE_ID (rela.r_info) == R_SPARC_OLO10) { relent->howto = &sparc64_elf_howto_table[R_SPARC_LO10]; relent[1].address = relent->address; relent++; relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; relent->addend = ELF64_R_TYPE_DATA (rela.r_info); relent->howto = &sparc64_elf_howto_table[R_SPARC_13]; } else relent->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (rela.r_info)]; } asect->reloc_count += relent - relents; if (allocated != NULL) free (allocated); return true; error_return: if (allocated != NULL) free (allocated); return false;}/* Read in and swap the external relocs. */static booleansparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) bfd *abfd; asection *asect; asymbol **symbols; boolean dynamic;{ struct bfd_elf_section_data * const d = elf_section_data (asect); Elf_Internal_Shdr *rel_hdr; Elf_Internal_Shdr *rel_hdr2; if (asect->relocation != NULL) return true; if (! dynamic) { if ((asect->flags & SEC_RELOC) == 0 || asect->reloc_count == 0) return true; rel_hdr = &d->rel_hdr; rel_hdr2 = d->rel_hdr2; BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset)); } else { /* Note that ASECT->RELOC_COUNT tends not to be accurate in this case because relocations against this section may use the dynamic symbol table, and in that case bfd_section_from_shdr in elf.c does not update the RELOC_COUNT. */ if (asect->_raw_size == 0) return true; rel_hdr = &d->this_hdr; asect->reloc_count = NUM_SHDR_ENTRIES (rel_hdr); rel_hdr2 = NULL; } asect->relocation = ((arelent *) bfd_alloc (abfd, asect->reloc_count * 2 * sizeof (arelent))); if (asect->relocation == NULL) return false; /* The sparc64_elf_slurp_one_reloc_table routine increments reloc_count. */ asect->reloc_count = 0;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?