From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id B6B2E3850416 for ; Mon, 21 Jun 2021 13:53:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6B2E3850416 Received: by mail-ed1-x532.google.com with SMTP id n20so19066845edv.8 for ; Mon, 21 Jun 2021 06:53:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dtGIN53LlCGUmciIP2LQXMbSL4HfeIDK6ToJFQtOIEY=; b=ufgm1LpjB/gAieiKDZ7Z9xDrWrhqsQJqA+YkXb3Rd6MIKDQRFzeEBcD6hs781d7Ami Imub3lG/v2mVsCJu6VpykLbMqOTIEURrovjWs9My63K2TTQ+kQu1NMhBWLM/RcxLFhmY 3KUoDF5+hMqEWzjdCWFLps0vW7SthnQpprQOwFWrSrH7MfhRGwQ9c009o5r3Q0XJYVOK q2dwCa1o/coWWxneNLo/4fbRCegAj5Wv/VluKhpjbU1LWi+8Jp4cZ3gm4Jnya9pamX/B MTixLx0fgZx9nEwY06lFMeRTP3NK4ibE6NS0U3nM36vAxMtyNMQPxlBTqnXf9clUZSiq 6YZQ== X-Gm-Message-State: AOAM531eZdcZJJyk/azNKOKjzBCx1FpJqQkptwPbr1lGkJ2rdheILSI+ vxpdymOgyqt7lI2JTEvKE5NZ0W/POfRnGLaE4Nc= X-Google-Smtp-Source: ABdhPJwXNFR3baru0PSTIQ+dN2n7BV2sPeq/1YuuyEuGC+X+bV7rvk5Jzb3VMLoQI6TDfhAAoo2MuK9fGwRsQicEuWM= X-Received: by 2002:a05:6402:2913:: with SMTP id ee19mr12145266edb.361.1624283607828; Mon, 21 Jun 2021 06:53:27 -0700 (PDT) MIME-Version: 1.0 References: <20210531165802.5686-1-jose.marchesi@oracle.com> <20210531165802.5686-7-jose.marchesi@oracle.com> In-Reply-To: <20210531165802.5686-7-jose.marchesi@oracle.com> From: Richard Biener Date: Mon, 21 Jun 2021 15:53:17 +0200 Message-ID: Subject: Re: [[PATCH V9] 6/7] Enable BTF generation in the BPF backend To: "Jose E. Marchesi" Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2021 13:53:30 -0000 On Mon, May 31, 2021 at 7:18 PM Jose E. Marchesi via Gcc-patches wrote: > > 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. You want to CC the BPF maintainer here. Note that IIRC RTX_FRAME_RELATED_P also prevents code-motion for some insns, so I'm not sure removing that is 100% safe. > 2021-05-14 David Faust > > * 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. > --- > gcc/config/bpf/bpf.c | 4 ---- > gcc/config/bpf/bpf.h | 12 ++---------- > 2 files changed, 2 insertions(+), 14 deletions(-) > > diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c > index 126d4a2798d..e635f9edb40 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 4c5b19e262b..55beecbcb36 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. */ > > -- > 2.25.0.2.g232378479e >