Open Quuxplusone opened 6 years ago
Here's a better link: https://gcc.gnu.org/legacy-ml/gcc-patches/2018-10/msg02079.html
_Bug 49902 has been marked as a duplicate of this bug._
This feature exists in GCC since version 11:
-fzero-call-used-regs=[skip|used-gpr|all-gpr|used|all]
The kernel supports the use of =used-gpr since v5.15 as CONFIG_ZERO_CALL_USED_REGS:
GCC has added ways of specifying that certain registers should be zero'd upon function return. I believe this is to help cut down on gadgets used in ROP chains. Is this something that could be added in Clang?
https://github.com/clearlinux-pkgs/gcc/blob/master/zero-regs-gcc8.patch