aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2020-05-19 11:46:40 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:03:46 -0300
commit72f70c10c4f8ed0e247be28958eb8b5da50eea69 (patch)
treeeef12478a4b862980f83bb59f077cbaba1ff37f5 /gcc/tree-inline.c
parent9b39b5c256e699b377bce274a4c3db8f4c6397eb (diff)
downloadgcc-72f70c10c4f8ed0e247be28958eb8b5da50eea69.zip
gcc-72f70c10c4f8ed0e247be28958eb8b5da50eea69.tar.gz
gcc-72f70c10c4f8ed0e247be28958eb8b5da50eea69.tar.bz2
bpf: do not save/restore callee-saved registers in function prolog/epilog
BPF considers that every call to a function allocates a fresh set of registers that are available to the callee, of which the first five may have bee initialized with the function arguments. This is implemented by both interpreter and JIT in the Linux kernel. This is enforced by the kernel BPF verifier, which will reject any code in which non-initialized registers are accessed before being written. Consequently, the spill instructions generated in function prologue were causing the verifier to reject our compiled programs. This patch makes GCC to not save/restore callee-saved registers in function prologue/epilogue, unless xBPF mode is enabled. 2020-05-19 Jose E. Marchesi <jose.marchesi@oracle.com> gcc/ * config/bpf/bpf.c (bpf_compute_frame_layout): Include space for callee saved registers only in xBPF. (bpf_expand_prologue): Save callee saved registers only in xBPF. (bpf_expand_epilogue): Likewise for restoring. * doc/invoke.texi (eBPF Options): Document this is activated by -mxbpf. gcc/testsuite/ * gcc.target/bpf/xbpf-callee-saved-regs-1.c: New test. * gcc.target/bpf/xbpf-callee-saved-regs-2.c: Likewise.
Diffstat (limited to 'gcc/tree-inline.c')
0 files changed, 0 insertions, 0 deletions