This commit bumps the maximum stack frame size allowed for BPF
functions to the maximum possible value.
Tested in x86_64-linux-gnu host and target bpf-unknown-none.
gcc/ChangeLog
* config/bpf/bpf.opt (mframe-limit): Set default to 32767.
gcc/testsuite/ChangeLog
* gcc.target/bpf/frame-limit-1.c: New test.
* gcc.target/bpf/frame-limit-2.c: Likewise.
Generate little-endian eBPF.
mframe-limit=
-Target Joined RejectNegative UInteger IntegerRange(0, 32767) Var(bpf_frame_limit) Init(512)
+Target Joined RejectNegative UInteger IntegerRange(0, 32767) Var(bpf_frame_limit) Init(32767)
Set a hard limit for the size of each stack frame, in bytes.
mco-re
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+/* The stack frame size is limited to 32767 bytes. */
+
+int
+foo ()
+{
+ long data[4095];
+ return 0;
+}
+
+int
+bar ()
+{
+ long data[4096];
+ return 0;
+} /* { dg-error "stack limit" } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O0 -mframe-limit=256" } */
+
+int
+foo ()
+{
+ long data[32];
+ return 0;
+}
+
+int
+bar ()
+{
+ long data[33];
+ return 0;
+} /* { dg-error "stack limit" } */