]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
debug: Add BTF_WITH_CORE_DEBUG debug format
authorIndu Bhagat <indu.bhagat@oracle.com>
Tue, 7 Sep 2021 18:16:53 +0000 (11:16 -0700)
committerIndu Bhagat <indu.bhagat@oracle.com>
Tue, 7 Sep 2021 18:16:53 +0000 (11:16 -0700)
To best handle BTF/CO-RE in GCC, a distinct BTF_WITH_CORE_DEBUG debug format is
being added.  This helps the compiler detect whether BTF with CO-RE relocations
needs to be emitted.

gcc/ChangeLog:

* flag-types.h (enum debug_info_type): Add new enum
DINFO_TYPE_BTF_WITH_CORE.
(BTF_WITH_CORE_DEBUG): New bitmask.
* flags.h (btf_with_core_debuginfo_p): New declaration.
* opts.c (btf_with_core_debuginfo_p): New definition.

gcc/flag-types.h
gcc/flags.h
gcc/opts.c

index 4fb1cb4743d6be48dadc83682e174cf88892cedd..cc41b2ae1034c4f99c7d9c5cbcfa38a43695b9dc 100644 (file)
@@ -31,7 +31,8 @@ enum debug_info_type
   DINFO_TYPE_VMS = 4,            /* VMS debug info.  */
   DINFO_TYPE_CTF = 5,            /* CTF debug info.  */
   DINFO_TYPE_BTF = 6,            /* BTF debug info.  */
-  DINFO_TYPE_MAX = DINFO_TYPE_BTF /* Marker only.  */
+  DINFO_TYPE_BTF_WITH_CORE = 7,          /* BTF debug info with CO-RE relocations.  */
+  DINFO_TYPE_MAX = DINFO_TYPE_BTF_WITH_CORE /* Marker only.  */
 };
 
 #define NO_DEBUG      (0U)
@@ -47,6 +48,9 @@ enum debug_info_type
 #define CTF_DEBUG     (1U << DINFO_TYPE_CTF)
 /* Write BTF debug info (using btfout.c).  */
 #define BTF_DEBUG     (1U << DINFO_TYPE_BTF)
+/* Write BTF debug info for BPF CO-RE usecase (using btfout.c).  */
+#define BTF_WITH_CORE_DEBUG     (1U << DINFO_TYPE_BTF_WITH_CORE)
+
 /* Note: Adding new definitions to handle -combination- of debug formats,
    like VMS_AND_DWARF2_DEBUG is not recommended.  This definition remains
    here for historical reasons.  */
index afedef0abeacb231ef7ed16c2fa34a5a49013545..af61bcd613bdabe02d08379a673f4d9be4ce0cba 100644 (file)
@@ -44,6 +44,10 @@ const char * debug_set_names (uint32_t w_symbols);
 
 extern bool btf_debuginfo_p ();
 
+/* Return true iff BTF with CO-RE debug info is enabled.  */
+
+extern bool btf_with_core_debuginfo_p ();
+
 /* Return true iff CTF debug info is enabled.  */
 
 extern bool ctf_debuginfo_p ();
index e0501551ef5ada7ce33444d443113f62eef01704..1d2d22d7a3fd586de1bed7d4da9da71152d878ee 100644 (file)
@@ -135,6 +135,14 @@ btf_debuginfo_p ()
   return (write_symbols & BTF_DEBUG);
 }
 
+/* Return TRUE iff BTF with CO-RE debug info is enabled.  */
+
+bool
+btf_with_core_debuginfo_p ()
+{
+  return (write_symbols & BTF_WITH_CORE_DEBUG);
+}
+
 /* Return TRUE iff CTF debug info is enabled.  */
 
 bool