This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Re: EH frame optimization bug
On Thu, Oct 16, 2003 at 01:44:33AM +0100, James Troup wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > Can you try this patch and let me know what you get?
> >
> > 2003-10-15 H.J. Lu <hongjiu.lu@intel.com>
> >
> > * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't
> > use the last CIE/FDE from a different section.
>
> [The good news:] This de-regresses one of the test suite failures:
>
> | -FAIL: NOCROSSREFS 1
> | +PASS: NOCROSSREFS 1
>
> [The bad news:] But all the others remain and the kernel compile is
> still broken...
>
This patch should fix it.
BTW, I saw
./gas/testsuite/gas.log:FAIL: alpha elf-reloc-8
Have you seen it? Does gcc 3.x work with the new binutils on alpha?
H.J.
----
2003-10-15 H.J. Lu <hongjiu.lu@intel.com>
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't
use the last CIE from a different section.
(_bfd_elf_write_section_eh_frame): Don't pad beyond the raw
size of the output section
--- bfd/elf-eh-frame.c.cross 2003-10-15 12:24:06.000000000 -0700
+++ bfd/elf-eh-frame.c 2003-10-15 22:24:24.000000000 -0700
@@ -372,6 +372,9 @@ _bfd_elf_discard_section_eh_frame
all FDEs. Also, it can be removed if we have removed
all FDEs using it. */
if ((!info->relocatable
+ && hdr_info->last_cie_sec
+ && (sec->output_section
+ == hdr_info->last_cie_sec->output_section)
&& cie_compare (&cie, &hdr_info->last_cie) == 0)
|| cie_usage_count == 0)
{
@@ -1031,7 +1034,11 @@ _bfd_elf_write_section_eh_frame (bfd *ab
unsigned int alignment = 1 << sec->alignment_power;
unsigned int pad = sec->_cooked_size % alignment;
- if (pad)
+ /* Don't pad beyond the raw size of the output section. It
+ can happen at the last input section. */
+ if (pad
+ && ((sec->output_offset + sec->_cooked_size + pad)
+ <= sec->output_section->_raw_size))
{
/* Find the last CIE/FDE. */
for (i = sec_info->count - 1; i > 0; i--)