X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Faarch64.cc;h=07abe44931f34504a986bf30500f0a862b2a9570;hb=78f2c40a12179d26d3065c09f054b7e751b2732f;hp=ecb400b27439e2846008ef6ef2d324a80cf6935c;hpb=e82e6b2b19eb796fed161b1658de6d5f763c18de;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/aarch64.cc b/gold/aarch64.cc index ecb400b274..07abe44931 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -1,6 +1,6 @@ // aarch64.cc -- aarch64 target support for gold. -// Copyright (C) 2014-2018 Free Software Foundation, Inc. +// Copyright (C) 2014-2020 Free Software Foundation, Inc. // Written by Jing Yu and Han Shen . // This file is part of gold. @@ -3565,6 +3565,7 @@ const Target::Target_info Target_aarch64<64, false>::aarch64_info = NULL, // attributes_vendor "_start", // entry_symbol_name 32, // hash_entry_size + elfcpp::SHT_PROGBITS, // unwind_section_type }; template<> @@ -3593,6 +3594,7 @@ const Target::Target_info Target_aarch64<32, false>::aarch64_info = NULL, // attributes_vendor "_start", // entry_symbol_name 32, // hash_entry_size + elfcpp::SHT_PROGBITS, // unwind_section_type }; template<> @@ -3621,6 +3623,7 @@ const Target::Target_info Target_aarch64<64, true>::aarch64_info = NULL, // attributes_vendor "_start", // entry_symbol_name 32, // hash_entry_size + elfcpp::SHT_PROGBITS, // unwind_section_type }; template<> @@ -3649,6 +3652,7 @@ const Target::Target_info Target_aarch64<32, true>::aarch64_info = NULL, // attributes_vendor "_start", // entry_symbol_name 32, // hash_entry_size + elfcpp::SHT_PROGBITS, // unwind_section_type }; // Get the GOT section, creating it if necessary. @@ -3968,6 +3972,7 @@ Target_aarch64::scan_reloc_section_for_stubs( const Symbol_value *psymval; bool is_defined_in_discarded_section; unsigned int shndx; + const Symbol* gsym = NULL; if (r_sym < local_count) { sym = NULL; @@ -4020,7 +4025,6 @@ Target_aarch64::scan_reloc_section_for_stubs( } else { - const Symbol* gsym; gsym = object->global_symbol(r_sym); gold_assert(gsym != NULL); if (gsym->is_forwarder()) @@ -4061,16 +4065,16 @@ Target_aarch64::scan_reloc_section_for_stubs( Symbol_value symval2; if (is_defined_in_discarded_section) { + std::string name = object->section_name(relinfo->data_shndx); + if (comdat_behavior == CB_UNDETERMINED) - { - std::string name = object->section_name(relinfo->data_shndx); comdat_behavior = default_comdat_behavior.get(name.c_str()); - } + if (comdat_behavior == CB_PRETEND) { bool found; typename elfcpp::Elf_types::Elf_Addr value = - object->map_to_kept_section(shndx, &found); + object->map_to_kept_section(shndx, name, &found); if (found) symval2.set_output_value(value + psymval->input_value()); else @@ -4078,10 +4082,8 @@ Target_aarch64::scan_reloc_section_for_stubs( } else { - if (comdat_behavior == CB_WARNING) - gold_warning_at_location(relinfo, i, offset, - _("relocation refers to discarded " - "section")); + if (comdat_behavior == CB_ERROR) + issue_discarded_error(relinfo, i, offset, r_sym, gsym); symval2.set_output_value(0); } symval2.set_no_output_symtab_entry(); @@ -6494,6 +6496,17 @@ Target_aarch64::Scan::global( gold_error(_("%s: unsupported reloc %u in pos independent link."), object->name().c_str(), r_type); } + // Make a PLT entry if necessary. + if (gsym->needs_plt_entry()) + { + target->make_plt_entry(symtab, layout, gsym); + // Since this is not a PC-relative relocation, we may be + // taking the address of a function. In that case we need to + // set the entry in the dynamic symbol table to the address of + // the PLT entry. + if (gsym->is_from_dynobj() && !parameters->options().shared()) + gsym->set_needs_dynsym_value(); + } break; case elfcpp::R_AARCH64_LD_PREL_LO19: // 273 @@ -6963,11 +6976,11 @@ Target_aarch64::do_finalize_sections( } // Set the size of the _GLOBAL_OFFSET_TABLE_ symbol to the size of - // the .got.plt section. + // the .got section. Symbol* sym = this->global_offset_table_; if (sym != NULL) { - uint64_t data_size = this->got_plt_->current_data_size(); + uint64_t data_size = this->got_->current_data_size(); symtab->get_sized_symbol(sym)->set_symsize(data_size); // If the .got section is more than 0x8000 bytes, we add