bpf: set PREFERRED_DEBUGGING_TYPE to BTF_DEBUG
BTF is the standard debug info used with BPF programs, so it makes sense to default to BTF rather than DWARF. gcc/ * config/bpf/bpf.h (PREFERRED_DEBUGGING_TYPE): Set to BTF_DEBUG. gcc/testsuite/ * gcc.target/bpf/bpf-debug-options-1.c: New test. * gcc.target/bpf/bpf-debug-options-2.c: Likewise. * gcc.target/bpf/bpf-debug-options-3.c: Likewise. * gcc.target/bpf/core-options-4.c: Likewise.
This commit is contained in:
parent
f541757ba4
commit
1604f7cebc
5 changed files with 58 additions and 0 deletions
|
@ -245,6 +245,11 @@ enum reg_class
|
|||
|
||||
/**** Debugging Info ****/
|
||||
|
||||
/* Use BTF debug info by default. */
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE BTF_DEBUG
|
||||
|
||||
/* In eBPF it is not possible to unwind frames. Disable CFA. */
|
||||
|
||||
#define DWARF2_FRAME_INFO 0
|
||||
|
|
17
gcc/testsuite/gcc.target/bpf/bpf-debug-options-1.c
Normal file
17
gcc/testsuite/gcc.target/bpf/bpf-debug-options-1.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* Default to BTF debug info. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-g -dA" }*/
|
||||
|
||||
struct A {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
int
|
||||
foo (struct A *a)
|
||||
{
|
||||
return a->x;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-not "DWARF version" } } */
|
||||
/* { dg-final { scan-assembler "btf_version" } } */
|
18
gcc/testsuite/gcc.target/bpf/bpf-debug-options-2.c
Normal file
18
gcc/testsuite/gcc.target/bpf/bpf-debug-options-2.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* -g defaults to BTF, which in turn implies -mco-re. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-g -dA" }*/
|
||||
|
||||
struct A {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
int
|
||||
foo (struct A *a)
|
||||
{
|
||||
return __builtin_preserve_access_index (a->x);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-not "DWARF version" } } */
|
||||
/* { dg-final { scan-assembler "btf_version" } } */
|
||||
/* { dg-final { scan-assembler "btfext_version" } } */
|
14
gcc/testsuite/gcc.target/bpf/bpf-debug-options-3.c
Normal file
14
gcc/testsuite/gcc.target/bpf/bpf-debug-options-3.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* Using -g does not incorrectly force CO-RE enabled. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-g -dA -mno-co-re" }*/
|
||||
|
||||
struct A {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
int
|
||||
foo (struct A *a)
|
||||
{
|
||||
return __builtin_preserve_access_index (a->x); /* { dg-error "BPF CO-RE is required" } */
|
||||
}
|
4
gcc/testsuite/gcc.target/bpf/core-options-4.c
Normal file
4
gcc/testsuite/gcc.target/bpf/core-options-4.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* -g implies BTF, -gtoggle turns it off. CO-RE should not work. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-g -mco-re -gtoggle" } */
|
||||
/* { dg-excess-errors "BPF CO-RE requires BTF debugging information" } */
|
Loading…
Add table
Reference in a new issue