diff options
author | Jakub Jelinek <jakub@redhat.com> | 2001-12-19 11:48:15 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2001-12-19 11:48:15 +0000 |
commit | a5eb27e6ff61757fc74229dce1f8864262a51fbe (patch) | |
tree | fc28b6c173818bb176bb3494bed04a31b617fefd /bfd | |
parent | 9d201f2ff10ecb906b9287208a3ddb7bd75888aa (diff) | |
download | gdb-a5eb27e6ff61757fc74229dce1f8864262a51fbe.zip gdb-a5eb27e6ff61757fc74229dce1f8864262a51fbe.tar.gz gdb-a5eb27e6ff61757fc74229dce1f8864262a51fbe.tar.bz2 |
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): If new_size
is 0, temporarily grow it to minimal CIE size.
(_bfd_elf_write_section_eh_frame): If input .eh_frame section would
end up empty, build a fake minimal CIE.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elf-eh-frame.c | 18 |
2 files changed, 24 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 77d3d81..619f42c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2001-12-19 Jakub Jelinek <jakub@redhat.com> + + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): If new_size + is 0, temporarily grow it to minimal CIE size. + (_bfd_elf_write_section_eh_frame): If input .eh_frame section would + end up empty, build a fake minimal CIE. + 2001-12-19 Steve Ellcey <sje@cup.hp.com> * config.bfd (bfd_elf32_ia64_hpux_big_vec): New vector for diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 2436c17..d39e549 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -701,8 +701,12 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec, ehdrsec, hdr_info->last_cie_offset = sec_info->entry[last_cie_ndx].new_offset; } + /* FIXME: Currently it is not possible to shrink sections to zero size at + this point, so build a fake minimal CIE. */ + if (new_size == 0) + new_size = 16; + /* Shrink the sec as needed. */ - sec->_cooked_size = new_size; if (sec->_cooked_size == 0) sec->flags |= SEC_EXCLUDE; @@ -1069,6 +1073,18 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents) p += sec_info->entry[i].size; } + /* FIXME: Once _bfd_elf_discard_section_eh_frame will be able to + shrink sections to zero size, this won't be needed any more. */ + if (p == contents && sec->_cooked_size == 16) + { + bfd_put_32 (abfd, 12, p); /* Fake CIE length */ + bfd_put_32 (abfd, 0, p + 4); /* Fake CIE id */ + p[8] = 1; /* Fake CIE version */ + memset (p + 9, 0, 7); /* Fake CIE augmentation, 3xleb128 + and 3xDW_CFA_nop as pad */ + p += 16; + } + BFD_ASSERT ((bfd_size_type) (p - contents) == sec->_cooked_size); return bfd_set_section_contents (abfd, sec->output_section, |