bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/2655] New: Incorrrect padding for .eh_frame section


From: hjl at lucon dot org
Subject: [Bug ld/2655] New: Incorrrect padding for .eh_frame section
Date: 12 May 2006 05:12:02 -0000

_bfd_elf_write_section_eh_frame has

    {
      unsigned int alignment = 1 << sec->alignment_power;
      unsigned int pad = sec->size % alignment;

      /* 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->size + pad)
              <= sec->output_section->size))
        {
          bfd_byte *buf;
          unsigned int new_size;

          /* Find the last CIE/FDE.  */
          ent = sec_info->entry + sec_info->count;
          while (--ent != sec_info->entry)
            if (!ent->removed)
              break;

          /* The size of the last CIE/FDE must be at least 4.  */
          if (ent->removed || ent->size < 4)
            abort ();

          pad = alignment - pad;
          buf = contents + ent->new_offset - sec->output_offset;
          new_size = size_of_output_cie_fde (ent, ptr_size);

          /* Pad it with DW_CFA_nop  */
          memset (buf + new_size, 0, pad);
          bfd_put_32 (abfd, new_size + pad - 4, buf);

          sec->size += pad;
        }
    }

It pads the current .eh_frame section to its section alignment. If the next
.eh_frame section has a different alignment, padding will be wrong. In the
case of x86-64, most of .eh_frame sections have 8 byte aligment. But the
last one in crtend.o from gcc has 4 byte alignment. As the result, the
last zero terminator may become the part of the previous FDE due to incorrect
padding.

-- 
           Summary: Incorrrect padding for .eh_frame section
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: hjl at lucon dot org
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=2655

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]