[PATCH] CFI directives for GAS

Michal Ludvig mludvig@suse.cz
Thu May 15 16:08:00 GMT 2003


Hi all,
the attached patch introduces some new pseudo-ops for easier generating 
of Dwarf2 CFI unwind info. This is especially needed for unwinding over 
hand-written assembler routines on amd64 target, where no standard 
prologues are used.

Supported directives are for now:
.cfi_verbose [1|0] - enable/disable verbose mode. 'as' will print out
     the .eh_frame contents during it's generation. Or use --verbose
     switch to 'as' command.

.cfi_startproc - use at the beginning of each function. It initializes
     some internal data structures and emits initial CFI
     instructions.

.cfi_endproc - opens .eh_frame, generates appropriate binary structures
     (CIE, FDE) and sets up relocation records.

.cfi_def_cfa <reg>,<imm> - set a rule for computing CFA to: take content
     of register <reg> and add <imm> to it.

.cfi_def_cfa_register <reg> - change rule for CFA to use <reg>. Offset
     remains the same.

.cfi_def_cfa_offset <imm> - change rule for CFA to use offset <imm>.
     Register remains the same.

.cfi_adjust_cfa_offset <imm> - Like the previous one but <imm> is a
     relative value that will be added to current offset instead of
     an absolute value as in .cfi_def_cfa_offset.

.cfi_offset <reg>,<imm> - Generate rule saying that register <reg> is
     saved at offset <imm> from CFA.

Side note: CFA_advance_loc* macros are used automatically if needed 
whenever a .cfi_* directive is met. So don't care about them :-)

For now the architectures that have these new directives enabled are 
i386 and amd64.

Commented example on the usage can be found here:
http://www.logix.cz/~mic/devel/gas-cfi/example.s.html

How do you like this idea? Any comments? Can I apply the patch?

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gas-cfi-10.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20030515/ef3ccf11/attachment.ksh>


More information about the Binutils mailing list