This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Two more .eh_frame fixes
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Sun, 30 Dec 2001 17:38:40 -0500
- Subject: [PATCH] Two more .eh_frame fixes
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
I found two more problems with .eh_frame, fixed below.
The first problem is that ld -r --eh-frame-hdr would die, since there is no
dynobj yet it was trying to bfd_get_section_by_name, the second is that
linking with --eh-frame-hdr and without gcc crt files (and no .eh_frame
section anywhere) would die too (output .eh_frame section couldn't be
found).
Am terribly sorry for this, hopefully it is the last problem with the patch.
Ok to commit?
2001-12-30 Jakub Jelinek <jakub@redhat.com>
* elflink.h (elf_bfd_final_link): Check if dynobj is not NULL
before looking for .eh_frame_hdr section.
* elf-eh-frame.c (_bfd_elf_write_section_eh_frame_hdr): If
.eh_frame_hdr section is being stripped from output, don't do
anything.
--- bfd/elflink.h.jj Tue Dec 18 14:30:32 2001
+++ bfd/elflink.h Fri Dec 28 02:03:47 2001
@@ -5670,7 +5670,7 @@ elf_bfd_final_link (abfd, info)
goto error_return;
}
- if (info->eh_frame_hdr)
+ if (info->eh_frame_hdr && elf_hash_table (info)->dynobj)
{
o = bfd_get_section_by_name (elf_hash_table (info)->dynobj,
".eh_frame_hdr");
--- bfd/elf-eh-frame.c.jj Tue Dec 18 23:31:12 2001
+++ bfd/elf-eh-frame.c Fri Dec 28 12:52:32 2001
@@ -1149,6 +1149,9 @@ _bfd_elf_write_section_eh_frame_hdr (abf
== ELF_INFO_TYPE_EH_FRAME_HDR);
hdr_info = (struct eh_frame_hdr_info *)
elf_section_data (sec)->sec_info;
+ if (hdr_info->strip)
+ return true;
+
size = EH_FRAME_HDR_SIZE;
if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
size += 4 + hdr_info->fde_count * 8;
Jakub