aboutsummaryrefslogtreecommitdiff
path: root/gold/incremental-dump.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2010-08-12 22:15:00 +0000
committerCary Coutant <ccoutant@google.com>2010-08-12 22:15:00 +0000
commit0e70b9111a696f5b70cade541df55de14c31f9f1 (patch)
tree6f83a4c1e2c4431cbffd2ee3bb5e71f1fe8cece0 /gold/incremental-dump.cc
parent09ec0418c0d4144afba5947499425e27900d953f (diff)
downloadfsf-binutils-gdb-0e70b9111a696f5b70cade541df55de14c31f9f1.zip
fsf-binutils-gdb-0e70b9111a696f5b70cade541df55de14c31f9f1.tar.gz
fsf-binutils-gdb-0e70b9111a696f5b70cade541df55de14c31f9f1.tar.bz2
elfcpp/ChangeLog:
* elfcpp.h (enum SHT): Add SHT_GNU_INCREMENTAL_GOT_PLT. gold/ChangeLog: * arm.cc (Target_arm::got_size): Add const. (Target_arm::got_entry_count): New function. (Target_arm::plt_entry_count): New function. (Target_arm::first_plt_entry_offset): New function. (Target_arm::plt_entry_size): New function. (Output_data_plt_arm::entry_count): New function. (Output_data_plt_arm::first_plt_entry_offset): New function. (Output_data_plt_arm::get_plt_entry_size): New function. * i386.cc (Target_i386::got_size): Add const. (Target_i386::got_entry_count): New function. (Target_i386::plt_entry_count): New function. (Target_i386::first_plt_entry_offset): New function. (Target_i386::plt_entry_size): New function. (Output_data_plt_i386::entry_count): New function. (Output_data_plt_i386::first_plt_entry_offset): New function. (Output_data_plt_i386::get_plt_entry_size): New function. * incremental-dump.cc (dump_incremental_inputs): Adjust call to find_incremental_inputs_sections. Dump incremental_got_plt section. * incremental.cc: Include target.h. (Sized_incremental_binary::do_find_incremental_inputs_sections): Add parameter. Adjust all callers. Find incremental_got_plt section. (Incremental_inputs::create_data_sections): Create incremental_got_plt section. (Output_section_incremental_inputs::set_final_data_size): Calculate size of incremental_got_plt section. (Output_section_incremental_inputs::do_write): Write the incremental_got_plt section. (Got_plt_view_info): New struct. (Local_got_offset_visitor): New class. (Global_got_offset_visitor): New class. (Global_symbol_visitor_got_plt): New class. (Output_section_incremental_inputs::write_got_plt): New function. * incremental.h (Incremental_binary::find_incremental_inputs_sections): Add parameter. Adjust all callers. (Incremental_binary::do_find_incremental_inputs_sections): Likewise. (Incremental_inputs::got_plt_section): New function. (Incremental_inputs::got_plt_section_): New data member. (Incremental_got_plt_reader): New class. * layout.cc (Layout::create_incremental_info_sections): Add the incremental_got_plt section. * object.h (Got_offset_list::get_list): New function. (Got offset_list::for_all_got_offsets): New function. (Sized_relobj::local_got_offset_list): New function. * powerpc.cc (Target_powerpc::got_size): Add const. (Target_powerpc::got_entry_count): New function. (Target_powerpc::plt_entry_count): New function. (Target_powerpc::first_plt_entry_offset): New function. (Target_powerpc::plt_entry_size): New function. (Output_data_plt_powerpc::entry_count): New function. (Output_data_plt_powerpc::first_plt_entry_offset): New function. (Output_data_plt_powerpc::get_plt_entry_size): New function. * sparc.cc (Target_sparc::got_size): Add const. (Target_sparc::got_entry_count): New function. (Target_sparc::plt_entry_count): New function. (Target_sparc::first_plt_entry_offset): New function. (Target_sparc::plt_entry_size): New function. (Output_data_plt_sparc::entry_count): New function. (Output_data_plt_sparc::first_plt_entry_offset): New function. (Output_data_plt_sparc::get_plt_entry_size): New function. * symtab.h (Symbol::got_offset_list): New function. (Symbol_table::for_all_symbols): New function. * target.h (Sized_target::got_entry_count): New function. (Sized_target::plt_entry_count): New function. (Sized_target::plt_entry_size): New function. * x86_64.cc (Target_x86_64::got_size): Add const. (Target_x86_64::got_entry_count): New function. (Target_x86_64::plt_entry_count): New function. (Target_x86_64::first_plt_entry_offset): New function. (Target_x86_64::plt_entry_size): New function. (Output_data_plt_x86_64::entry_count): New function. (Output_data_plt_x86_64::first_plt_entry_offset): New function. (Output_data_plt_x86_64::get_plt_entry_size): New function.
Diffstat (limited to 'gold/incremental-dump.cc')
-rw-r--r--gold/incremental-dump.cc64
1 files changed, 52 insertions, 12 deletions
diff --git a/gold/incremental-dump.cc b/gold/incremental-dump.cc
index 98555cd..68fba5c 100644
--- a/gold/incremental-dump.cc
+++ b/gold/incremental-dump.cc
@@ -79,6 +79,7 @@ dump_incremental_inputs(const char* argv0, const char* filename,
unsigned int inputs_shndx;
unsigned int isymtab_shndx;
unsigned int irelocs_shndx;
+ unsigned int igot_plt_shndx;
unsigned int istrtab_shndx;
typedef Incremental_binary::Location Location;
typedef Incremental_binary::View View;
@@ -88,7 +89,8 @@ dump_incremental_inputs(const char* argv0, const char* filename,
// Find the .gnu_incremental_inputs, _symtab, _relocs, and _strtab sections.
t = inc->find_incremental_inputs_sections(&inputs_shndx, &isymtab_shndx,
- &irelocs_shndx, &istrtab_shndx);
+ &irelocs_shndx, &igot_plt_shndx,
+ &istrtab_shndx);
if (!t)
{
fprintf(stderr, "%s: %s: no .gnu_incremental_inputs section\n", argv0,
@@ -134,9 +136,7 @@ dump_incremental_inputs(const char* argv0, const char* filename,
printf("\nInput files:\n");
for (unsigned int i = 0; i < incremental_inputs.input_file_count(); ++i)
{
- typedef Incremental_inputs_reader<size, big_endian> Inputs_reader;
- typename Inputs_reader::Incremental_input_entry_reader input_file =
- incremental_inputs.input_file(i);
+ Entry_reader input_file = incremental_inputs.input_file(i);
const char* objname = input_file.filename();
if (objname == NULL)
@@ -203,10 +203,6 @@ dump_incremental_inputs(const char* argv0, const char* filename,
printf("\nInput sections:\n");
for (unsigned int i = 0; i < incremental_inputs.input_file_count(); ++i)
{
- typedef Incremental_inputs_reader<size, big_endian> Inputs_reader;
- typedef typename Inputs_reader::Incremental_input_entry_reader
- Entry_reader;
-
Entry_reader input_file(incremental_inputs.input_file(i));
if (input_file.type() != INCREMENTAL_INPUT_OBJECT
@@ -241,10 +237,6 @@ dump_incremental_inputs(const char* argv0, const char* filename,
printf("\nGlobal symbols per input file:\n");
for (unsigned int i = 0; i < incremental_inputs.input_file_count(); ++i)
{
- typedef Incremental_inputs_reader<size, big_endian> Inputs_reader;
- typedef typename Inputs_reader::Incremental_input_entry_reader
- Entry_reader;
-
Entry_reader input_file(incremental_inputs.input_file(i));
if (input_file.type() != INCREMENTAL_INPUT_OBJECT
@@ -374,6 +366,54 @@ dump_incremental_inputs(const char* argv0, const char* filename,
isym_p += 4;
}
+ // Get a view of the .gnu_incremental_got_plt section.
+
+ Location igot_plt_location(elf_file.section_contents(igot_plt_shndx));
+ View igot_plt_view(inc->view(igot_plt_location));
+
+ Incremental_got_plt_reader<big_endian> igot_plt(igot_plt_view.data());
+ unsigned int ngot = igot_plt.get_got_entry_count();
+ unsigned int nplt = igot_plt.get_plt_entry_count();
+
+ printf("\nGOT entries:\n");
+ for (unsigned int i = 0; i < ngot; ++i)
+ {
+ unsigned int got_type = igot_plt.get_got_type(i);
+ unsigned int got_desc = igot_plt.get_got_desc(i);
+ printf("[%d] type %02x, ", i, got_type & 0x7f);
+ if (got_type == 0x7f)
+ printf("reserved");
+ else if (got_type & 0x80)
+ {
+ Entry_reader input_file = incremental_inputs.input_file(got_desc);
+ const char* objname = input_file.filename();
+ printf("local: %s (%d)", objname, got_desc);
+ }
+ else
+ {
+ sym_p = symtab_view.data() + got_desc * sym_size;
+ elfcpp::Sym<size, big_endian> sym(sym_p);
+ const char* symname;
+ if (!strtab.get_c_string(sym.get_st_name(), &symname))
+ symname = "<unknown>";
+ printf("global %s (%d)", symname, got_desc);
+ }
+ printf("\n");
+ }
+
+ printf("\nPLT entries:\n");
+ for (unsigned int i = 0; i < nplt; ++i)
+ {
+ unsigned int plt_desc = igot_plt.get_plt_desc(i);
+ printf("[%d] ", i);
+ sym_p = symtab_view.data() + plt_desc * sym_size;
+ elfcpp::Sym<size, big_endian> sym(sym_p);
+ const char* symname;
+ if (!strtab.get_c_string(sym.get_st_name(), &symname))
+ symname = "<unknown>";
+ printf("%s (%d)\n", symname, plt_desc);
+ }
+
printf("\nUnused archive symbols:\n");
for (unsigned int i = 0; i < incremental_inputs.input_file_count(); ++i)
{