From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id A34773983C4D for ; Fri, 30 Jul 2021 20:12:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A34773983C4D Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16UKBmHr004656 for ; Fri, 30 Jul 2021 20:12:57 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3a3uujbt00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 30 Jul 2021 20:12:57 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 16UKB5ww003823 for ; Fri, 30 Jul 2021 20:12:56 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2042.outbound.protection.outlook.com [104.47.74.42]) by userp3030.oracle.com with ESMTP id 3a235a6a5u-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 30 Jul 2021 20:12:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VPif0nwx+Oq0SD0mFwyMWciDU+UMskijWef1rhuc/tH25w+L6fB6qS1cApyfiGe/eTVNKt6BKaTP7YpdkLGyVebSIQUB5BTd4ix6WAtQwc3mhmWN7MqeHI/bV7S/WHDGuklAzVxLoaRbCgZ/JxS1aQZ19abC+L8gI+mE6k3TSQRKH2FbM8gf2P0wnXO7hftbrR2oqDKGDnRD7lqIPMjLHkdHJA8dywr4vwHrMglpNpJ0Gqm0b56zKUUK7bvY+OspZU1LIg4o2fe4568kBAWNMpL2eCMpRx4tM96VMHaVHgHOoPKTJnorU9VRlKwfxMdIRrNMQC/cZYYjAE4ioQxv7Q== 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=oVxDawwOjQ6gGWUHDzFuf+US8iggOewFtbjNASdw64g=; b=UW4sCsh9HHf0oAUu0O6dgCrZWW+R136endHWm5jB7IHJjNUhoB9MyewT17VjSZzWRZTw1+HGOWJAk5Z1zvZ0dvIELcniei/npksDEv+l/GbezWBDJ4rpdNX933uJUauvGvvQEPwrFYURyt9Kz/qnd7uKi6GsKubOXPvbK6sKRnBlpO7Ov7F0aUj4CUTrdjHUwamiw1RHl5PHmJqO71Gug+jTerwX5cKcqAXm/+SlJ9ekO9Usj/ztZe/6j7dhzEYnPvtILjl33Z7qIGiQz9B7che79nMVdzJeFQVRXucK8ex+bH/L2EO6vLg/3rK/+VaAAKRgwvbZfgoW7y+7uhPAMg== 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 CO1PR10MB4689.namprd10.prod.outlook.com (2603:10b6:303:98::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.17; Fri, 30 Jul 2021 20:12:50 +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.4352.033; Fri, 30 Jul 2021 20:12:50 +0000 From: Indu Bhagat To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/3] targhooks: New target hook for CTF/BTF debug info emission Date: Fri, 30 Jul 2021 13:12:38 -0700 Message-Id: <1627675959-17662-3-git-send-email-indu.bhagat@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1627675959-17662-1-git-send-email-indu.bhagat@oracle.com> References: <1627675959-17662-1-git-send-email-indu.bhagat@oracle.com> Content-Type: text/plain X-ClientProxiedBy: MWHPR08CA0042.namprd08.prod.outlook.com (2603:10b6:300:c0::16) 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 MWHPR08CA0042.namprd08.prod.outlook.com (2603:10b6:300:c0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.20 via Frontend Transport; Fri, 30 Jul 2021 20:12:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f99def4a-c3aa-4753-8f66-08d9539667ee X-MS-TrafficTypeDiagnostic: CO1PR10MB4689: 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: 594I4CD5CBTmSRx/bhblCQEWBhIlKjht4ngSXS3uR0oml6WgXUmjjPw9P/KotH4ks/D7jRqblUSDBKwD0FJ6RFMfBrsMeo5Jon+G3nfq75556UWGClcMV3rtJUymExIvkBOgZr96C3dwPNCyRlBkd8/5AUkNOOro9Cb/+4yP6uL+T5KdxXnYZIIbpR29ms1LtuxB64p8EQIKUwFwBDkALqoz2NEOLYIR6/bnmUsebKk/aQteYI9sk4BlJvsJzvUDjjm7VBl8ZB436nyaeLv0hPOqW2+RXABEe0RCYAcBK+aZOBMPYA51DqpQ0kHQuysuW0MK9+tzRsJ55so/1QpyKo8XHMAIGpnFMwdjuKOnHqtDzW9PnBPmZIueflYwiXne0UeBAyUeVwooA6zkt07Hgr/1VUvQTJ8rlSVSYfrxtte+JEkxwy0k6uYNXqsg8fbxqKO1b46La6voPwzSlYaf8q85k2vEgdr8a94K5U4/sPgtSz4NnHGIkcXXA/La+GLTFz9kYuQNvUOFhopv4KRx3qxXiPUbyWvR+djdjre0grJG6gLwkiAMmV1xcIVABps9AAcutnot0OXt4l+qS1VPDq8sHc1s4xsIOhkC70s+TadglCSGbl0Ez+DHPMzA/LaX2Cg9IKRps+dYS0/+TWpbJ105NviPzmzlJaMqnBRsvvwBg/2ZtPVXxeJrAKmloo9eJDbzntCgED0OnSLzHkEKqA== 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:(39860400002)(346002)(396003)(366004)(136003)(376002)(66946007)(2906002)(66476007)(66556008)(52116002)(316002)(6512007)(6666004)(6916009)(36756003)(44832011)(186003)(8936002)(5660300002)(86362001)(2616005)(83380400001)(38350700002)(6486002)(26005)(6506007)(478600001)(956004)(8676002)(38100700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8gIu/8KHPopLCg3xf4niN0Sx1ziHh+EZr1q0sGMoZ5jEtLEj8JCBBfvxYwj4?= =?us-ascii?Q?WQK1C5WTe41/n+tDd6VGEiMzlSLZkySvz75eh63gwsC3p3Mc/Gg9gFrh40hs?= =?us-ascii?Q?Bjq17GheS+k51oD0aWexA75rQPaF19yL2AYyR5Ckoj+FQYPAOAUGTw0CjUTI?= =?us-ascii?Q?DHjVRcJnt4p/cB66SGMXEBvjRC+9BfOMSBI+GRCKvt5CzWCrpy3Zc/XJ8x7g?= =?us-ascii?Q?rkbbHMO38ZW8JtSg6DPA5y82uW6OE5xLshdL9OW37ISmeY4qGqE8uY9Md1O3?= =?us-ascii?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b5SwwU2qPGUwvv81TDuW+CRxvQZ5FAV9R?= =?us-ascii?Q?GkehlYqAQXfirJvy+XhxAUaQYPkRgJLqBCRxFakaRIXnw3KMeqkyjijbGNZr?= =?us-ascii?Q?gmPDkPA7Y/ZAMUdIXSuCuB9LsBjwk+vIsUNmtN2sFVADezFPngEPZAfIrU3A?= =?us-ascii?Q?RSzkvfo50BMeBZtQHb7vlobk?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f99def4a-c3aa-4753-8f66-08d9539667ee X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2021 20:12:50.5262 (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: 8UNK78DLzEZWDHmUPqyqVjqmpT6HBFaqgcjqUecTYb4IG9v3F9VpLiNUgH9tp63wlgYz2u/thgkXH0y3cdlDpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4689 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10061 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 suspectscore=0 phishscore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2107300137 X-Proofpoint-ORIG-GUID: R2IbB3_wnRAqwPBO1MkGiHxvDL0oMItX X-Proofpoint-GUID: R2IbB3_wnRAqwPBO1MkGiHxvDL0oMItX X-Spam-Status: No, score=-12.7 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, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L3, 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-List-Received-Date: Fri, 30 Jul 2021 20:13:00 -0000 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 a464d26..df408ee 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 0b60342..6119a30 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 6b4226c..67bdcba 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -4007,6 +4007,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 (); -- 1.8.3.1