From patchwork Thu Aug 5 00:50:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 1513669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Iw3Ig7s0; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gg96y2cVYz9sRR for ; Thu, 5 Aug 2021 10:52:10 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACB39398242C for ; Thu, 5 Aug 2021 00:52:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACB39398242C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1628124726; bh=K8VI+A31lPVdTCxpdkqKO8e+G+zyolF/UyhGstw50RQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Iw3Ig7s0r7ar43DEm1dDA554oy2OrGXGmMOjgYGD6uFYxEJVlgkYr+Sz5HZ0sa+aT oetP1Fl/HXf09tQLHmksw/+xcBVj4ji0PVAxRPm13sJxjqqkybrO+RkZ5DvjdzcaeP Ep+IxZHU6Wa4pjxU/lvLIjLvzQdCs0qqRHYOkQxc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 37383385700B for ; Thu, 5 Aug 2021 00:50:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 37383385700B Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1750fNlr001733 for ; Thu, 5 Aug 2021 00:50:42 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3a7cxn30qk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 05 Aug 2021 00:50:42 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1750oAFR189052 for ; Thu, 5 Aug 2021 00:50:41 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by aserp3030.oracle.com with ESMTP id 3a78d7nnn4-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 05 Aug 2021 00:50:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RG1czJ1v3EHzA0L+vw/ra0V3TxXzh+nsVlou/lolJxh/A3biL38WzfLSQxFLhGIeuOcpZsayCcZDycgWGQShYvdf510Dj7h8BMm/nkLMu94mF8RLnSyDTqWk1YtTeuadu7Zc2z28VD/CuHOcxs34q61y+LO3r+ioIIERc0deagvNlrZVPxl6mrisUjDL7RK5FwgDXpvie2n3odC3XbdpAYUrkwfaIKUza3BSj1Drxc+zm6Ml7SnhAr4mipLVYZKwC6EUTP1HXtfxZTbK8vnEPPYiMGAEbX9uvW271yYfmJkT7cZSKX/cNc5iHpe8ArXV45Pshs+zSYvn5qqjsYP3mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K8VI+A31lPVdTCxpdkqKO8e+G+zyolF/UyhGstw50RQ=; b=LbEnL/J5OIqaEt4pXnRP5GURK2VoSawu9MyfoPd3EOcb/xiK0+HWATJD/UPkRB4h0SXXmabIngvaqLEtCnEyTHyCPT3WhgXhsgXjOFQxbJ1yv+vNDV1c7yD8gd+eD0TdASrUVfTpLRH06jLopeqMbNbndAQw52KZNsaGC3KMhh1jrsZPcSN+OHGvGUx0s5tILSC1NRbYkq5yirBCFyM6V2F+T1wbznlqZoS+SjaazR6OrzRlxaWW+REFdj+L+H7AnikzZa4qyNzGK5+zoNNOs5l0ziogT5C4KxX1vTnron5SAMgH9ahSckCBqQsDug4C8GgLKGHTbtD8lmnjpeClFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by MWHPR10MB1887.namprd10.prod.outlook.com (2603:10b6:300:10b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16; Thu, 5 Aug 2021 00:50:39 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::c9ba:5127:fa3f:45cb]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::c9ba:5127:fa3f:45cb%4]) with mapi id 15.20.4373.026; Thu, 5 Aug 2021 00:50:39 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH, V2 2/3] targhooks: New target hook for CTF/BTF debug info emission Date: Wed, 4 Aug 2021 17:50:27 -0700 Message-Id: <1628124628-28706-3-git-send-email-indu.bhagat@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1628124628-28706-1-git-send-email-indu.bhagat@oracle.com> References: <1628124628-28706-1-git-send-email-indu.bhagat@oracle.com> X-ClientProxiedBy: MWHPR20CA0001.namprd20.prod.outlook.com (2603:10b6:300:13d::11) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ibhagatpc.hitronhub.home (24.80.24.133) by MWHPR20CA0001.namprd20.prod.outlook.com (2603:10b6:300:13d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Thu, 5 Aug 2021 00:50:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2931da5-1710-445d-b257-08d957ab0b3d X-MS-TrafficTypeDiagnostic: MWHPR10MB1887: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kHh5EoWPSYMFi0kka8OsQ4I2uNdwMcKPoDHkeC1A4iTHF0AL/RoHDZQwYGPs5WHLa4YhoOODuvgFLoyQ4aemE53Fvl4b7r+2OysQ5FATgR7B6fgIMwQe+9fkB/bOLa326/y83b5xSy9Gh4foLTsSnHI0aLvS61/lY9jX1zo7aMrXacNkPL8r6XVIL9JeACi4DV0QHXK5MchArqnQkYe3OsLZFVLS0KRR3Lw1/KrFajqhWn5d4+oP6LLlUMxRRHHHkGjKhTN7MrVGVht082MUJtOOfSnJbEPKeF2SERVlMXQp1O0dk5ibPKmGb2URotXiNXRdtXZrQsdVfgeXSKEZPmLNMxDFffAcyd0uD1KfIrptu6/i7gPJqqQkCnDAhlwxX4wQqBvPkGmMcbsywrhK/9WVqKmmh+IQd26XJiWDXhm1gPSlbysonQENjl4fHvsBkDxU9hNxvDEI/bTcFihFVJEr4b+400x+XhlwxaCosSlaRixUATylJI9k4jeSho1Xk8AteP5SkafoPlKjZ3ICs8myaYCo2yap++w0/99Zb8Hdv/de7fwW2vnjnEifewpI+p05yycTbMPkDutWEDigjmzE5VVEIkvTm7AXu6Jq8NLAM5FPua27I2PZhl/s6FBO/wYud6nhsXb8KNiBaWy0+91PjKBe5ObTYQLvc3zb2mUDqBLYp1N7p8nfh6C5vdsYCB9dimIqiwYpU17JvPk8DA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(136003)(366004)(346002)(396003)(39860400002)(6666004)(66946007)(86362001)(66556008)(66476007)(956004)(2616005)(5660300002)(83380400001)(38350700002)(478600001)(38100700002)(36756003)(6512007)(6916009)(8936002)(52116002)(6486002)(26005)(8676002)(6506007)(44832011)(2906002)(186003)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ClwSY/NYLNyuI0Msu9BEaU7pKKDa2WUHF0D0Sn9ztH3vpL5epxWlqsR4KnJBYOwzGeGjGT/yHeMWemrTQuT3c5n+CfS8wKwrK5pG/5CROpBiybYz63NIYOHlUKN8DgX4wPC3RJ2PYq+7G6dmbybcJY2JudaM48aGFlg9IJS3ekzDK5PAMBnQUYfU8Nu92Rodm0OP5FeBbpaMzED83FHDvDuPq5Z3y3O4ehUcoC3yRfTsymEDs0dqRiki5an01EKZA8ovntt/5rM7dB3cvIXRLbXHuDqsqAjP/NHQP29FeODt+/RLVHvq/8wlBp9las7ozYiIR6uQYgEROYd9j2HBgJFq+e3I8lqsUPZDiZy0ckAlAA2oxBi4Yhiw+c4TNNXrNssCPDUMQw9vmWthe/4gu+exa9fTVkQQyZ2vNJwLAQigzfusqFz6eBN7ouqiKkQ5LKE9URfgg471cLpzPoMjLM7+6sTnw1X37mjWkh/9jCK7ts7yqepJeNNMT9bf4gSiYMIzbB50LdnHwP3J7XqHFzB+V32mZ/TOX4McGsogiAPZSAcFcB5MtQ2ftRnZLRijIInn18hJll5FY5ioFH/XJza1G/T3Z2XyUNgq5goHTd20UEnrCCyMlVTM0U0gRbdaKs66a3T2p0gKl8K/2XwAJ//Rwp07gK4s/hShXQUYteQKi1OgD8GA4xWx5Wph75zvbbxETTMFjNZLsD4xyVstejuXI34bi3FcO7nPLQGWPugcLtLgjNUXYtWCLsSQiS5eDULuGvwloXaZLJ+hXr5BuKUoe+AUTLEY+8511KcbU2nKUEvSQGVJbk1jPwqehovtMr6h15JnctCdiwha0FnvWBSF+GVKqPONW4Qv6HWVbmPIJcHoVgEdFDRwuhvX8bk1ny8zVoaEPpZtL0tOGHfw34Q+RbxPOZ2OcMlSEFBgksdpLiexknlV5hhW7tEubO/rD4EeMVuwewBTTXZaob3h+aoKnYt60zJ69N6CTZ79A/mJdPIUb1j9NTFUAojHqnv+UlpTu7psSG6E8yf0z/5xO6ICb+4KOcUwkA6tDWW/wkeuwlmh2AQNkYuyXKcyU1R9YCICrMemarWSW6T08jSShsbzxXv4m5/+6XqrfJ8V5S070gMXWqhe6dpHCm/9AFUu/LCImKVI26euEiKlg7FI/gNYW3moWI3usrg5wY6YiniRGoMlhQbFDvZSVicLViOtOZH8Mdy/ZqFUmSzvK/RvP6bjcu8WQ3rAIHtuIYfIppoqgXQlSCrUiP8UoFSmlmMTcH8/+/ZitIAf4cPhJeD9V09a3ILXr+N6kO2/grEH0zuo9eeDeqJgFNOLTb+y6r6r X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2931da5-1710-445d-b257-08d957ab0b3d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2021 00:50:39.0981 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VL55YBqTnhKThubmn86+VFqfUu2NEf+fLqix3b3XRco/nxA0gpzTDrkXgCU2MNcbNKFEzKYPreABQtiVvr21gA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1887 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10066 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108050005 X-Proofpoint-GUID: qpbP0rZVnkPZ7XXDlCVNZCvJQCH0G6LG X-Proofpoint-ORIG-GUID: qpbP0rZVnkPZ7XXDlCVNZCvJQCH0G6LG X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: Indu Bhagat via Gcc-patches From: Indu Bhagat Reply-To: Indu Bhagat Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch adds a new target hook to detect if the CTF container can allow the emission of CTF/BTF debug info at DWARF debug info early finish time. Some backends, e.g., BPF when generating code for CO-RE usecase, may need to emit the CTF/BTF debug info sections around the time when late DWARF debug is finalized (dwarf2out_finish). gcc/ChangeLog: * config/bpf/bpf.c (ctfc_debuginfo_early_finish_p): New definition. (TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P): Undefine and override. * doc/tm.texi: Regenerated. * doc/tm.texi.in: Document the new hook. * target.def: Add a new hook. * targhooks.c (default_ctfc_debuginfo_early_finish_p): Likewise. * targhooks.h (default_ctfc_debuginfo_early_finish_p): Likewise. --- gcc/config/bpf/bpf.c | 14 ++++++++++++++ gcc/doc/tm.texi | 6 ++++++ gcc/doc/tm.texi.in | 2 ++ gcc/target.def | 10 ++++++++++ gcc/targhooks.c | 6 ++++++ gcc/targhooks.h | 2 ++ 6 files changed, 40 insertions(+) diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c index 028013e..85f6b76 100644 --- a/gcc/config/bpf/bpf.c +++ b/gcc/config/bpf/bpf.c @@ -178,6 +178,20 @@ bpf_option_override (void) #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE bpf_option_override +/* Return FALSE iff -mcore has been specified. */ + +static bool +ctfc_debuginfo_early_finish_p (void) +{ + if (TARGET_BPF_CORE) + return false; + else + return true; +} + +#undef TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P +#define TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P ctfc_debuginfo_early_finish_p + /* Define target-specific CPP macros. This function in used in the definition of TARGET_CPU_CPP_BUILTINS in bpf.h */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index cb01528..2d5ff05 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -10400,6 +10400,12 @@ Define this macro if GCC should produce debugging output in BTF debug format in response to the @option{-gbtf} option. @end defmac +@deftypefn {Target Hook} bool TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P (void) +This target hook returns nonzero if the CTF Container can allow the + emission of the CTF/BTF debug info at the DWARF debuginfo early finish + time. +@end deftypefn + @node Floating Point @section Cross Compilation and Floating Point @cindex cross compilation and floating point diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 4a522ae..05b3c2c 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -7020,6 +7020,8 @@ Define this macro if GCC should produce debugging output in BTF debug format in response to the @option{-gbtf} option. @end defmac +@hook TARGET_CTFC_DEBUGINFO_EARLY_FINISH_P + @node Floating Point @section Cross Compilation and Floating Point @cindex cross compilation and floating point diff --git a/gcc/target.def b/gcc/target.def index 68a46aa..44e2251 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -4016,6 +4016,16 @@ clobbered parts of a register altering the frame register size", machine_mode, (int regno), default_dwarf_frame_reg_mode) +/* Return nonzero if CTF Container can finalize the CTF/BTF emission + at DWARF debuginfo early finish time. */ +DEFHOOK +(ctfc_debuginfo_early_finish_p, + "This target hook returns nonzero if the CTF Container can allow the\n\ + emission of the CTF/BTF debug info at the DWARF debuginfo early finish\n\ + time.", + bool, (void), + default_ctfc_debuginfo_early_finish_p) + /* If expand_builtin_init_dwarf_reg_sizes needs to fill in table entries not corresponding directly to registers below FIRST_PSEUDO_REGISTER, this hook should generate the necessary diff --git a/gcc/targhooks.c b/gcc/targhooks.c index eb51909..e38566c 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -2112,6 +2112,12 @@ default_dwarf_frame_reg_mode (int regno) return save_mode; } +bool +default_ctfc_debuginfo_early_finish_p (void) +{ + return true; +} + /* To be used by targets where reg_raw_mode doesn't return the right mode for registers used in apply_builtin_return and apply_builtin_arg. */ diff --git a/gcc/targhooks.h b/gcc/targhooks.h index f92e102..55dc443 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -255,6 +255,8 @@ extern unsigned int default_dwarf_poly_indeterminate_value (unsigned int, unsigned int *, int *); extern machine_mode default_dwarf_frame_reg_mode (int); +extern bool default_ctfc_debuginfo_early_finish_p (void); + extern fixed_size_mode default_get_reg_raw_mode (int); extern bool default_keep_leaf_when_profiled ();