https://sourceware.org/bugzilla/show_bug.cgi?id=34887

            Bug ID: 34887
           Summary: bjdump --dwarf=frames: .eh_frame CIE ID and CIE
                    pointer read as 8 bytes after a 64-bit length
           Product: binutils
           Version: 2.47
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: i at mi11ion dot io
  Target Milestone: ---
              Host: aarch64-apple-darwin

Created attachment 17206
  --> https://sourceware.org/bugzilla/attachment.cgi?id=17206&action=edit
dwarf64.o (+ .s): Mach-O object whose __eh_frame CIE and FDE use 64-bit
lengths; dwarf32.o: same with 32-bit length

Environment: GNU objdump (GNU Binutils) 2.47.20260726, Homebrew binutils 2.47
on macOS 27.0.1 (arm64). The code is unchanged on master at 1c79f853160d.

Reproducer: the attached eh-frame-64.tar.gz holds dwarf64.o (504 bytes, Mach-O
arm64 object, assembled from dwarf64.s with "as -arch arm64"). Its .eh_frame is
64 bytes: a CIE and an FDE, each with Length 0xffffffff and an 8-byte Extended
Length, then the 4-byte CIE ID / CIE pointer:

  ff ff ff ff  0c 00 00 00  00 00 00 00  00 00 00 00
  01 00 01 78  1e 0c 1f 00  ff ff ff ff  1c 00 00 00
  00 00 00 00  24 00 00 00  00 10 00 00  00 00 00 00
  40 00 00 00  00 00 00 00  44 0e 10 00  00 00 00 00

dwarf32.o holds the same records with 32-bit lengths, and objdump prints them
as expected.

Command: objdump --dwarf=frames dwarf64.o

Actual:

  00000000 000000000000000c 7801000100000000 FDE cie=invalid 
pc=0000000000000000..0000000000000000

  00000018 000000000000001c 0000100000000024 FDE cie=invalid 
pc=0000004000000000..00100e8400000000
    DW_CFA_nop
    DW_CFA_nop
    DW_CFA_nop
    DW_CFA_nop

with "Warning: Encoded value extends past end of section".

Expected:

  00000000 000000000000000c 00000000 CIE
    Version:               1
    Augmentation:          ""
    Code alignment factor: 1
    Data alignment factor: -8
    Return address column: 30

    DW_CFA_def_cfa: r31 (sp) ofs 0

  00000018 000000000000001c 00000024 FDE cie=00000000
pc=0000000000001000..0000000000001040
    DW_CFA_advance_loc: 4 to 0000000000001004
    DW_CFA_def_cfa_offset: 16
    DW_CFA_nop
    ...

llvm-dwarfdump --eh-frame prints this CIE and FDE (pc=00001000...00001040), and
the macOS libunwind accepts the FDE through __register_frame with the range
0x1000..0x1040.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to