{
}
-// Set the final address and size of the exception frame header.
+// Set the size of the exception frame header.
void
-Eh_frame_hdr::do_set_address(uint64_t, off_t)
+Eh_frame_hdr::set_final_data_size()
{
unsigned int data_size = eh_frame_hdr_size + 4;
if (!this->any_unrecognized_eh_frame_sections_)
template<int size, bool big_endian>
typename elfcpp::Elf_types<size>::Elf_Addr
-Eh_frame_hdr::get_fde_pc(const unsigned char* eh_frame_contents,
- off_t fde_offset, unsigned char fde_encoding)
+Eh_frame_hdr::get_fde_pc(
+ typename elfcpp::Elf_types<size>::Elf_Addr eh_frame_address,
+ const unsigned char* eh_frame_contents,
+ section_offset_type fde_offset,
+ unsigned char fde_encoding)
{
// The FDE starts with a 4 byte length and a 4 byte offset to the
// CIE. The PC follows.
break;
default:
+ // All other cases were rejected in Eh_frame::read_cie.
+ gold_unreachable();
+ }
+
+ switch (fde_encoding & 0xf0)
+ {
+ case 0:
+ break;
+
+ case elfcpp::DW_EH_PE_pcrel:
+ pc += eh_frame_address + fde_offset + 8;
+ break;
+
+ default:
+ // If other cases arise, then we have to handle them, or we have
+ // to reject them by returning false in Eh_frame::read_cie.
gold_unreachable();
}
++p)
{
typename elfcpp::Elf_types<size>::Elf_Addr fde_pc;
- fde_pc = this->get_fde_pc<size, big_endian>(eh_frame_contents,
+ fde_pc = this->get_fde_pc<size, big_endian>(eh_frame_address,
+ eh_frame_contents,
p->first, p->second);
fde_addresses->push_back(fde_pc, eh_frame_address + p->first);
}
// CIE. Record the FDE pc for EH_FRAME_HDR. Return the new offset.
template<int size, bool big_endian>
-off_t
-Fde::write(unsigned char* oview, off_t offset, off_t cie_offset,
- unsigned char fde_encoding, Eh_frame_hdr* eh_frame_hdr)
+section_offset_type
+Fde::write(unsigned char* oview, section_offset_type offset,
+ section_offset_type cie_offset, unsigned char fde_encoding,
+ Eh_frame_hdr* eh_frame_hdr)
{
size_t length = this->contents_.length();
// Set the output offset of a CIE. Return the new output offset.
-off_t
-Cie::set_output_offset(off_t output_offset, unsigned int addralign,
+section_offset_type
+Cie::set_output_offset(section_offset_type output_offset,
+ unsigned int addralign,
Merge_map* merge_map)
{
size_t length = this->contents_.length();
// recording. Return the new offset.
template<int size, bool big_endian>
-off_t
-Cie::write(unsigned char* oview, off_t offset, Eh_frame_hdr* eh_frame_hdr)
+section_offset_type
+Cie::write(unsigned char* oview, section_offset_type offset,
+ Eh_frame_hdr* eh_frame_hdr)
{
- off_t cie_offset = offset;
+ section_offset_type cie_offset = offset;
size_t length = this->contents_.length();
Eh_frame::add_ehframe_input_section(
Sized_relobj<size, big_endian>* object,
const unsigned char* symbols,
- off_t symbols_size,
+ section_size_type symbols_size,
const unsigned char* symbol_names,
- off_t symbol_names_size,
+ section_size_type symbol_names_size,
unsigned int shndx,
unsigned int reloc_shndx,
unsigned int reloc_type)
{
// Get the section contents.
- off_t contents_len;
+ section_size_type contents_len;
const unsigned char* pcontents = object->section_contents(shndx,
&contents_len,
false);
Eh_frame::do_add_ehframe_input_section(
Sized_relobj<size, big_endian>* object,
const unsigned char* symbols,
- off_t symbols_size,
+ section_size_type symbols_size,
const unsigned char* symbol_names,
- off_t symbol_names_size,
+ section_size_type symbol_names_size,
unsigned int shndx,
unsigned int reloc_shndx,
unsigned int reloc_type,
const unsigned char* pcontents,
- off_t contents_len,
+ section_size_type contents_len,
New_cies* new_cies)
{
typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
Eh_frame::read_cie(Sized_relobj<size, big_endian>* object,
unsigned int shndx,
const unsigned char* symbols,
- off_t symbols_size,
+ section_size_type symbols_size,
const unsigned char* symbol_names,
- off_t symbol_names_size,
+ section_size_type symbol_names_size,
const unsigned char* pcontents,
const unsigned char* pcie,
const unsigned char *pcieend,
case elfcpp::DW_EH_PE_udata8:
break;
default:
+ // We don't expect to see any other cases here, and
+ // we're not prepared to handle them.
return false;
}
++p;
Eh_frame::read_fde(Sized_relobj<size, big_endian>* object,
unsigned int shndx,
const unsigned char* symbols,
- off_t symbols_size,
+ section_size_type symbols_size,
const unsigned char* pcontents,
unsigned int offset,
const unsigned char* pfde,
// Set the final data size.
void
-Eh_frame::do_set_address(uint64_t, off_t start_file_offset)
+Eh_frame::set_final_data_size()
{
- off_t output_offset = 0;
+ off_t start_file_offset = this->offset();
+ section_offset_type output_offset = 0;
for (Unmergeable_cie_offsets::iterator p =
this->unmergeable_cie_offsets_.begin();
bool
Eh_frame::do_output_offset(const Relobj* object, unsigned int shndx,
- off_t offset, off_t* poutput) const
+ section_offset_type offset,
+ section_offset_type* poutput) const
{
return this->merge_map_.get_output_offset(object, shndx, offset, poutput);
}
void
Eh_frame::do_sized_write(unsigned char* oview)
{
- off_t o = 0;
+ section_offset_type o = 0;
for (Unmergeable_cie_offsets::iterator p =
this->unmergeable_cie_offsets_.begin();
p != this->unmergeable_cie_offsets_.end();
Eh_frame::add_ehframe_input_section<32, false>(
Sized_relobj<32, false>* object,
const unsigned char* symbols,
- off_t symbols_size,
+ section_size_type symbols_size,
const unsigned char* symbol_names,
- off_t symbol_names_size,
+ section_size_type symbol_names_size,
unsigned int shndx,
unsigned int reloc_shndx,
unsigned int reloc_type);
Eh_frame::add_ehframe_input_section<32, true>(
Sized_relobj<32, true>* object,
const unsigned char* symbols,
- off_t symbols_size,
+ section_size_type symbols_size,
const unsigned char* symbol_names,
- off_t symbol_names_size,
+ section_size_type symbol_names_size,
unsigned int shndx,
unsigned int reloc_shndx,
unsigned int reloc_type);
Eh_frame::add_ehframe_input_section<64, false>(
Sized_relobj<64, false>* object,
const unsigned char* symbols,
- off_t symbols_size,
+ section_size_type symbols_size,
const unsigned char* symbol_names,
- off_t symbol_names_size,
+ section_size_type symbol_names_size,
unsigned int shndx,
unsigned int reloc_shndx,
unsigned int reloc_type);
Eh_frame::add_ehframe_input_section<64, true>(
Sized_relobj<64, true>* object,
const unsigned char* symbols,
- off_t symbols_size,
+ section_size_type symbols_size,
const unsigned char* symbol_names,
- off_t symbol_names_size,
+ section_size_type symbol_names_size,
unsigned int shndx,
unsigned int reloc_shndx,
unsigned int reloc_type);