// reloc.cc -- relocate input files for gold.
-// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
void
Read_relocs::run(Workqueue* workqueue)
{
- Read_relocs_data *rd = new Read_relocs_data;
+ Read_relocs_data* rd = new Read_relocs_data;
this->object_->read_relocs(rd);
this->object_->set_relocs_data(rd);
this->object_->release();
const Output_sections& out_sections(this->output_sections());
const std::vector<Address>& out_offsets(this->section_offsets_);
- const unsigned char *pshdrs = this->get_view(this->elf_file_.shoff(),
+ const unsigned char* pshdrs = this->get_view(this->elf_file_.shoff(),
shnum * This::shdr_size,
true, true);
// Skip the first, dummy, section.
- const unsigned char *ps = pshdrs + This::shdr_size;
+ const unsigned char* ps = pshdrs + This::shdr_size;
for (unsigned int i = 1; i < shnum; ++i, ps += This::shdr_size)
{
typename This::Shdr shdr(ps);
if (!is_section_allocated
&& !parameters->options().relocatable()
&& !parameters->options().emit_relocs()
- && !parameters->options().incremental())
+ && !parameters->incremental())
continue;
if (this->adjust_shndx(shdr.get_sh_link()) != this->symtab_shndx_)
}
// Process the relocs to generate mappings from source sections to referenced
-// sections. This is used during garbage colletion to determine garbage
+// sections. This is used during garbage collection to determine garbage
// sections.
template<int size, bool big_endian>
// Write out the local symbols.
this->write_local_symbols(of, layout->sympool(), layout->dynpool(),
layout->symtab_xindex(), layout->dynsym_xindex());
-
- // We should no longer need the local symbol values.
- this->clear_local_symbols();
}
// Sort a Read_multiple vector by file offset.
this->emit_relocs(&relinfo, i, sh_type, prelocs, reloc_count,
os, output_offset, view, address, view_size,
(*pviews)[i].view, (*pviews)[i].view_size);
- if (parameters->options().incremental())
+ if (parameters->incremental())
this->incremental_relocs_write(&relinfo, sh_type, prelocs,
reloc_count, os, output_offset, of);
}
return elfcpp::elf_r_sym<size>(rel.get_r_info());
}
+// Return the addend of the next reloc, or 0 if there isn't one.
+
+template<int size, bool big_endian>
+uint64_t
+Track_relocs<size, big_endian>::next_addend() const
+{
+ if (this->pos_ >= this->len_)
+ return 0;
+ if (this->reloc_size_ == elfcpp::Elf_sizes<size>::rel_size)
+ return 0;
+ elfcpp::Rela<size, big_endian> rela(this->prelocs_ + this->pos_);
+ return rela.get_r_addend();
+}
+
// Advance to the next reloc whose r_offset is greater than or equal
// to OFFSET. Return the number of relocs we skip.