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 EC4F83858288 for ; Mon, 8 Apr 2024 20:39:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC4F83858288 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 EC4F83858288 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712608769; cv=pass; b=AKgZP6tDc/+itxOHYY0QyOtLZHQpl/KxFv5vwI0wRXGKyPJaOfjg8TCS71gBOu7i+NEvPPtng1uSLiR7zC6PeBrma2fmzrUVr5Obitf9i89wYt93GByKEmmyulWAOC0SdhMgMzTVYv2gdVCHWeSXPKOnAq5i5zG0sARLXIdxuwU= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712608769; c=relaxed/simple; bh=ONwU88mSc4WhdGLADIo8W8CijITyDa5p8xl8M4rTUIE=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=JRK5MSNh7hU8SaH11TjPgUwSA/tUuEdXd3gtWsq25rkhrAKTzdDFO5u/kYlMEuzJRiSn5MwU0wMbNeOXkhZjVqu8LZXq9E+FoaHzp9TC1Di3IXCCyrPfpM46UfvGCPyfK/nxIQT9okOkbifjOV+l3ya0bEdumtPU+2lWeDPvwTE= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 438EPFQX008832 for ; Mon, 8 Apr 2024 20:39:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2023-11-20; bh=yb/YvCsKhj/qykkQhc5mgfzeUJo3Wjhi6WxFeq1TmiA=; b=TCRgRez2944jubx7Q5y/Sx3byJyAa87CWXPDciu2fPxmRHrrc1mnc4AY1PvFP4T69WO3 jgD4ayPAdmO001SHrZy0aFdoDCJnDN+dxycr+snDLWuFweRIhFeXDyVIoBy2DTDu1QKR 1Rgn16PIjmnGzTX0tBPfMTL7lRQulEQaq9ek9w79DBYAaMzyG2Q70GWvTk7cD4yhMmEX Syzg5Lobc9oYNbjuhvDKcCPffDrHfhMLRpNPOhDeH5/EeHlzsYev0s/mEHnUp/44d9ll 43+eVrPQOsLYligTFhDt9thf+NeHaGUZGheuEDEip72Tg4tH9Gkr9OlruSXDjCONyna+ 9Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xawackphj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 08 Apr 2024 20:39:25 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 438J6Io3040040 for ; Mon, 8 Apr 2024 20:39:24 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xavuc8ffu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 08 Apr 2024 20:39:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ahWZpINuZWhsY/mvqJHAXeNNK0YGPbvG4C2EWhJUa5KECOpWSIJWAH/9jzkk4tel5qj0wRGV2PcUh7EYqr1Usg1uVbhtuOR5sMN6aqjb8k5epHCD/iXQVTIPXdmv9ubaUWSGDB6J+FbxiXSOSIuD23lYi7UMhukoOkqBLsQENCindDLMRW3Ieq9g6Wpc8EUj5OiD45mD5BLhOnPV9QU2dfXUaugp06YtH1uonbQd3IOhJEruDmL8xcWNyH0TwB0pVRvv5L5eGQdp+Tf2IqRR5ataDXAKji4RYG+ZEJzfW4eSMaqO3d2RbdDD6Fm3F5ssYZg8KJgbPR4GfwhxSpD6pA== 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=yb/YvCsKhj/qykkQhc5mgfzeUJo3Wjhi6WxFeq1TmiA=; b=V3a86NoAwNrg4tT2cT44hy+9HoKRkVk/ZoxER/nnWjUPfpaZorqTlUrE828MckYMZNtdDM57NQ5TREqGGkDn68soN+QLxHX7j570hDFFQXMEEBi0Ccu6uswI3eMQK4C/+mN+p5tlTUazNChsHYTM2zc+cutLLUgC+yj5MYprZ8jvbr0xWXOIlL4cqqCb5zE1V1vDsG7vPe6QHv0oo4tRe9QKqpGt+w7ogP6YSRIi9SoqC2IJRyzumg/6XXP4GpqHbzexBA74IskA3TZxj8jOu6Daig9tMgc8wyNX6veHUUwTV6XOPT4ndIz7WIahGg2yHCgCZY3uqablmBzyyNtNiA== 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=yb/YvCsKhj/qykkQhc5mgfzeUJo3Wjhi6WxFeq1TmiA=; b=eUZhWeEg7RK3ER5+4CmYrsw2JPA826sTV+UjZGDoDLuCgYmiTyHbJvGSXmmEwTeHl/KhRPrT5JK9b/7DoXa6n3Z3JuT2mKQLfJjiG3hTlsvjpISLMcWIEIn6zWmFK2eQp+BR8mWeAytUL1qhan5iJUsyCE5D0hUBa61Ofr7wnRg= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by SA1PR10MB6320.namprd10.prod.outlook.com (2603:10b6:806:253::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Mon, 8 Apr 2024 20:39:22 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::6ae9:dd4d:17bc:4f2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::6ae9:dd4d:17bc:4f2%7]) with mapi id 15.20.7409.053; Mon, 8 Apr 2024 20:39:22 +0000 Message-ID: Date: Mon, 8 Apr 2024 13:39:19 -0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] btf: emit symbol refs in DATASEC entries only for BPF [PR114608] Content-Language: en-US To: David Faust , gcc-patches@gcc.gnu.org Cc: cupertino.miranda@oracle.com References: <20240408192651.11034-1-david.faust@oracle.com> From: Indu Bhagat In-Reply-To: <20240408192651.11034-1-david.faust@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MW4PR02CA0023.namprd02.prod.outlook.com (2603:10b6:303:16d::16) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|SA1PR10MB6320:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0PshfLliLCcrFenNTMBMVEVJi/vezyDGmAiguPgiH8RN+xoGqqTgsb9drDPhYucQJ1bx6GeAvjmCY4+6RUpZxZV7l0ZmT9+ZJTrpBac+d9y9XO+/tUrjKC9SOLSyOx+aUG2D3MwpXGEKpQ8fkXO0V85WbtiW4obz+HP1BW7mIi9xO31O2IegsclKdY8/QNqNWwECiRtWKk+hk8UXgrzoep+/R6vb1OuGWV/LAsAzceH5RuqtwHznbRBzrpym8/ByvX1NCcKy7aJpWtQ9nvPJcYr6PkNJ8UgT6VhzsQawTgbKO8KhcYEoR9klsYzaOBP4rBwhANvBK6ZLh5rayWA8+HvHXZD25rpEcUH3AVd8+Ko78yy2BmfhDkv6PBxUjAN7nJ1j5Mu+iJDKqJEz68CNeuxmbTSK53BEGT1irgw63EspuA/WoNgrDH0yu5eS2ibp0ZVeTcGLH3aXVM48+g7IQd0nM/InZ8br7SzT6+g59+EmVsGzkwv2WVLfEey9LgBnXRghPnJpwPawYXoZ2xWZenQCWcLuQgBFhStTkw9xprD73537jBZLms+DyYrbY0ZgoWoQaqhuVbtuAm1T4ZBGxaT7sjzcUlFOxtv7r4g/up5KhOe4HA5+CvcAUIGExaLA 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:(13230031)(366007)(1800799015)(376005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?b2NzQi9yeTY5NXdFK0pId3NyWERrS0R1RVRqVnQvWmkyZko4MncxVmgzT2kx?= =?utf-8?B?NnlZVkd1d2x6dE51U2lNTzhIQUxpK1dEUDNXK1RGa2lvYWltT0hmTW43dzBa?= =?ut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pMR2tzT2QzbHJyQXkwbnRDVnhxc29BaEllVG01cFNWMzNHY2JyUFpzZmtX?= =?utf-8?B?WVZkdnpETXN6WUJOc243dnN5eEpheVovOUdiSXFmaFR0WWIrQXB2eVFEdC9T?= =?utf-8?B?cWZhUDUxaG93NXNIQVAwclZpRlZNWWZMSHYyMW9LaERjYnNmS3E3T3RYTTV2?= =?utf-8?B?Z1o4RnIxM3puMVNLRHdFQ0lQLzhaMyttWGU1U05oVzRoc2d2NXhua1djYmIv?= =?utf-8?B?dFZqK3RDZWRuQU93eHU1MFl6UmJyTmFkVmdWc2tqRFc1a1RUY2JEUTQ5WW92?= =?utf-8?Q?EB9RplxHbsGACP+/DzjXJZA=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VUCmtw4VxMkJctcDibAAZXZLuaby5bCTWqzEJJTF4WtqhXKYHKDveBPIKQe9EgzB//+nPdGtlkeY1cLgvrfk7XGFxYqhoGJ1OFflDwXV7etSOEFV15YRTLkc7ScZinTU41AgbQz/DWRt3yJDPl1OiXItbCgOxAINIMAtsCnRX7z6R6FIBhcdVboFxUZOIwM1nRsMhOzDwIrRxcIUbsMJg/06MPxQn44I75lyAJ0lEyYfn55Ewei2RSBANNxSZR27TxFd9UIHasCaMwDkTrkO0YLJnidOqLW7e9htpz7PriPOM+nYigvYYhJO6P59pG8/AMW9BHA8FYLwIzTKnza+6ibsLSyPGvcWd92DEK+axQ0/K/+s8MlReEtBfq3i2MFSJto5Z8HwMz/1F1OMTQQ1B8bNSvN3ppSIyL/dYS3G7yb1OIEqMqdFYAbRGwaC42hAbXmSG91AU/o8a3ztIF/v2m5ECvjq+ledSBdE+Q5k6MGSkMLvwh+V50byE0Bo8KuGNU81J9DVk2XxGCnUcVlCunpmdSCyDDlnO2nY+f+5FdYpYF0w7SJNrATjxt/KfG3qi2+QT/En6FZArPLH3i+eD4C6JY3XpyaoeDmoYSTyVek= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a3f5e3a-bae0-42b5-57d4-08dc580bf8a9 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2024 20:39:22.0729 (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: 0n1iYMeZVcoOi/3buJwSZx19R+QbkiS2PtL3VkuQX8mKn9valqm8zZg+Xro8y1HIuD5tSYsFXCTT4Ukp1iDvzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB6320 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 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404080159 X-Proofpoint-GUID: vciZF9nDm27gilfjMAf6PWrI7JQz-sD6 X-Proofpoint-ORIG-GUID: vciZF9nDm27gilfjMAf6PWrI7JQz-sD6 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,KAM_SHORT,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 List-Id: On 4/8/24 12:26, David Faust wrote: > 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. > LGTM. I think adding a comment in the bugzilla for 114431 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114431 indicating a further patch would not hurt either. 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")));