(Ping and changelog fix) On Tue, Mar 22, 2016 at 11:15 AM, Marcos Díaz <marcos.d...@tallertechnologies.com> wrote: > Hi, > the attached patch adds a new attribute 'security_sensitive' for functions. > The idea was discussed in PR middle-end/69976. > This attribute makes gcc to emit clean up code at the function's epilogue. > This clean-up code cleans the stack used by this function and that isn't > needed anymore. It also cleans used registers. It only works in x86_64. > Please, review the discussion here: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69976 > since we had some doubts with the implementation. > > We also added some test-cases and ran all tests in x86_64. > We think this isn't a bug-fix but a new feature. > > Changelog > 2016-03-21 Marcos Diaz <marcos.d...@tallertechnologies.com> > Andres Tiraboschi <andres.tirabos...@tallertechnologies.com> > > PR tree-optimization/69820 This line should've been PR middle-end/69976 > * config/i386/i386-protos.h: Add ix86_clear_regs_emit and > ix86_sec_sensitive_attr_p > * config/i386/i386.c: (ix86_sec_sensitive_attr_p): New function > (ix86_using_red_zone): now take into account if the function has the new > attribute. > (is_preserved_reg): New function. > (is_integer_reg): New function. > (is_used_as_ret): New function. > (reg_to_string): New function. > (clear_reg_emit): New function. > (ix86_clear_regs_emit): New function. > (ix86_expand_epilogue): Added code to emit clean up code only when > security_sensitive attribute is set. > (ix86_handle_security_sensitive_attribute): New function. > (ix86_attribute_table): Added new attribute. > * config/i386/i386.md: (UNSPECV_CLRSTACK): New unspecv. > (UNSPECV_CLRREGS): New unspecv. > (return): Conditionally emit cleaning regs code. > (simple_return): Likewise > (clear_regs): New insn. > (clear_stack): New insn. > * doc/extend.texi: Added description for new security_sensitive attribute.
Changelog 2016-03-21 Marcos Diaz <marcos.d...@tallertechnologies.com> Andres Tiraboschi <andres.tirabos...@tallertechnologies.com> PR middle-end/69976 * config/i386/i386-protos.h: Add ix86_clear_regs_emit and ix86_sec_sensitive_attr_p * config/i386/i386.c: (ix86_sec_sensitive_attr_p): New function (ix86_using_red_zone): now take into account if the function has the new attribute. (is_preserved_reg): New function. (is_integer_reg): New function. (is_used_as_ret): New function. (reg_to_string): New function. (clear_reg_emit): New function. (ix86_clear_regs_emit): New function. (ix86_expand_epilogue): Added code to emit clean up code only when security_sensitive attribute is set. (ix86_handle_security_sensitive_attribute): New function. (ix86_attribute_table): Added new attribute. * config/i386/i386.md: (UNSPECV_CLRSTACK): New unspecv. (UNSPECV_CLRREGS): New unspecv. (return): Conditionally emit cleaning regs code. (simple_return): Likewise (clear_regs): New insn. (clear_stack): New insn. * doc/extend.texi: Added description for new security_sensitive attribute.