X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gold%2Ftarget.cc;h=19d001c0c611cb1e23b1dd5d1ff5c4ba2de8f0dc;hb=3e1a8f9569478157ee932e35de928beb211f5df4;hp=0e329cdd0b38e6c5507c713fae273031f2f42c06;hpb=6fa2a40bf45fcc738eb580a6b644ac74b42c2d6a;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/target.cc b/gold/target.cc index 0e329cdd0b..19d001c0c6 100644 --- a/gold/target.cc +++ b/gold/target.cc @@ -1,6 +1,6 @@ -// target.cc +// target.cc -- target support for gold. -// Copyright 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2009-2015 Free Software Foundation, Inc. // Written by Doug Kwan . // This file is part of gold. @@ -72,7 +72,10 @@ Target::do_make_elf_object_implementation( const elfcpp::Ehdr& ehdr) { int et = ehdr.get_e_type(); - if (et == elfcpp::ET_REL) + // ET_EXEC files are valid input for --just-symbols/-R, + // and we treat them as relocatable objects. + if (et == elfcpp::ET_REL + || (et == elfcpp::ET_EXEC && input_file->just_symbols())) { Sized_relobj_file* obj = new Sized_relobj_file(name, input_file, offset, ehdr); @@ -158,7 +161,8 @@ Target::do_is_call_to_non_split(const Symbol* sym, unsigned int) const void Target::do_calls_non_split(Relobj* object, unsigned int, section_offset_type, - section_size_type, unsigned char*, section_size_type, + section_size_type, const unsigned char*, size_t, + unsigned char*, section_size_type, std::string*, std::string*) const { static bool warned; @@ -200,4 +204,58 @@ Target::set_view_to_nop(unsigned char* view, section_size_type view_size, } } +// Return address and size to plug into eh_frame FDEs associated with a PLT. +void +Target::do_plt_fde_location(const Output_data* plt, unsigned char*, + uint64_t* address, off_t* len) const +{ + *address = plt->address(); + *len = plt->data_size(); +} + +// Class Sized_target. + +// Set the EI_OSABI field of the ELF header if requested. + +template +void +Sized_target::do_adjust_elf_header(unsigned char* view, + int len) +{ + elfcpp::ELFOSABI osabi = this->osabi(); + if (osabi != elfcpp::ELFOSABI_NONE) + { + gold_assert(len == elfcpp::Elf_sizes::ehdr_size); + + elfcpp::Ehdr ehdr(view); + unsigned char e_ident[elfcpp::EI_NIDENT]; + memcpy(e_ident, ehdr.get_e_ident(), elfcpp::EI_NIDENT); + + e_ident[elfcpp::EI_OSABI] = osabi; + + elfcpp::Ehdr_write oehdr(view); + oehdr.put_e_ident(e_ident); + } +} + +#ifdef HAVE_TARGET_32_LITTLE +template +class Sized_target<32, false>; +#endif + +#ifdef HAVE_TARGET_32_BIG +template +class Sized_target<32, true>; +#endif + +#ifdef HAVE_TARGET_64_LITTLE +template +class Sized_target<64, false>; +#endif + +#ifdef HAVE_TARGET_64_BIG +template +class Sized_target<64, true>; +#endif + } // End namespace gold.