// object.h -- support for an object file for linking in gold -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
-// Free Software Foundation, Inc.
+// Copyright (C) 2006-2015 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
{
std::string source_file;
std::string enclosing_symbol_name;
- int line_number;
+ elfcpp::STT enclosing_symbol_type;
};
// Data about a single relocation section. This is read in
// Return the name of a section given a section index.
std::string
- section_name(unsigned int shndx)
+ section_name(unsigned int shndx) const
{ return this->do_section_name(shndx); }
// Return the section flags given a section index.
output_section(unsigned int shndx) const
{ return this->do_output_section(shndx); }
+ // Given a section index, return its address.
+ // The return value will be -1U if the section is specially mapped,
+ // such as a merge section.
+ uint64_t
+ output_section_address(unsigned int shndx)
+ { return this->do_output_section_address(shndx); }
+
// Given a section index, return the offset in the Output_section.
// The return value will be -1U if the section is specially mapped,
// such as a merge section.
// Get the name of a section--implemented by child class.
virtual std::string
- do_section_name(unsigned int shndx) = 0;
+ do_section_name(unsigned int shndx) const = 0;
// Get section flags--implemented by child class.
virtual uint64_t
do_output_section(unsigned int) const
{ gold_unreachable(); }
+ // Get the address of a section--implemented by child class.
+ virtual uint64_t
+ do_output_section_address(unsigned int)
+ { gold_unreachable(); }
+
// Get the offset of a section--implemented by child class.
virtual uint64_t
do_output_section_offset(unsigned int) const
read_section_data(elfcpp::Elf_file<size, big_endian, Object>*,
Read_symbols_data*);
+ // Find the section header with the given NAME. If HDR is non-NULL
+ // then it is a section header returned from a previous call to this
+ // function and the next section header with the same name will be
+ // returned.
+ template<int size, bool big_endian>
+ const unsigned char*
+ find_shdr(const unsigned char* pshdrs, const char* name,
+ const char* names, section_size_type names_size,
+ const unsigned char* hdr) const;
+
// Let the child class initialize the xindex object directly.
void
set_xindex(Xindex* xindex)
return this->output_sections_[shndx] != NULL;
}
- // The the output section of the input section with index SHNDX.
+ // The output section of the input section with index SHNDX.
// This is only used currently to remove a section from the link in
// relaxation.
void
section_offsets()
{ return this->section_offsets_; }
+ // Get the address of an output section.
+ uint64_t
+ do_output_section_address(unsigned int shndx);
+
// Get the offset of a section.
uint64_t
do_output_section_offset(unsigned int shndx) const
Address
map_to_kept_section(unsigned int shndx, bool* found) const;
- // Find the section header with the given NAME. If HDR is non-NULL
- // then it is a section header returned from a previous call to this
- // function and the next section header with the same name will be
- // returned.
- const unsigned char*
- find_shdr(const unsigned char* pshdrs, const char* name,
- const char* names, section_size_type names_size,
- const unsigned char* hdr) const;
-
// Compute final local symbol value. R_SYM is the local symbol index.
// LV_IN points to a local symbol value containing the input value.
// LV_OUT points to a local symbol value storing the final output value,
Symbol_value<size>* lv_out,
const Symbol_table* symtab);
+ // Return true if the layout for this object was deferred.
+ bool is_deferred_layout() const
+ { return this->is_deferred_layout_; }
+
protected:
typedef typename Sized_relobj<size, big_endian>::Output_sections
Output_sections;
void
do_read_symbols(Read_symbols_data*);
+ // Read the symbols. This is common code for all target-specific
+ // overrides of do_read_symbols.
+ void
+ base_read_symbols(Read_symbols_data*);
+
// Return the value of a local symbol.
uint64_t
do_local_symbol_value(unsigned int symndx, uint64_t addend) const
// Get the name of a section.
std::string
- do_section_name(unsigned int shndx)
+ do_section_name(unsigned int shndx) const
{ return this->elf_file_.section_name(shndx); }
// Return the location of the contents of a section.
// If this object has a GNU style .eh_frame section that is discarded in
// output, record the index here. Otherwise it is -1U.
unsigned int discarded_eh_frame_shndx_;
+ // True if the layout of this object was deferred, waiting for plugin
+ // replacement files.
+ bool is_deferred_layout_;
// The list of sections whose layout was deferred.
std::vector<Deferred_layout> deferred_layout_;
// The list of relocation sections whose layout was deferred.