From patchwork Mon Apr 8 19:26:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 1921021 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2023-11-20 header.b=eIPnUbQY; dkim=pass (1024-bit key; unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=hPj6qNy2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VCzcz0sLMz1yYT for ; Tue, 9 Apr 2024 05:27:29 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E182A3858C32 for ; Mon, 8 Apr 2024 19:27:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id EC2243858CDA for ; Mon, 8 Apr 2024 19:27:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC2243858CDA Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC2243858CDA Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712604430; cv=pass; b=vWwHe2UoPkyeSyoSXnKoBIaheH4B3RYcX03FqdXIboglRetwKDaPZhJliESS10qPaSoAipURRf7ubPAYpGAtjXl0iGPkrtgVJISnOVIUdFHMM2ElU0OZymQtFsh+G0IKt5s2PN/7ltD/Exc8z9bX9mrFMBDzqXvoxI+kJYqM+nQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712604430; c=relaxed/simple; bh=7TvkiFLH7ucE/NpozWsH2eOrbbfX8koy+qSDIV+s5kU=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=vMCaOlmln1jemd0hqG34M3hUIaXZe+pZ19NyOmKXV9uErzJUVfV+Bt6AViyUTyQyeM3N9ZF6VSHKwJUXZmiZhFl+stAcyX/DsYXRgSZQHRKy48XV60Xm130B5A6Hhh+zroL25nCHsusLJI7dDVvc2BTnqYUoq5nfOpVF0om7y5M= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 438ENw2F014629 for ; Mon, 8 Apr 2024 19:27:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=rcz0aWNFn4hG6E2KxYf8lb/8e/FwhdzZbKUVsBCKwfM=; b=eIPnUbQYVF4xHwKyk9sa5eQ6zVftWrqb8c67MCcwopqAEpKCjBAHv0AehOnzr65yPiuN aOTHu8JMF0FJFM0PXlZUlOQXYZhJDP113P2G0m8wXN9Ymbpx7/E0hfZEklDKbmNHjIqk 0xoeOIPxUbQzHz/mCFuZ3pfZzzUKXjUNbrtVHiEFXVettrC86+22xRDILR/RWnAvNFQ4 dii/9BVSPWvimYV0q4wLi3TSWoiI2e3fnVbHrJ07Mr/0qnDL7/ndJW0KY5yL4FOodzhB klTXC3KC/FCEWowZBYpKaBpZuJd9y7cD00En2Mv6/uACWQPXSmLFXjDk9o7/rThodzO0 RQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xavtf3hee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 08 Apr 2024 19:27:07 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 438J4Zgd003058 for ; Mon, 8 Apr 2024 19:27:06 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xavuc5xbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 08 Apr 2024 19:27:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kUp37+jDVZn5oFtvarGDVe3EEOzEFO6QI9jVOLPz2qdQxmQzj+0GQ7UZ54qBfLZ/RyVfm4JPpgB/7xUIMFafd2Ky+7zM6DZ+d+jGS8ZsnhBmbaIzUVY7cDKeJUKVsdReuJlDSbcYRo6oTOQyx4h8zOfoTM/NaLZQluMQbzIiN4rLxxAcS0uOHQHx07UXxm1FBRxXY3NjwzTlx+IeYo80HEBB2PIJm/noyzM8BS48JpmxQGmQ3GrBHuHbSORtE9AhXlAjzg6sxWIul6lW12FspqqduBGfTeuCdyAGhr882HDqC6v9Zgaje1klfkbYGOLa/XwQe87TUyoVeUiytyJtSQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rcz0aWNFn4hG6E2KxYf8lb/8e/FwhdzZbKUVsBCKwfM=; b=OPw9MnYxXoxb2ArkGWrxkRouX5gdlTzYHCnErpkgEd7rva2kIwyaopRzmYIAU4I5fgPquNo4KM/n1gnNClRE0B+BbTjofNbiYSAkX1Gyrpugc918NcKZygVEjAwspn+aW4cu74vgjNosNYWkDYSIGoQl1/WYA8tS8nPPVpmM/AWzr982JM7fgUdxGj6rhE0LXMPBuAKfPkTyIQcrPgR2VBHbYPsyeheSZAySPpdfK61QeivHRIh3g7nMrPciiqybeo0xnQlnPiPRh7fk7FPJUjl6q6uCKvQIB/NjoQAFGKAODoKzMx6BKWD8k8JzjUUiY60WD4Ilh2ZjB2+9JUtfHg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rcz0aWNFn4hG6E2KxYf8lb/8e/FwhdzZbKUVsBCKwfM=; b=hPj6qNy2ocPEcFzt5zBADTo6hOk5iyTaEslol6sZA3WlS2ObXgLieC7sM7df9ssqgYIaW/QBw+n//69qWLtkOcGH+iNXTcNoGBveyU/FnDH686ST6sNmy3fsCiS0+5W/v3WLBCtUKfWIqSdeNmiYxOT7BAX4EQqzKW3/FBQBxZU= Received: from DS0PR10MB7953.namprd10.prod.outlook.com (2603:10b6:8:1a1::22) by CO1PR10MB4402.namprd10.prod.outlook.com (2603:10b6:303:95::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.53; Mon, 8 Apr 2024 19:27:04 +0000 Received: from DS0PR10MB7953.namprd10.prod.outlook.com ([fe80::ddec:934d:1117:499d]) by DS0PR10MB7953.namprd10.prod.outlook.com ([fe80::ddec:934d:1117:499d%3]) with mapi id 15.20.7409.042; Mon, 8 Apr 2024 19:27:04 +0000 From: David Faust To: gcc-patches@gcc.gnu.org Cc: cupertino.miranda@oracle.com, indu.bhagat@oracle.com Subject: [PATCH] btf: emit symbol refs in DATASEC entries only for BPF [PR114608] Date: Mon, 8 Apr 2024 12:26:51 -0700 Message-ID: <20240408192651.11034-1-david.faust@oracle.com> X-Mailer: git-send-email 2.44.0 X-ClientProxiedBy: BY5PR17CA0021.namprd17.prod.outlook.com (2603:10b6:a03:1b8::34) To DS0PR10MB7953.namprd10.prod.outlook.com (2603:10b6:8:1a1::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7953:EE_|CO1PR10MB4402:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k91kQzY6s0lctUsEgH5BKy2jUMfGq8pqqpqmMCPDUhfk72cKpBqxUsTishZnxAohgJRAzxfH4AeZorYjcWLgppjuU40W8KlIAVFFA75S9o8xJeLXex2evcb6U/KXtvqOOzYA0FHez6GOTficHcY8gex2Go0fp4+9QZxPkUlcYCQ2mrzkPtt3i6FVj/6sO/1ujfx1yANBtUL4fMuxZIZj975ZtKoujWg1h3wqiDQR+Qxe2bhutXtF+2C5LrdaSom6w7drODhJa2wtrW7GTewb8nUWncpj08d/JcSg4ppy2ZH0VtBdDOJFv9/xHg/kXKvcJw+J+GwV9S3ahnqavh25/eoq+pERDuwal6dZRj3IY3JDYFzL/Y748XltGtFRLg0epZKkMa1iL77DZ/3QqsFu0/ThFQlJnOIo7AfGBisXi9LcKDTiXB7ZC/+Amck9jPKJWfIRhvNfUNleujQAjydGBon2+A/d9hlm2L6ZRNh05dI6Lp6G3N2jLgzWDFQTyU4foLlP4dSGHH1dTgZU8Qhz9xsGMPWEzUaIFQzH/+z3BA8hfbbSOyCME+jUDcQZe/cZ9K/VhRAUino3FGAVuUZmGmrLrrc9SisXPibzZK+D9NdWF9YKyyzf26PrghQNdKjB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR10MB7953.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vFllACgBi1OC2D2os0fC6+yJooMrKprBW6LQwBaDil8M+P0al8lJ7KeSad56lWyEMVX6A/d+Qr1x3VhVelC9zvgNdycBH89gwjiRFANdJulBFXuvz/kD7QHiya+APXZgCdf1oWgnMdrmHhHxqdyRm9v3LVn3saw2MBwbYZ+p8szxBIz5ZrtfUrE7m2Hjds3yK7qd0bNHdcHo81ovE53VVfjk9I0+TUGFiva/ne9Blt0utdjlK8yJgxRktlbr6jc4zRDw5lIMxrnp1S3proYa2a19SNfWkUR50ZvU4153R4qrSUI6kHurQrgl2iGbSHdstOZrlsKBBd9dxjEV3mODu65LkptWAWlZZVcW5dzZLKoMRucPfLZ8rUBllcwD66s7+DIZHlu8z+jp7Pl/bmtTJz8ZfekDDV96IwNVD9zdvjF40592hj8BtgAjX6PpAv9b9tmHd9Ln2DZY3laaLA+VKMrIjf8olij8TBiO3KpAF8/XW0frctJMh720IPk3wsKkW//9TF9VuEo8AAFek51eFCZtTI6HcgVRBZxNSH/jByFaqRKA9WvmVCIHjJvzeLVq6yfwCdpqnBBCuYR4IHlp0ChGzJOK4wkEgriRDHAnJ/VYA9MH0EZPc/XWJRX9bgVO6vygiTVcTP1Kop8H9XUI98oEPl12DWr5Y3XUBqlph5vuA9+A9h28e9cVhCFO9RD/aedszyCpXwLIQ+BmBbtKLb0rldwt67bFTpMsgFltCbSMh46hMk4/SpWEB7J/apYyQxORjhTt2btNlRNlyHVe/k3YAe0vUQRwhlWz6IMzpRcO+XykHHtBNTtXfRHz6BuHjgd1L5Wi/MD7OLalMwEyRgUZhV3fCpuDIzcLmP9QBudKuraH/SAg94osKDZrbIuCKBZWcFFzXPpqObmzw5sfTMVbTAwE4Wx8pTKvwkUX8wN38Cc7TzIpoZCY//NT7vUld3shkY1e480CP/bxHCEA708QkuVW8fVezXtTRkpsbM4jD0y0bWFaWYR2/jhn7+0KR+Z97pAXKri0m3PAkOhtIgkLDzsVL5VghXg1pZYacyuLYn4dAz1WzkXKHntPoGXN6n0ygAsAakwjJJSTH/0TgiorEjq5unrYZ9TudkzpfR/1VG8qJYPysnApKrPoxDuK66QgWXzCwiPTTNlik3ajkND3vTOiJ0Z3WqcddznIqQkuMMJYzQpLOIb0gHpsR1h7gH3V0hzp6CBaldYzIEqERIEG3abXrjRKn3mHXw7jMcKlkrQ2nUUQlCPDdntmHPNnD3NDFvCBE2qJDeuhtTQlpgue6Z30PkkHL1pwJfy5PxSIikaO7LM9zj2KcefoO77A/doDQDfkhJwOOhNsVOiRqEVuVo9k258A0JJ6+YETTVG45OsFP/POYrRRnz0ip+gDZw+5iINB0Jh0cPX/gPMeSrViwlNJiucuFSsJontKqf/PImL1QiJtgCXoIcF03fzbxnZuWgIbI36iHQvO+zao3dvK2kVLZx/xLgHqQ0zoqI0xxcD2oxbXqCGaHh9oE5VqRh+wpWxVElUB7N8EDl3+rGOD9RXy9lCleJghrlZ1sLKmZFaB7qY3n+bwpv3h8mkA X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Tf/OWfxuQtq2GL3TyEjXqCfL4nxLMeCpoVXH4toi4vl1KndROgA76X9hz/yFGOf2oXAWUqPD8cViLtN9DwYDVUKI9L5n+KCjjCjn1+DExy+Gk5s886e7265v595B3+z8bLNnTNlCNJ4RXE6Ap0ZuNHIr4uFURVoS3XPFlajHeKK2lgWVnJ4i0Cnc+2ngqvrRRzxOczI6u5sRNBf6/SmX+pzioYy+FGMXZTxAfBFdj7I3dvI/B/df26wUjFJoUrGyTRW5+JkYtPPCdRL8h6JxgjhsYanByayh25tTCWxDj/6hXrPtdhR3SUKvz6LKBPn/c2U23+liEX715OsEDy9eUd5fLS/9LxaLD4OSUxErAh2mif2hWkNu7IotIcG/b+L2+XpZbRLQWhm+Aaaa9dpBkEIvlfaII96s1/XIRiT3WacBF29G/k4qdGUjjYaMvhX9dqDlZIMiXQIJ08SqBH2NyVQ05pI6+nJupSDMGeBltJPeUjkpJOuIRO49qMRm/D6eE3J1RmvoEec9k56Oa4jKxVemTtlzu1pIoHGV+ZaKdBlD7s/8nsoWPBQkgqS7baWR6Lq5dLlMv9t9hxVmENWPliwCVBNsQTD7/XqvNKanZNY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d584448-44ce-49cf-3e6a-08dc5801df12 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7953.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2024 19:27:04.1949 (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: cN1pDKlAVrJD7Z37cjU5TPwhryakA7pY9lL5Tb2zyMpcrLBToYkn2cu59NTdRabk5IgNOd7f7YVp3LyzrLm90A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4402 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-08_17,2024-04-05_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 adultscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404080150 X-Proofpoint-GUID: pqsC3FyMaYEHorqvbKygfsOM4g7tBg87 X-Proofpoint-ORIG-GUID: pqsC3FyMaYEHorqvbKygfsOM4g7tBg87 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org The behavior introduced in fa60ac54964 btf: Emit labels in DATASEC bts_offset entries. is only fully correct when compiling for the BPF target with BPF CO-RE enabled. In other cases, depending on optimizations, it can result in an incorrect symbol reference in the entry bts_offset field for a symbol which may not be emitted at all, causing link-time undefined symbol reference errors like in PR114608. The offending bts_offset field of BTF_KIND_DATASEC entries is in reality only currently useful to consumers of BTF information for BPF programs anyway. Correct the regression by only emitting symbol references in these entries when compiling for the BPF target. For other targets, the behavior returns to that prior to fa60ac54964. The underlying cause is related to PR 113566 "btf: incorrect BTF_KIND_DATASEC entries for variables which are optimized out." A complete fix for 113566 is more involved and unsuitable for stage 4, but will be addressed in the near future. Tested on x86_64-linux-gnu and on x86_64-linux-gnu host for bpf-unknown-none target. OK? Thanks. gcc/ PR debug/114608 * btfout.cc (btf_asm_datasec_entry): Only emit a symbol reference when generating BTF for BPF CO-RE target. gcc/testsuite/ PR debug/114608 * gcc.dg/debug/btf/btf-datasec-1.c: Check bts_offset symbol references only for BPF target. * gcc.dg/debug/btf/btf-datasec-2.c: Likewise. * gcc.dg/debug/btf/btf-pr106773.c: Likewise. --- gcc/btfout.cc | 2 +- gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c | 10 ++++++---- gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c | 7 ++++--- gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c | 3 ++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gcc/btfout.cc b/gcc/btfout.cc index 2e2b3524e83..4a8ec4d1ff0 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -1045,7 +1045,7 @@ btf_asm_datasec_entry (ctf_container_ref ctfc, struct btf_var_secinfo info) { const char *symbol_name = get_name_for_datasec_entry (ctfc, info.type); btf_asm_type_ref ("bts_type", ctfc, info.type); - if (symbol_name == NULL) + if (!btf_with_core_debuginfo_p () || symbol_name == NULL) dw2_asm_output_data (4, info.offset, "bts_offset"); else dw2_asm_output_offset (4, symbol_name, NULL, "bts_offset"); diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c index c8ebe5d07ca..15b76259218 100644 --- a/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c @@ -19,10 +19,12 @@ /* { dg-final { scan-assembler-times "0xf000003\[\t \]+\[^\n\]*btt_info" 2 } } */ /* { dg-final { scan-assembler-times "0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */ -/* The offset entry for each variable in a DATSEC should contain a label. */ -/* { dg-final { scan-assembler-times "(?:(?:\\.4byte|\\.long|data4\\.ua|\\.ualong|\\.uaword|\\.dword|long|dc\\.l|\\.word)\[\t \]|\\.vbyte\t4,\[\t \]?)_?\[a-e\]\[\t \]+\[^\n\]*bts_offset" 5 } } */ -/* { dg-final { scan-assembler-times "my_cstruct\[\t \]+\[^\n\]*bts_offset" 1 } } */ -/* { dg-final { scan-assembler-times "bigarr\[\t \]+\[^\n\]*bts_offset" 1 } } */ +/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 7 { target { ! bpf-*-* } } } } */ + +/* For BPF target the offset entry for each variable in a DATSEC should contain a label. */ +/* { dg-final { scan-assembler-times ".4byte\[\t \]\[a-e\]\[\t \]+\[^\n\]*bts_offset" 5 { target bpf-*-* } } } */ +/* { dg-final { scan-assembler-times "my_cstruct\[\t \]+\[^\n\]*bts_offset" 1 { target bpf-*-* } } } */ +/* { dg-final { scan-assembler-times "bigarr\[\t \]+\[^\n\]*bts_offset" 1 { target bpf-*-* } } } */ /* Check that strings for each DATASEC have been added to the BTF string table. */ /* { dg-final { scan-assembler-times "ascii \".data.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c index 857d830e446..a89a239a504 100644 --- a/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c @@ -10,9 +10,10 @@ /* { dg-final { scan-assembler-times " BTF_KIND_DATASEC '.bar_sec'\[\\r\\n\]+\[^\\r\\n\]*0xf000002\[\t \]+\[^\n\]*btt_info" 1 } } */ /* Function entries should have offset with a label and size of 0 at compile time. */ -/* { dg-final { scan-assembler-times "chacha\[\t \]+\[^\n\]*bts_offset" 1 } } */ -/* { dg-final { scan-assembler-times "bar\[\t \]+\[^\n\]*bts_offset" 1 } } */ -/* { dg-final { scan-assembler-times "foo\[\t \]+\[^\n\]*bts_offset" 1 } } */ +/* { dg-final { scan-assembler-times "chacha\[\t \]+\[^\n\]*bts_offset" 1 { target { bpf-*-* } }} } */ +/* { dg-final { scan-assembler-times "bar\[\t \]+\[^\n\]*bts_offset" 1 { target { bpf-*-* } } } } */ +/* { dg-final { scan-assembler-times "foo\[\t \]+\[^\n\]*bts_offset" 1 { target { bpf-*-* } } } } */ +/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 3 { target { ! bpf-*-* } } } } */ /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_size" 3 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c b/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c index c06220eb520..4e3da27d20d 100644 --- a/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c @@ -11,7 +11,8 @@ /* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ -/* { dg-final { scan-assembler-times "foo\[\t \]+\[^\n\]*bts_offset" 1 } } */ +/* { dg-final { scan-assembler-times "foo\[\t \]+\[^\n\]*bts_offset" 1 { target { bpf-*-* } } } } */ +/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 1 { target { ! bpf-*-* } } } } */ /* { dg-final { scan-assembler-times "1\[\t \]+\[^\n\]*bts_size" 1 } } */ extern const void foo __attribute__((weak)) __attribute__((section (".ksyms")));