From f7e2ee482013bd5df3e3726305eab7c5ed5ce020 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 2 Nov 2007 03:28:52 +0000 Subject: Reworked from Andrew Chatham: report error locations. --- gold/object.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'gold/object.h') diff --git a/gold/object.h b/gold/object.h index 46e332f..9fdb9a3 100644 --- a/gold/object.h +++ b/gold/object.h @@ -76,6 +76,15 @@ struct Read_symbols_data unsigned int verneed_info; }; +// Information used to print error messages. + +struct Symbol_location_info +{ + std::string source_file; + std::string enclosing_symbol_name; + int line_number; +}; + // Data about a single relocation section. This is read in // read_relocs and processed in scan_relocs. @@ -188,6 +197,11 @@ class Object section_flags(unsigned int shndx) { return this->do_section_flags(shndx); } + // Return the section link field given a section index. + unsigned int + section_link(unsigned int shndx) + { return this->do_section_link(shndx); } + // Read the symbol information. void read_symbols(Read_symbols_data* sd) @@ -277,6 +291,10 @@ class Object virtual uint64_t do_section_flags(unsigned int shndx) = 0; + // Get section link field--implemented by child class. + virtual unsigned int + do_section_link(unsigned int shndx) = 0; + // Get the file. Input_file* input_file() const @@ -660,6 +678,13 @@ class Sized_relobj : public Relobj gold_assert(ins.second); } + // Return the name of the symbol that spans the given offset in the + // specified section in this object. This is used only for error + // messages and is not particularly efficient. + bool + get_symbol_location_info(unsigned int shndx, off_t offset, + Symbol_location_info* info); + // Read the symbols. void do_read_symbols(Read_symbols_data*); @@ -706,6 +731,11 @@ class Sized_relobj : public Relobj do_section_flags(unsigned int shndx) { return this->elf_file_.section_flags(shndx); } + // Return the section link field. + unsigned int + do_section_link(unsigned int shndx) + { return this->elf_file_.section_link(shndx); } + private: // For convenience. typedef Sized_relobj This; -- cgit v1.1