aboutsummaryrefslogtreecommitdiff
path: root/gold/object.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2010-01-05 21:52:51 +0000
committerIan Lance Taylor <ian@airs.com>2010-01-05 21:52:51 +0000
commitdde3f402cfe649f271730fa5de983ee663743ea3 (patch)
treeca56e62c8e4e0b6e57743388d5f1f282cc584869 /gold/object.cc
parent43e85a8f541dcc299092452d816749cf99e31d60 (diff)
downloadgdb-dde3f402cfe649f271730fa5de983ee663743ea3.zip
gdb-dde3f402cfe649f271730fa5de983ee663743ea3.tar.gz
gdb-dde3f402cfe649f271730fa5de983ee663743ea3.tar.bz2
PR 10980
* options.h (class General_options): Add --cref. * main.cc (main): Print cref table if --cref. Don't close mapfile until after printing cref table. * cref.cc: Include "symtab.h". (class Cref_inputs): Define Cref_table_compare and Cref_table. (Cref_table_compare::operator()): New function. (Cref_inputs::gather_cref): New function. (filecol): New static const. (Cref_inputs::print_cref): New function. (Cref::print_cref): New function. * cref.h: Include <cstdio>. (class Cref): Update declarations. * mapfile.h (Mapfile::file): New function. * object.h (class Object): Define Symbols. Declare virtual do_get_global_symbols. (Object::get_global_symbols): New function. * object.cc (Input_objects::add_object): Pass object to cref_ if --cref. (Input_objects::archive_start): Likewise. (Input_objects::archive_stop): Likewise. (Input_objects::print_cref): New function. * dynobj.h (Sized_dynobj::do_get_global_symbols): New function. * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if --cref. * plugin.cc (Sized_pluginobj::do_get_global_symbols): New function. * plugin.h (class Sized_pluginobj): Update declarations.
Diffstat (limited to 'gold/object.cc')
-rw-r--r--gold/object.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/gold/object.cc b/gold/object.cc
index 127e3a6..3fedcf8 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -1,6 +1,6 @@
// object.cc -- support for an object file for linking in gold
-// Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -2146,7 +2146,8 @@ Input_objects::add_object(Object* obj)
}
// Add this object to the cross-referencer if requested.
- if (parameters->options().user_set_print_symbol_counts())
+ if (parameters->options().user_set_print_symbol_counts()
+ || parameters->options().cref())
{
if (this->cref_ == NULL)
this->cref_ = new Cref();
@@ -2206,7 +2207,8 @@ Input_objects::check_dynamic_dependencies() const
void
Input_objects::archive_start(Archive* archive)
{
- if (parameters->options().user_set_print_symbol_counts())
+ if (parameters->options().user_set_print_symbol_counts()
+ || parameters->options().cref())
{
if (this->cref_ == NULL)
this->cref_ = new Cref();
@@ -2219,7 +2221,8 @@ Input_objects::archive_start(Archive* archive)
void
Input_objects::archive_stop(Archive* archive)
{
- if (parameters->options().user_set_print_symbol_counts())
+ if (parameters->options().user_set_print_symbol_counts()
+ || parameters->options().cref())
this->cref_->add_archive_stop(archive);
}
@@ -2233,6 +2236,15 @@ Input_objects::print_symbol_counts(const Symbol_table* symtab) const
this->cref_->print_symbol_counts(symtab);
}
+// Print a cross reference table.
+
+void
+Input_objects::print_cref(const Symbol_table* symtab, FILE* f) const
+{
+ if (parameters->options().cref() && this->cref_ != NULL)
+ this->cref_->print_cref(symtab, f);
+}
+
// Relocate_info methods.
// Return a string describing the location of a relocation. This is