Lines Matching full:elfcpp
29 #include "elfcpp.h"
78 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
429 typedef typename elfcpp::Elf_types<size>::Elf_Addr Valtype;
471 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
501 if ((shndx == elfcpp::SHN_UNDEF)
503 && shndx != elfcpp::SHN_UNDEF
546 typedef typename elfcpp::Swap<size, big_endian>::Valtype Valtype;
551 case elfcpp::R_AARCH64_TLS_DTPREL64:
554 case elfcpp::R_AARCH64_TLS_TPREL64:
560 elfcpp::Swap<size, big_endian>::writeval(wv, x);
812 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
933 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
1107 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
1114 elfcpp::Swap<32, big_endian>::writeval(ip, this->erratum_insn());
1116 elfcpp::Swap<32, big_endian>::writeval(ip + i, insns[i]);
1127 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
1296 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
1301 elfcpp::Swap<32, big_endian>::writeval(ip + i, insns[i]);
1316 case elfcpp::R_AARCH64_CALL26:
1317 case elfcpp::R_AARCH64_JUMP26:
1346 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
1625 elfcpp::Swap<32, big_endian>::writeval(
1714 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
1723 const typename elfcpp::Ehdr<size, big_endian>& ehdr)
1750 const elfcpp::Shdr<size, big_endian>&,
1761 text_section_is_scannable(const elfcpp::Shdr<size, big_endian>&, unsigned int,
1834 section_needs_reloc_stub_scanning(const elfcpp::Shdr<size, big_endian>&,
1866 elfcpp::Shdr<size, big_endian>
1868 gold_assert(symtabshdr.get_sh_type() == elfcpp::SHT_SYMTAB);
1871 const int sym_size =elfcpp::Elf_sizes<size>::sym_size;
1885 elfcpp::Shdr<size, big_endian>
1887 if (strtabshdr.get_sh_type() != elfcpp::SHT_STRTAB)
1905 elfcpp::Sym<size, big_endian> sym(psyms);
1942 typedef typename elfcpp::Swap<32,big_endian>::Valtype Insntype;
2002 typedef typename elfcpp::Swap<32,big_endian>::Valtype Insntype;
2031 elfcpp::Swap<32, big_endian>::writeval(adrp_view, adr_insn);
2079 relinfo.reloc_shndx = elfcpp::SHN_UNDEF;
2082 relinfo.data_shdr = pshdrs + i * elfcpp::Elf_sizes<size>::shdr_size;
2108 const elfcpp::Shdr<size, big_endian>& text_shdr,
2116 || (text_shdr.get_sh_flags() & elfcpp::SHF_ALLOC) == 0
2117 || text_shdr.get_sh_type() != elfcpp::SHT_PROGBITS)
2141 const elfcpp::Shdr<size, big_endian>& shdr,
2147 if (sh_type != elfcpp::SHT_RELA)
2160 gold_assert(sh_type == elfcpp::SHT_RELA);
2161 unsigned int reloc_size = elfcpp::Elf_sizes<size>::rela_size;
2174 const unsigned int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
2175 const elfcpp::Shdr<size, big_endian> text_shdr(pshdrs +
2187 unsigned int shndx, const elfcpp::Shdr<size, big_endian>& shdr,
2193 (elfcpp::SHF_ALLOC | elfcpp::SHF_EXECINSTR)) == 0
2194 || shdr.get_sh_type() != elfcpp::SHT_PROGBITS)
2263 const unsigned int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
2285 const elfcpp::Shdr<size, big_endian> shdr(p);
2323 gold_assert (sh_type == elfcpp::SHT_RELA);
2324 reloc_size = elfcpp::Elf_sizes<size>::rela_size;
2552 AArch64_output_section(const char* name, elfcpp::Elf_Word type,
2553 elfcpp::Elf_Xword flags)
2779 typedef Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian>
2782 typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
2802 rela_irelative_(NULL), copy_relocs_(elfcpp::R_AARCH64_COPY),
2855 typename elfcpp::Elf_types<size>::Elf_Addr view_address,
2882 typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
2885 typename elfcpp::Elf_types<size>::Elf_Addr view_address,
2896 gold_assert(r_type == elfcpp::R_AARCH64_TLSDESC);
2981 gold_assert(parameters->target().machine_code() == elfcpp::EM_AARCH64
3039 const elfcpp::Ehdr<size, big_endian>&);
3070 typename elfcpp::Elf_types<size>::Elf_Swxword,
3075 do_make_output_section(const char* name, elfcpp::Elf_Word type,
3076 elfcpp::Elf_Xword flags)
3093 const elfcpp::Rela<size, big_endian>& reloc, unsigned int r_type,
3094 const elfcpp::Sym<size, big_endian>& lsym,
3102 const elfcpp::Rela<size, big_endian>& reloc, unsigned int r_type,
3111 const elfcpp::Rela<size, big_endian>& ,
3113 const elfcpp::Sym<size, big_endian>&);
3121 const elfcpp::Rela<size, big_endian>& ,
3164 size_t relnum, const elfcpp::Rela<size, big_endian>&,
3167 unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr,
3175 const elfcpp::Rela<size, big_endian>&,
3179 typename elfcpp::Elf_types<size>::Elf_Addr);
3185 const elfcpp::Rela<size, big_endian>&,
3194 const elfcpp::Rela<size, big_endian>&,
3203 const elfcpp::Rela<size, big_endian>&,
3212 const elfcpp::Rela<size, big_endian>&,
3221 const elfcpp::Rela<size, big_endian>&,
3225 typename elfcpp::Elf_types<size>::Elf_Addr,
3226 typename elfcpp::Elf_types<size>::Elf_Addr);
3314 typename elfcpp::Swap<32,big_endian>::Valtype insn1,
3315 typename elfcpp::Swap<32,big_endian>::Valtype insn2,
3316 typename elfcpp::Swap<32,big_endian>::Valtype insn3);
3321 typename elfcpp::Swap<32,big_endian>::Valtype,
3322 typename elfcpp::Swap<32,big_endian>::Valtype);
3341 Symbol* sym, const elfcpp::Rela<size, big_endian>& reloc)
3398 Copy_relocs<elfcpp::SHT_RELA, size, big_endian> copy_relocs_;
3420 elfcpp::EM_AARCH64, // machine_code
3433 elfcpp::SHN_UNDEF, // small_common_shndx
3434 elfcpp::SHN_UNDEF, // large_common_shndx
3447 elfcpp::EM_AARCH64, // machine_code
3460 elfcpp::SHN_UNDEF, // small_common_shndx
3461 elfcpp::SHN_UNDEF, // large_common_shndx
3474 elfcpp::EM_AARCH64, // machine_code
3487 elfcpp::SHN_UNDEF, // small_common_shndx
3488 elfcpp::SHN_UNDEF, // large_common_shndx
3501 elfcpp::EM_AARCH64, // machine_code
3514 elfcpp::SHN_UNDEF, // small_common_shndx
3515 elfcpp::SHN_UNDEF, // large_common_shndx
3555 layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
3556 (elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE),
3570 0, 0, elfcpp::STT_OBJECT,
3571 elfcpp::STB_LOCAL,
3572 elfcpp::STV_HIDDEN, 0,
3577 layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
3578 (elfcpp::SHF_ALLOC
3579 | elfcpp::SHF_WRITE),
3591 layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
3592 (elfcpp::SHF_ALLOC
3593 | elfcpp::SHF_WRITE),
3601 layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
3602 (elfcpp::SHF_ALLOC
3603 | elfcpp::SHF_WRITE),
3629 layout->add_output_section_data(".rela.dyn", elfcpp::SHT_RELA,
3630 elfcpp::SHF_ALLOC, this->rela_dyn_,
3651 layout->add_output_section_data(".rela.dyn", elfcpp::SHT_RELA,
3652 elfcpp::SHF_ALLOC, this->rela_irelative_,
3671 off_t offset, const elfcpp::Ehdr<size, big_endian>& ehdr)
3676 if (et == elfcpp::ET_EXEC && input_file->just_symbols())
3679 elfcpp::ET_REL)
3686 else if (et == elfcpp::ET_DYN)
3713 typename elfcpp::Elf_types<size>::Elf_Swxword addend,
3744 case elfcpp::R_AARCH64_CALL26:
3745 case elfcpp::R_AARCH64_JUMP26:
3816 typename elfcpp::Elf_types<size>::Elf_WXword r_info = reloc.get_r_info();
3817 unsigned int r_sym = elfcpp::elf_r_sym<size>(r_info);
3818 unsigned int r_type = elfcpp::elf_r_type<size>(r_info);
3819 if (r_type != elfcpp::R_AARCH64_CALL26
3820 && r_type != elfcpp::R_AARCH64_JUMP26)
3827 typename elfcpp::Elf_types<size>::Elf_Swxword addend =
3849 && shndx != elfcpp::SHN_UNDEF
3903 typename elfcpp::Elf_types<size>::Elf_Addr value =
3911 if (gsym->type() == elfcpp::STT_TLS)
3913 else if (gsym->type() == elfcpp::STT_GNU_IFUNC)
3934 typename elfcpp::Elf_types<size>::Elf_Addr value =
3979 gold_assert(sh_type == elfcpp::SHT_RELA);
3980 this->scan_reloc_section_for_stubs<elfcpp::SHT_RELA>(
4005 typedef typename elfcpp::Swap<32,big_endian>::Valtype Insntype;
4013 Insntype insn = elfcpp::Swap<32,big_endian>::readval(ip + i);
4033 elfcpp::R_AARCH64_ADD_ABS_LO12_NC);
4044 elfcpp::Swap<64,big_endian>::writeval(view + 8, dest);
4052 elfcpp::Swap<64,big_endian>::writeval(view + 16, offset);
4071 typedef Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian>
4073 typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
4294 layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA,
4295 elfcpp::SHF_ALLOC, this->rel_,
4320 if (gsym->type() == elfcpp::STT_GNU_IFUNC
4377 elfcpp::R_AARCH64_IRELATIVE,
4390 if (gsym->type() == elfcpp::STT_GNU_IFUNC
4394 rela->add_symbolless_global_addend(gsym, elfcpp::R_AARCH64_IRELATIVE,
4400 this->rel_->add_global(gsym, elfcpp::R_AARCH64_JUMP_SLOT, this->got_plt_,
4415 layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA,
4416 elfcpp::SHF_ALLOC, this->tlsdesc_rel_,
4438 layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA,
4439 elfcpp::SHF_ALLOC, this->irelative_rel_,
4454 elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
4455 elfcpp::STV_HIDDEN, 0, false, true);
4459 elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL,
4460 elfcpp::STV_HIDDEN, 0, true, true);
4474 if (gsym->type() == elfcpp::STT_GNU_IFUNC
4516 typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
4720 elfcpp::Swap<32, big_endian>::writeval(
4726 elfcpp::Swap<32, big_endian>::writeval(
4757 elfcpp::Swap<32, big_endian>::writeval(
4763 elfcpp::Swap<32, big_endian>::writeval(
4861 elfcpp::Swap<32, big_endian>::writeval(
4867 elfcpp::Swap<32, big_endian>::writeval(
4898 typename elfcpp::Elf_types<size>::Elf_Addr plt_address = this->address();
4900 typename elfcpp::Elf_types<size>::Elf_Addr gotplt_address
4927 elfcpp::Swap<size, big_endian>::writeval(got_pov, plt_address);
4935 typename elfcpp::Elf_types<size>::Elf_Addr got_base =
4953 elfcpp::Elf_Xword dst_mask;
4992 typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
4997 typedef elfcpp::Rela<size, big_endian> The_rela;
4998 typedef typename elfcpp::Swap<size, big_endian>::Valtype AArch64_valtype;
5017 elfcpp::Elf_Xword doffset,
5018 elfcpp::Elf_Xword dst_mask)
5020 typedef typename elfcpp::Swap<valsize, big_endian>::Valtype Valtype;
5022 Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv);
5026 elfcpp::Swap<valsize, big_endian>::writeval(wv,
5040 elfcpp::Elf_Xword doffset1,
5041 elfcpp::Elf_Xword doffset2,
5042 elfcpp::Elf_Xword dst_mask)
5044 typedef typename elfcpp::Swap<valsize, big_endian>::Valtype Valtype;
5046 Valtype val = elfcpp::Swap<valsize, big_endian>::readval(wv);
5048 elfcpp::Swap<valsize, big_endian>::writeval(wv,
5059 elfcpp::Elf_Xword dst_mask = (0x3 << 29) | (0x7ffff << 5);
5078 typedef typename elfcpp::Swap<32, big_endian>::Valtype Valtype;
5080 Valtype val = elfcpp::Swap<32, big_endian>::readval(wv);
5082 const elfcpp::Elf_Xword doffset =
5084 const elfcpp::Elf_Xword dst_mask =
5095 elfcpp::Swap<32, big_endian>::writeval(wv,
5147 typedef typename elfcpp::Swap_unaligned<valsize, big_endian>::Valtype
5149 typename elfcpp::Elf_types<size>::Elf_Addr x =
5151 elfcpp::Swap_unaligned<valsize, big_endian>::writeval(view,
5169 typedef typename elfcpp::Swap_unaligned<valsize, big_endian>::Valtype
5172 elfcpp::Swap_unaligned<valsize, big_endian>::writeval(view,
5190 typedef typename elfcpp::Swap<valsize, big_endian>::Valtype Valtype;
5193 elfcpp::Swap<valsize, big_endian>::writeval(wv,static_cast<Valtype>(x));
5324 typedef typename elfcpp::Elf_types<size>::Elf_Swxword SignedW;
5380 typename elfcpp::Elf_types<size>::Elf_Swxword addend = rela.get_r_addend();
5392 unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
5398 typename elfcpp::Swap<size, big_endian>::Valtype branch_offset =
5596 gold_assert(r_type == elfcpp::R_AARCH64_TLSDESC);
5652 elfcpp::STT_TLS,
5653 elfcpp::STB_LOCAL,
5654 elfcpp::STV_HIDDEN, 0,
5698 rela_dyn->add_local(object, 0, elfcpp::R_AARCH64_TLS_DTPMOD64, got,
5722 case elfcpp::R_AARCH64_TLSGD_ADR_PAGE21:
5723 case elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC:
5724 case elfcpp::R_AARCH64_TLSDESC_LD_PREL19:
5725 case elfcpp::R_AARCH64_TLSDESC_ADR_PREL21:
5726 case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21:
5727 case elfcpp::R_AARCH64_TLSDESC_LD64_LO12:
5728 case elfcpp::R_AARCH64_TLSDESC_ADD_LO12:
5729 case elfcpp::R_AARCH64_TLSDESC_OFF_G1:
5730 case elfcpp::R_AARCH64_TLSDESC_OFF_G0_NC:
5731 case elfcpp::R_AARCH64_TLSDESC_LDR:
5732 case elfcpp::R_AARCH64_TLSDESC_ADD:
5733 case elfcpp::R_AARCH64_TLSDESC_CALL:
5742 case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21:
5743 case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC:
5744 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1:
5745 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
5746 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_HI12:
5747 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
5753 case elfcpp::R_AARCH64_TLSIE_MOVW_GOTTPREL_G1:
5754 case elfcpp::R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC:
5755 case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
5756 case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
5757 case elfcpp::R_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
5766 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G2:
5767 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1:
5768 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
5769 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0:
5770 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
5771 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12:
5772 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12:
5773 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
5792 case elfcpp::R_AARCH64_ADR_PREL_PG_HI21:
5793 case elfcpp::R_AARCH64_ADR_PREL_PG_HI21_NC:
5794 case elfcpp::R_AARCH64_ADD_ABS_LO12_NC:
5795 case elfcpp::R_AARCH64_ADR_GOT_PAGE:
5796 case elfcpp::R_AARCH64_LD64_GOT_LO12_NC:
5817 const elfcpp::Rela<size, big_endian>& ,
5819 const elfcpp::Sym<size, big_endian>&)
5839 const elfcpp::Rela<size, big_endian>& ,
5846 && (gsym->visibility() == elfcpp::STV_INTERNAL
5847 || gsym->visibility() == elfcpp::STV_PROTECTED
5848 || gsym->visibility() == elfcpp::STV_HIDDEN))
5872 gold_assert(r_type != elfcpp::R_AARCH64_NONE);
5877 case elfcpp::R_AARCH64_NONE:
5878 case elfcpp::R_AARCH64_COPY:
5879 case elfcpp::R_AARCH64_GLOB_DAT:
5880 case elfcpp::R_AARCH64_JUMP_SLOT:
5881 case elfcpp::R_AARCH64_RELATIVE:
5882 case elfcpp::R_AARCH64_TLS_DTPREL64:
5883 case elfcpp::R_AARCH64_TLS_DTPMOD64:
5884 case elfcpp::R_AARCH64_TLS_TPREL64:
5885 case elfcpp::R_AARCH64_TLSDESC:
5886 case elfcpp::R_AARCH64_IRELATIVE:
5887 case elfcpp::R_AARCH64_ABS32:
5888 case elfcpp::R_AARCH64_ABS64:
5941 const elfcpp::Rela<size, big_endian>& rela,
5943 const elfcpp::Sym<size, big_endian>& lsym,
5949 typedef Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian>
5953 unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
5956 bool is_ifunc = lsym.get_st_type() == elfcpp::STT_GNU_IFUNC;
5962 case elfcpp::R_AARCH64_ABS32:
5963 case elfcpp::R_AARCH64_ABS16:
5971 case elfcpp::R_AARCH64_ABS64:
5978 elfcpp::R_AARCH64_RELATIVE,
5987 case elfcpp::R_AARCH64_PREL64:
5988 case elfcpp::R_AARCH64_PREL32:
5989 case elfcpp::R_AARCH64_PREL16:
5992 case elfcpp::R_AARCH64_ADR_GOT_PAGE:
5993 case elfcpp::R_AARCH64_LD64_GOT_LO12_NC:
6006 elfcpp::R_AARCH64_RELATIVE,
6015 case elfcpp::R_AARCH64_LD_PREL_LO19: // 273
6016 case elfcpp::R_AARCH64_ADR_PREL_LO21: // 274
6017 case elfcpp::R_AARCH64_ADR_PREL_PG_HI21: // 275
6018 case elfcpp::R_AARCH64_ADR_PREL_PG_HI21_NC: // 276
6019 case elfcpp::R_AARCH64_ADD_ABS_LO12_NC: // 277
6020 case elfcpp::R_AARCH64_LDST8_ABS_LO12_NC: // 278
6021 case elfcpp::R_AARCH64_LDST16_ABS_LO12_NC: // 284
6022 case elfcpp::R_AARCH64_LDST32_ABS_LO12_NC: // 285
6023 case elfcpp::R_AARCH64_LDST64_ABS_LO12_NC: // 286
6024 case elfcpp::R_AARCH64_LDST128_ABS_LO12_NC: // 299
6030 case elfcpp::R_AARCH64_TSTBR14:
6031 case elfcpp::R_AARCH64_CONDBR19:
6032 case elfcpp::R_AARCH64_JUMP26:
6033 case elfcpp::R_AARCH64_CALL26:
6036 case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
6037 case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
6050 elfcpp::R_AARCH64_TLS_TPREL64);
6058 const elfcpp::Elf_Xword addend = rela.get_r_addend();
6060 got->add_static_reloc(got_offset, elfcpp::R_AARCH64_TLS_TPREL64,
6066 case elfcpp::R_AARCH64_TLSGD_ADR_PAGE21:
6067 case elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC:
6081 elfcpp::R_AARCH64_TLS_DTPMOD64);
6085 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G2:
6086 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1:
6087 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
6088 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0:
6089 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
6090 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12:
6091 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12:
6092 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
6102 case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21:
6103 case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC:
6117 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1:
6118 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
6119 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_HI12:
6120 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
6123 case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21:
6124 case elfcpp::R_AARCH64_TLSDESC_LD64_LO12:
6125 case elfcpp::R_AARCH64_TLSDESC_ADD_LO12:
6142 unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
6155 rt->add_target_specific(elfcpp::R_AARCH64_TLSDESC, arg,
6164 case elfcpp::R_AARCH64_TLSDESC_CALL:
6195 const elfcpp::Rela<size, big_endian>& rela,
6200 if (gsym->type() == elfcpp::STT_GNU_IFUNC
6204 typedef Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian>
6212 case elfcpp::R_AARCH64_ABS16:
6213 case elfcpp::R_AARCH64_ABS32:
6214 case elfcpp::R_AARCH64_ABS64:
6236 else if (r_type == elfcpp::R_AARCH64_ABS64
6237 && gsym->type() == elfcpp::STT_GNU_IFUNC
6248 unsigned int r_type = elfcpp::R_AARCH64_IRELATIVE;
6255 else if (r_type == elfcpp::R_AARCH64_ABS64
6260 elfcpp::R_AARCH64_RELATIVE,
6271 Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian>*
6281 case elfcpp::R_AARCH64_PREL16:
6282 case elfcpp
6283 case elfcpp::R_AARCH64_PREL64:
6291 case elfcpp::R_AARCH64_LD_PREL_LO19: // 273
6292 case elfcpp::R_AARCH64_ADR_PREL_LO21: // 274
6293 case elfcpp::R_AARCH64_ADR_PREL_PG_HI21: // 275
6294 case elfcpp::R_AARCH64_ADR_PREL_PG_HI21_NC: // 276
6295 case elfcpp::R_AARCH64_ADD_ABS_LO12_NC: // 277
6296 case elfcpp::R_AARCH64_LDST8_ABS_LO12_NC: // 278
6297 case elfcpp::R_AARCH64_LDST16_ABS_LO12_NC: // 284
6298 case elfcpp::R_AARCH64_LDST32_ABS_LO12_NC: // 285
6299 case elfcpp::R_AARCH64_LDST64_ABS_LO12_NC: // 286
6300 case elfcpp::R_AARCH64_LDST128_ABS_LO12_NC: // 299
6317 case elfcpp::R_AARCH64_ADR_GOT_PAGE:
6318 case elfcpp::R_AARCH64_LD64_GOT_LO12_NC:
6328 if (gsym->type() == elfcpp::STT_GNU_IFUNC)
6351 || (gsym->visibility() == elfcpp::STV_PROTECTED
6353 || (gsym->type() == elfcpp::STT_GNU_IFUNC
6356 rela_dyn, elfcpp::R_AARCH64_GLOB_DAT);
6363 if (gsym->type() != elfcpp::STT_GNU_IFUNC)
6377 gsym, elfcpp::R_AARCH64_RELATIVE,
6388 case elfcpp::R_AARCH64_TSTBR14:
6389 case elfcpp::R_AARCH64_CONDBR19:
6390 case elfcpp::R_AARCH64_JUMP26:
6391 case elfcpp::R_AARCH64_CALL26:
6406 case elfcpp::R_AARCH64_TLSGD_ADR_PAGE21:
6407 case elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC: // General dynamic
6424 elfcpp::R_AARCH64_TLS_DTPMOD64,
6425 elfcpp::R_AARCH64_TLS_DTPREL64);
6429 case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21:
6430 case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC: // Local dynamic
6444 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1:
6445 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
6446 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_HI12:
6447 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC: // Other local dynamic
6450 case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
6451 case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: // Initial executable
6467 elfcpp::R_AARCH64_TLS_TPREL64);
6474 const elfcpp::Elf_Xword addend = rela.get_r_addend();
6477 elfcpp::R_AARCH64_TLS_TPREL64, gsym);
6482 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G2:
6483 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1:
6484 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
6485 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0:
6486 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
6487 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12:
6488 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12:
6489 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC: // Local executable
6496 case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21:
6497 case elfcpp::R_AARCH64_TLSDESC_LD64_LO12:
6498 case elfcpp::R_AARCH64_TLSDESC_ADD_LO12: // TLS descriptor
6517 elfcpp::R_AARCH64_TLSDESC, 0);
6526 elfcpp::R_AARCH64_TLS_TPREL64);
6533 case elfcpp::R_AARCH64_TLSDESC_CALL:
6559 layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
6560 (elfcpp::SHF_ALLOC
6561 | elfcpp::SHF_EXECINSTR),
6631 if (sh_type == elfcpp::SHT_REL)
6639 elfcpp::SHT_RELA,
6672 if (sh_type == elfcpp::SHT_REL)
6678 gold::scan_relocs<size, big_endian, Target_aarch64, elfcpp::SHT_RELA, Scan>(
6737 odyn->add_section_plus_offset(elfcpp::DT_TLSDESC_PLT,
6739 odyn->add_section_plus_offset(elfcpp::DT_TLSDESC_GOT,
6769 elfcpp::PT_LOAD, // segment_type
6770 elfcpp::PF_W, // segment_flags_set
6771 elfcpp::PF(0), // segment_flags_clear
6774 elfcpp::STT_NOTYPE, // type
6775 elfcpp::STB_GLOBAL, // binding
6776 elfcpp::STV_HIDDEN, // visibility
6783 elfcpp::PT_LOAD, // segment_type
6784 elfcpp::PF_W, // segment_flags_set
6785 elfcpp::PF(0), // segment_flags_clear
6788 elfcpp::STT_NOTYPE, // type
6789 elfcpp::STB_GLOBAL, // binding
6790 elfcpp::STV_HIDDEN, // visibility
6813 const elfcpp::Rela<size, big_endian>& rela,
6818 typename elfcpp::Elf_types<size>::Elf_Addr address,
6851 unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
6859 const elfcpp::Elf_Xword addend = rela.get_r_addend();
6871 case elfcpp::R_AARCH64_MOVW_GOTOFF_G0:
6872 case elfcpp::R_AARCH64_MOVW_GOTOFF_G0_NC:
6873 case elfcpp::R_AARCH64_MOVW_GOTOFF_G1:
6874 case elfcpp::R_AARCH64_MOVW_GOTOFF_G1_NC:
6875 case elfcpp::R_AARCH64_MOVW_GOTOFF_G2:
6876 case elfcpp::R_AARCH64_MOVW_GOTOFF_G2_NC:
6877 case elfcpp::R_AARCH64_MOVW_GOTOFF_G3:
6878 case elfcpp::R_AARCH64_GOTREL64:
6879 case elfcpp::R_AARCH64_GOTREL32:
6880 case elfcpp::R_AARCH64_GOT_LD_PREL19:
6881 case elfcpp::R_AARCH64_LD64_GOTOFF_LO15:
6882 case elfcpp::R_AARCH64_ADR_GOT_PAGE:
6883 case elfcpp::R_AARCH64_LD64_GOT_LO12_NC:
6884 case elfcpp::R_AARCH64_LD64_GOTPAGE_LO15:
6892 unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
6905 typename elfcpp::Elf_types<size>::Elf_Addr value;
6908 case elfcpp::R_AARCH64_NONE:
6911 case elfcpp::R_AARCH64_ABS64:
6925 case elfcpp::R_AARCH64_ABS32:
6938 case elfcpp::R_AARCH64_ABS16:
6951 case elfcpp::R_AARCH64_PREL64:
6956 case elfcpp::R_AARCH64_PREL32:
6961 case elfcpp::R_AARCH64_PREL16:
6966 case elfcpp::R_AARCH64_LD_PREL_LO19:
6971 case elfcpp::R_AARCH64_ADR_PREL_LO21:
6976 case elfcpp::R_AARCH64_ADR_PREL_PG_HI21_NC:
6977 case elfcpp::R_AARCH64_ADR_PREL_PG_HI21:
6982 case elfcpp::R_AARCH64_LDST8_ABS_LO12_NC:
6983 case elfcpp::R_AARCH64_LDST16_ABS_LO12_NC:
6984 case elfcpp::R_AARCH64_LDST32_ABS_LO12_NC:
6985 case elfcpp::R_AARCH64_LDST64_ABS_LO12_NC:
6986 case elfcpp::R_AARCH64_LDST128_ABS_LO12_NC:
6987 case elfcpp::R_AARCH64_ADD_ABS_LO12_NC:
6992 case elfcpp::R_AARCH64_CALL26:
6996 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
6997 Insntype insn = elfcpp::Swap<32, big_endian>::readval(
7007 case elfcpp::R_AARCH64_JUMP26:
7013 case elfcpp::R_AARCH64_TSTBR14:
7014 case elfcpp::R_AARCH64_CONDBR19:
7019 case elfcpp::R_AARCH64_ADR_GOT_PAGE:
7025 case elfcpp::R_AARCH64_LD64_GOT_LO12_NC:
7032 case elfcpp::R_AARCH64_TLSGD_ADR_PAGE21:
7033 case elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC:
7034 case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21:
7035 case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC:
7036 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1:
7037 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
7038 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_HI12:
7039 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
7040 case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
7041 case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
7042 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G2:
7043 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1:
7044 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
7045 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0:
7046 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
7047 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12:
7048 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12:
7049 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
7050 case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21:
7051 case elfcpp::R_AARCH64_TLSDESC_LD64_LO12:
7052 case elfcpp::R_AARCH64_TLSDESC_ADD_LO12:
7053 case elfcpp::R_AARCH64_TLSDESC_CALL:
7059 case elfcpp::R_AARCH64_COPY:
7060 case elfcpp::R_AARCH64_GLOB_DAT:
7061 case elfcpp::R_AARCH64_JUMP_SLOT:
7062 case elfcpp::R_AARCH64_RELATIVE:
7063 case elfcpp::R_AARCH64_IRELATIVE:
7064 case elfcpp::R_AARCH64_TLS_DTPREL64:
7065 case elfcpp::R_AARCH64_TLS_DTPMOD64:
7066 case elfcpp::R_AARCH64_TLS_TPREL64:
7067 case elfcpp::R_AARCH64_TLSDESC:
7113 const elfcpp::Rela<size, big_endian>& rela,
7117 typename elfcpp::Elf_types<size>::Elf_Addr address)
7120 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
7123 const elfcpp::Elf_Xword addend = rela.get_r_addend();
7138 case elfcpp::R_AARCH64_TLSGD_ADR_PAGE21:
7139 case elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC: // Global-dynamic
7156 typename elfcpp::Elf_types<size>::Elf_Addr got_entry_address;
7165 unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
7175 case elfcpp::R_AARCH64_TLSGD_ADR_PAGE21:
7181 case elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC:
7196 case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21:
7197 case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC: // Local-dynamic
7214 typename elfcpp::Elf_types<size>::Elf_Addr got_entry_address;
7220 case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21:
7225 case elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC:
7236 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1:
7237 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
7238 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_HI12:
7239 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC: // Other local-dynamic
7253 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G1:
7258 case elfcpp::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
7259 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_HI12:
7260 case elfcpp::R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
7272 case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
7273 case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: // Initial-exec
7289 typename elfcpp::Elf_types<size>::Elf_Addr got_entry_address;
7298 unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
7307 case elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
7311 case elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
7321 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G2:
7322 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1:
7323 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
7324 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0:
7325 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
7326 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12:
7327 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12:
7328 case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
7341 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G2:
7342 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1:
7343 case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0:
7361 case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21:
7362 case elfcpp::R_AARCH64_TLSDESC_LD64_LO12:
7363 case elfcpp::R_AARCH64_TLSDESC_ADD_LO12:
7364 case elfcpp::R_AARCH64_TLSDESC_CALL:
7383 if (r_type != elfcpp::R_AARCH64_TLSDESC_CALL
7392 typename elfcpp::Elf_types<size>::Elf_Addr got_entry_address;
7402 unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
7425 case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21:
7430 case elfcpp::R_AARCH64_TLSDESC_LD64_LO12:
7431 case elfcpp::R_AARCH64_TLSDESC_ADD_LO12:
7435 case elfcpp::R_AARCH64_TLSDESC_CALL:
7459 const elfcpp::Rela<size, big_endian>& rela,
7465 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
7466 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
7469 Insntype insn1 = elfcpp::Swap<32, big_endian>::readval(ip);
7470 Insntype insn2 = elfcpp::Swap<32, big_endian>::readval(ip + 1);
7471 Insntype insn3 = elfcpp::Swap<32, big_endian>::readval(ip + 2);
7473 if (r_type == elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC)
7512 elfcpp::Swap<32, big_endian>::writeval(ip, insn1);
7513 elfcpp::Swap<32, big_endian>::writeval(ip + 1, insn2);
7514 elfcpp::Swap<32, big_endian>::writeval(ip + 2, insn3);
7520 const elfcpp::Elf_Xword addend = rela.get_r_addend();
7528 elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12);
7531 elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12);
7559 const elfcpp::Rela<size, big_endian>& rela,
7565 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
7566 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
7569 Insntype insn1 = elfcpp::Swap<32, big_endian>::readval(ip);
7570 Insntype insn2 = elfcpp::Swap<32, big_endian>::readval(ip + 1);
7571 Insntype insn3 = elfcpp::Swap<32, big_endian>::readval(ip + 2);
7573 if (r_type == elfcpp::R_AARCH64_TLSLD_ADD_LO12_NC)
7612 elfcpp::Swap<32, big_endian>::writeval(ip, insn1);
7613 elfcpp::Swap<32, big_endian>::writeval(ip + 1, insn2);
7614 elfcpp::Swap<32, big_endian>::writeval(ip + 2, insn3);
7620 const elfcpp::Elf_Xword addend = rela.get_r_addend();
7628 elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12);
7631 elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12);
7659 const elfcpp::Rela<size, big_endian>& rela,
7664 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
7665 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
7672 const elfcpp::Elf_Xword addend = rela.get_r_addend();
7684 Insntype insn = elfcpp::Swap<32, big_endian>::readval(ip);
7687 if (r_type == elfcpp::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21)
7693 else if (r_type == elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC)
7703 elfcpp::Swap<32, big_endian>::writeval(ip, newinsn);
7714 const elfcpp::Rela<size, big_endian>& rela,
7719 typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
7720 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
7739 const elfcpp::Elf_Xword addend = rela.get_r_addend();
7755 case elfcpp::R_AARCH64_TLSDESC_ADD_LO12:
7756 case elfcpp::R_AARCH64_TLSDESC_CALL:
7761 case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21:
7766 case elfcpp::R_AARCH64_TLSDESC_LD64_LO12:
7776 elfcpp::Swap<32, big_endian>::writeval(ip, newinsn);
7787 const elfcpp::Rela<size, big_endian>& rela,
7791 typename elfcpp::Elf_types<size>::Elf_Addr got_entry_address,
7792 typename elfcpp::Elf_types<size>::Elf_Addr address)
7794 typedef typename elfcpp::Swap<32, big_endian>::Valtype Insntype;
7810 const elfcpp::Elf_Xword addend = rela.get_r_addend();
7814 case elfcpp::R_AARCH64_TLSDESC_ADD_LO12:
7815 case elfcpp::R_AARCH64_TLSDESC_CALL:
7818 elfcpp::Swap<32, big_endian>::writeval(ip, newinsn);
7821 case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21:
7828 case elfcpp::R_AARCH64_TLSDESC_LD64_LO12:
7831 Insntype insn = elfcpp::Swap<32, big_endian>::readval(ip);
7833 elfcpp::Swap<32, big_endian>::writeval(ip, insn);
7837 elfcpp::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC);
7863 typename elfcpp::Elf_types<size>::Elf_Addr address,
7867 gold_assert(sh_type == elfcpp::SHT_RELA);
7869 gold::relocate_section<size, big_endian, Target_aarch64, elfcpp::SHT_RELA,
7916 gold_assert(sh_type == elfcpp::SHT_RELA);
7918 typedef gold::Default_scan_relocatable_relocs<elfcpp::SHT_RELA,
7921 gold::scan_relocatable_relocs<size, big_endian, elfcpp::SHT_RELA,
7946 typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
7949 typename elfcpp::Elf_types<size>::Elf_Addr view_address,
7954 gold_assert(sh_type == elfcpp::SHT_RELA);
7956 gold::relocate_relocs<size, big_endian, elfcpp::SHT_RELA>(
7976 typename elfcpp::Swap<32,big_endian>::Valtype insn1,
7977 typename elfcpp::Swap<32,big_endian>::Valtype insn2,
7978 typename elfcpp::Swap<32,big_endian>::Valtype insn3)
8006 typename elfcpp::Swap<32,big_endian>::Valtype insn1,
8007 typename elfcpp::Swap<32,big_endian>::Valtype insn2)
8251 : Target_selector(elfcpp::EM_AARCH64, 32, true,
8257 : Target_selector(elfcpp::EM_AARCH64, 32, false,
8263 : Target_selector(elfcpp::EM_AARCH64, 64, true,
8269 : Target_selector(elfcpp::EM_AARCH64, 64, false,