aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2021-05-20 11:21:39 -0700
committerJose E. Marchesi <jose.marchesi@oracle.com>2021-06-28 18:47:21 +0200
commitd5cf2b5db325fd5c053ca7bc8d6a54a06cd71124 (patch)
tree20263bd75b4a944a9aaf3119caac662a9e450c87 /gcc
parent824a6a52a6c2892c8d4a4a889a425bdaf207634f (diff)
downloadgcc-d5cf2b5db325fd5c053ca7bc8d6a54a06cd71124.zip
gcc-d5cf2b5db325fd5c053ca7bc8d6a54a06cd71124.tar.gz
gcc-d5cf2b5db325fd5c053ca7bc8d6a54a06cd71124.tar.bz2
Enable BTF generation in the BPF backend
This patch changes the BPF GCC backend in order to use the DWARF debug hooks and therefore enables the user to generate BTF debugging information with -gbtf. Generating BTF is crucial when compiling BPF programs, since the CO-RE (compile-once, run-everwhere) mechanism used by the kernel BPF loader relies on it. Note that since in eBPF it is not possible to unwind frames due to the restrictive nature of the target architecture, we are disabling the generation of CFA in this target. 2021-06-28 David Faust <david.faust@oracle.com> * config/bpf/bpf.c (bpf_expand_prologue): Do not mark insns as frame related. (bpf_expand_epilogue): Likewise. * config/bpf/bpf.h (DWARF2_FRAME_INFO): Define to 0. Do not define DBX_DEBUGGING_INFO.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/bpf/bpf.c4
-rw-r--r--gcc/config/bpf/bpf.h12
2 files changed, 2 insertions, 14 deletions
diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c
index 126d4a2..e635f9e 100644
--- a/gcc/config/bpf/bpf.c
+++ b/gcc/config/bpf/bpf.c
@@ -349,7 +349,6 @@ bpf_expand_prologue (void)
hard_frame_pointer_rtx,
fp_offset - 8));
insn = emit_move_insn (mem, gen_rtx_REG (DImode, regno));
- RTX_FRAME_RELATED_P (insn) = 1;
fp_offset -= 8;
}
}
@@ -364,7 +363,6 @@ bpf_expand_prologue (void)
{
insn = emit_move_insn (stack_pointer_rtx,
hard_frame_pointer_rtx);
- RTX_FRAME_RELATED_P (insn) = 1;
if (size > 0)
{
@@ -372,7 +370,6 @@ bpf_expand_prologue (void)
gen_rtx_PLUS (Pmode,
stack_pointer_rtx,
GEN_INT (-size))));
- RTX_FRAME_RELATED_P (insn) = 1;
}
}
}
@@ -412,7 +409,6 @@ bpf_expand_epilogue (void)
hard_frame_pointer_rtx,
fp_offset - 8));
insn = emit_move_insn (gen_rtx_REG (DImode, regno), mem);
- RTX_FRAME_RELATED_P (insn) = 1;
fp_offset -= 8;
}
}
diff --git a/gcc/config/bpf/bpf.h b/gcc/config/bpf/bpf.h
index 80195ce..82be0c3 100644
--- a/gcc/config/bpf/bpf.h
+++ b/gcc/config/bpf/bpf.h
@@ -235,17 +235,9 @@ enum reg_class
/**** Debugging Info ****/
-/* We cannot support DWARF2 because of the limitations of eBPF. */
+/* In eBPF it is not possible to unwind frames. Disable CFA. */
-/* elfos.h insists in using DWARF. Undo that here. */
-#ifdef DWARF2_DEBUGGING_INFO
-# undef DWARF2_DEBUGGING_INFO
-#endif
-#ifdef PREFERRED_DEBUGGING_TYPE
-# undef PREFERRED_DEBUGGING_TYPE
-#endif
-
-#define DBX_DEBUGGING_INFO
+#define DWARF2_FRAME_INFO 0
/**** Stack Layout and Calling Conventions. */