diff options
author | Alan Modra <amodra@gmail.com> | 2014-11-11 20:13:03 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-11-11 20:28:46 +1030 |
commit | 4de1599bcf044a5396ec588f90b8f475be657d4f (patch) | |
tree | ba6d6f32109140c8baf7e4077b39748cb6d3717a /bfd | |
parent | 26a84859720cc202e98265d9e4a2e0ddde207f86 (diff) | |
download | gdb-4de1599bcf044a5396ec588f90b8f475be657d4f.zip gdb-4de1599bcf044a5396ec588f90b8f475be657d4f.tar.gz gdb-4de1599bcf044a5396ec588f90b8f475be657d4f.tar.bz2 |
ld -r abort in _bfd_elf_write_section_eh_frame
Turning on .eh_frame processing for ld -r resulted in systemtap
tickling a ld bug. Triggered by the zero terminator not being added
to .eh_frame in a separate file as it usually is (crtend.o), but
instead being present in the last .eh_frame section along with CIEs
and FDEs. The 4-byte terminator makes the section size check fail
on 64-bit targets.
* elf-eh-frame (_bfd_elf_write_section_eh_frame): Adjust section
size check to account for possible zero terminator.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf-eh-frame.c | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7f14166..72b6ceb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-11-11 Alan Modra <amodra@gmail.com> + + * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Adjust section + size check to account for possible zero terminator. + 2014-11-10 James Cowgill <James.Cowgill@imgtec.com> * elfxx-mips.c (_bfd_mips_elf_section_processing): don't force small diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index e481f34..002932d 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -1398,6 +1398,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, struct eh_frame_hdr_info *hdr_info; unsigned int ptr_size; struct eh_cie_fde *ent; + bfd_size_type sec_size; if (sec->sec_info_type != SEC_INFO_TYPE_EH_FRAME) /* FIXME: octets_per_byte. */ @@ -1723,7 +1724,11 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, the pointer size. _bfd_elf_discard_section_eh_frame should have padded CIE/FDE records to multiple of pointer size with size_of_output_cie_fde. */ - if ((sec->size % ptr_size) != 0) + sec_size = sec->size; + if (sec_info->count != 0 + && sec_info->entry[sec_info->count - 1].size == 4) + sec_size -= 4; + if ((sec_size % ptr_size) != 0) abort (); /* FIXME: octets_per_byte. */ |