This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/13909: PR ld/12570 causes eh_frame_hdr section to be sometimes too large
On Tue, May 22, 2012 at 8:10 AM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, May 22, 2012 at 07:11:09AM -0700, H.J. Lu wrote:
>>
>> ? ?if (!info->no_ld_generated_unwind_info
>> ? ? ? ?&& htab->plt_eh_frame == NULL
>> - ? ? ?&& htab->elf.splt != NULL)
>> + ? ? ?&& htab->elf.splt != NULL
>> + ? ? ?&& bfd_get_section_by_name (dynobj, ".eh_frame") != NULL)
>
> Doesn't look correct to me. ?dynobj is one of the input files, usually
> the first one. ?Why should creating plt eh_frame info depend on one
> file?
>
How about this patch?
--
H.J.
---
2012-05-22 H.J. Lu <hongjiu.lu@intel.com>
PR ld/13909
* elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Ignore
.eh_frame section created by linker.
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 8ec34ab..d99fc73 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1278,7 +1278,10 @@ _bfd_elf_maybe_strip_eh_frame_hdr (struct
bfd_link_info *info)
/* Count only sections which have at least a single CIE or FDE.
There cannot be any CIE or FDE <= 8 bytes. */
o = bfd_get_section_by_name (abfd, ".eh_frame");
- if (o && o->size > 8 && !bfd_is_abs_section (o->output_section))
+ if (o
+ && o->size > 8
+ && (o->flags & SEC_LINKER_CREATED) == 0
+ && !bfd_is_abs_section (o->output_section))
break;
}