public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Indu Bhagat <ibhagat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-3389] debug: Add BTF_WITH_CORE_DEBUG debug format
Date: Tue,  7 Sep 2021 18:21:05 +0000 (GMT)	[thread overview]
Message-ID: <20210907182105.5DCF43858039@sourceware.org> (raw)

https://gcc.gnu.org/g:053db9a49b00d422cd735bee4c0939b7ff07c40e

commit r12-3389-g053db9a49b00d422cd735bee4c0939b7ff07c40e
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date:   Tue Sep 7 11:16:53 2021 -0700

    debug: Add BTF_WITH_CORE_DEBUG debug format
    
    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.

Diff:
---
 gcc/flag-types.h | 6 +++++-
 gcc/flags.h      | 4 ++++
 gcc/opts.c       | 8 ++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index 4fb1cb4743d..cc41b2ae103 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -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.  */
diff --git a/gcc/flags.h b/gcc/flags.h
index afedef0abea..af61bcd613b 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -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 ();
diff --git a/gcc/opts.c b/gcc/opts.c
index e0501551ef5..1d2d22d7a3f 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -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


                 reply	other threads:[~2021-09-07 18:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210907182105.5DCF43858039@sourceware.org \
    --to=ibhagat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).