diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-01-04 17:02:30 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2002-01-04 17:02:30 +0000 |
commit | a3aa38ee6cb3da7e2759d852e1d4afccd9ca9aa3 (patch) | |
tree | a6c1fa0971d2e2198b1517048ec80a08d1ab7082 /bfd | |
parent | 8a8b2d4b4aeee0ab5ab6e19cbaa6999403585015 (diff) | |
download | gdb-a3aa38ee6cb3da7e2759d852e1d4afccd9ca9aa3.zip gdb-a3aa38ee6cb3da7e2759d852e1d4afccd9ca9aa3.tar.gz gdb-a3aa38ee6cb3da7e2759d852e1d4afccd9ca9aa3.tar.bz2 |
* elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Don't crash if
CIE at .eh_frame start is removed due to no FDEs referencing it.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf-eh-frame.c | 19 |
2 files changed, 19 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 66f0da9..4695b89 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2002-01-04 Jakub Jelinek <jakub@redhat.com> + + * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Don't crash if + CIE at .eh_frame start is removed due to no FDEs referencing it. + 2002-01-04 Jason Thorpe <thorpej@wasabisystems.com> * config.bfd (x86_64-*-netbsd*): New target. diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index cc653f7..56a59da 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -919,14 +919,23 @@ _bfd_elf_write_section_eh_frame (abfd, sec, ehdrsec, contents) { if (sec_info->entry[i].cie) { - cie_offset = sec_info->entry[i].new_offset; - cie_offset += (sec_info->entry[i].sec->output_section->vma - + sec_info->entry[i].sec->output_offset - - sec->output_section->vma - - sec->output_offset); + /* If CIE is removed due to no remaining FDEs referencing it + and there were no CIEs kept before it, sec_info->entry[i].sec + will be zero. */ + if (sec_info->entry[i].sec == NULL) + cie_offset = 0; + else + { + cie_offset = sec_info->entry[i].new_offset; + cie_offset += (sec_info->entry[i].sec->output_section->vma + + sec_info->entry[i].sec->output_offset + - sec->output_section->vma + - sec->output_offset); + } } continue; } + if (sec_info->entry[i].cie) { /* CIE */ |