i386: add CFI macros for stack manipulation
PATCH 1/2 i386: add CFI macros for stack manipulation
Add macros to dwarf2.h to simplify pushing and popping stack variables.
include/asm-i386/dwarf2.h +23 -1
@@ -51,4 +51,26 @@#endif -#endif +.macro CFI_pushl val + pushl \val + CFI_ADJUST_CFA_OFFSET 4 +.endm + +.macro CFI_pushl_reg reg + pushl %\reg + CFI_ADJUST_CFA_OFFSET 4 + CFI_REL_OFFSET \reg, 0 +.endm + +.macro CFI_popl val + popl \val + CFI_ADJUST_CFA_OFFSET -4 +.endm + +.macro CFI_popl_reg reg + popl %\reg + CFI_ADJUST_CFA_OFFSET -4 + CFI_RESTORE \reg +.endm + +#endif /* _DWARF2_H */
Signature · 1 line
Chuck
Quoted 2 lines · Chuck Ebbert
Add macros to
dwarf2.hto simplify pushing and popping stack variables.
I feared someone would do that patch. I've thought about it myself.
However it's not a good idea. I've already had complaints that some code in x86-64 is too hard to read/debug because it uses too many macros. I think it's better if the core core still uses "real" instructions and keep the CFI_* stuff as annotation that most people can just ignore.
With your change that wouldn't be the case and everybody hacking the code would need to know all of CFI too, which is still quite arcane stuff.
So while it would make the source shorter and require less typing I don't think it's good for readability.
What would be a good thing if someone could write it up would be a short tutorial for Documentation/* on CFI
-Andi