Gas emits error on open CFI at EOF.
The assembler now errors out if a .cfi_startproc directive is missing a corresponding .cfi_endproc at the end of the input file.
The assembler now detects an open CFI (Call Frame Information) at the end of the file, which occurs when a .cfi_startproc directive is present without a matching .cfi_endproc. Instead of crashing, the assembler emits an error message and sets the DWARF FDE (Frame Description Entry) end address to its start address, preventing potential issues during stack trace generation.
In Details
The GNU assembler (gas) generates .sframe sections, which are used for stack unwinding. This commit modifies gas/gen-sframe.c to handle the case where a DWARF FDE (Frame Description Entry) is left open at the end of the file. The fix mirrors the existing behaviour for .eh_frame and .debug_frame sections. This commit addresses PR/gas 34026.
For Context
The GNU assembler (gas) translates assembly code into machine code. During this process, it generates metadata describing the program's structure, including call frame information (CFI). CFI is crucial for debuggers and exception handling routines to unwind the stack and determine the program's call history. This commit ensures that the assembler correctly handles incomplete CFI directives, preventing crashes and providing more informative error messages.