From patchwork Wed Apr 8 09:12:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Muhammad Kamran X-Patchwork-Id: 132795 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 664A44BA2E19 for ; Wed, 8 Apr 2026 09:14:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 664A44BA2E19 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=NIkG91if; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=NIkG91if X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazon11013011.outbound.protection.outlook.com [40.107.159.11]) by sourceware.org (Postfix) with ESMTPS id 18D8C4BA2E10 for ; Wed, 8 Apr 2026 09:13:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 18D8C4BA2E10 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 18D8C4BA2E10 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.159.11 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1775639607; cv=pass; b=HorELNIQ/7QOCzxGp7Ua5zafJ9yHDm6W7tqlGAKQ6A4ZJITCZT47ne+HTlz7O9mzQTIQIiJaF1Ln/VsYDZ7NDVHd6MX07gTW2D56T0X90WAto/14PUmSq9CsthUoWgEa5REKIjZjGAwzDjiH+mE+DPTzjBvO7yjHRdGsUb8kiaQ= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1775639607; c=relaxed/simple; bh=szKUTAVzfDufWWjWvYuhJz5zlV92/yWjiN+8xIJNy7o=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=twyY15GhfjY+C5nszX0fO5b8926na3RI88tyW6pKXaHuuURJtlQjYUzLytfMi3XdnxwZXDwGNqz5mTPFQe9gOfKIEGfRHMkXlpuSSx2C1ExVTriMq8EM38AsWA6gfXGy0lU5pNluMMzSGzKGskZWMnjrc0IAqgBR+CtpOSV9Z0Y= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18D8C4BA2E10 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=RWmzcaP3GNOcK1j6dVIt1wA7igRNHKvXHaoWjhFHX0KudTnWaYU1w3lmyT76H8laGHDxAVXId+H+hI+zMfqkMeMcLoik0G13HpkBfjdd22xft5CchiSNfYThi0EiRQdpnDbk83a5irNIWMsH74rfUF0bvneF/N6UboU+wLs9KfnOyn41A/sLVPoa68X+WUdg1LUVmBMGt+JkpUEcLPKR3sUgZmUPA2KlJfGeEVg46hzBhdJgz9sgAckXRZNDp9nILYs1ofQKx5smoOnd+e5rYd1+3ZVuZtjwaj5HUD/DO0lQ9wsxM5/KKLxGmm/Qj3TN+EjR3l2qO4ofmqwN4R2WLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=frzu8h5iWOwjOjEiWGHIb2o7fhXQ6Vn40ztzk6U+VIo=; b=GPequSmsy9tGFNG7nAEiuu7xpvqHj6ByoA9YyaJxZRft7rYdkNIRsxngahk+njCVGLkURQ41Y08litp+dRN/ohPgaqKgEkm2XejllFILZ9xWctsso9ScHJvoeIqIkSwJSLXf5bie06l4E9CWJyiCrZ6bHZg4WkGACTsNjC//hUDtP8x0Tp0dWPaKpzsCVz4IJ6fVvzgM+8vUPOp1j3T7tRCc5vlCqme+W+8VVDPfaCpJtyN56strEqrMTqb42GGFWfGxABBAXXlfhhDenq04YMH5ahpHssJZpp0R/RohUmIU2LMGAWjqc4LIt+9G4Gi+xUl4v8xKyoYzUvC0lnJ9aQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=frzu8h5iWOwjOjEiWGHIb2o7fhXQ6Vn40ztzk6U+VIo=; b=NIkG91ifdpF7olJpQ0MpTbDkLMoiSvSCS1dCopeoyu3XmJrAhBJdKkHSKbunmtjZRgr2ObM6vb5JIVWHGj8mtZbWQIeeHTe/6LFYbc7Y+ef3gKyq+/AQI74hbMO9R90JgEbQNKdaYnI+BKw64I7j4fBQ4Fw/L1xkvXp/4Q9dVe0= Received: from DU2P251CA0028.EURP251.PROD.OUTLOOK.COM (2603:10a6:10:230::32) by PAWPR08MB9591.eurprd08.prod.outlook.com (2603:10a6:102:2ef::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.15; Wed, 8 Apr 2026 09:13:22 +0000 Received: from DB1PEPF00050A00.eurprd03.prod.outlook.com (2603:10a6:10:230:cafe::2c) by DU2P251CA0028.outlook.office365.com (2603:10a6:10:230::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.35 via Frontend Transport; Wed, 8 Apr 2026 09:12:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by DB1PEPF00050A00.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9745.21 via Frontend Transport; Wed, 8 Apr 2026 09:13:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ela2pDIZG2ek5wo8wFZCzKnlnbKa6D5J3AK6JUiROE3T4a0M8tJilDzaQliheFCw1b2OxW2sB8Retiq4iVmn4g5bsc6qHdq+kvXp/dGW3cKnW2Q7ldBs4srwa6lzJC4m0qfdo0IIV9Do5r8bplzvH0ZFOoha2N9heEKZzEY2DjQKapKaV8CQvEKckS0CCR5QLlJmhgxsSjeEKGIm3cXBtKKumNxL+xwCQWzrxQZRdz4jfbDd6Whc42l0LJIeW+XLRef/79JEDKWj1TmJd+X/gB9p6/Q0SN+XXxnhSG6B7pyq7bcCfJloBSsxWXpeOb17Vrf/5aRJAgKbvEawBFt4LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=frzu8h5iWOwjOjEiWGHIb2o7fhXQ6Vn40ztzk6U+VIo=; b=PKy6iKfciBmVJOU6IM59tSeqUgNSjzakWxIGIKxuXdYDHr8kMTcudw2GZGl6liF1qf52gPi13OM/jIO13ghDJR1Die/6LopwYFC3GBvpctBk3q0y1ecvDSDxb91e20k4CsWKZfhW0O/ojxPnJrJ0jJs+bb0w5qhf37hndjwF02QZsNKzwB6tnvWI3GAq4oLT5WyOIC0mUSY/AWEwWLvkmmlN0wK2Fv+ymsWkHm8GjzKz9JEJnp4+Iow73WGYjRDwDxy/k0SY2GILa9aXVJLM5Wu3p50j0ljsU+qn1RY+RZaJzpGSabkvlM2LN23zFb7tIk74V80AXNe/A+8+em51FQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 172.205.89.229) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=frzu8h5iWOwjOjEiWGHIb2o7fhXQ6Vn40ztzk6U+VIo=; b=NIkG91ifdpF7olJpQ0MpTbDkLMoiSvSCS1dCopeoyu3XmJrAhBJdKkHSKbunmtjZRgr2ObM6vb5JIVWHGj8mtZbWQIeeHTe/6LFYbc7Y+ef3gKyq+/AQI74hbMO9R90JgEbQNKdaYnI+BKw64I7j4fBQ4Fw/L1xkvXp/4Q9dVe0= Received: from DU2PR04CA0341.eurprd04.prod.outlook.com (2603:10a6:10:2b4::30) by DB9PR08MB11338.eurprd08.prod.outlook.com (2603:10a6:10:60c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17; Wed, 8 Apr 2026 09:12:16 +0000 Received: from DB3PEPF00008859.eurprd02.prod.outlook.com (2603:10a6:10:2b4:cafe::d5) by DU2PR04CA0341.outlook.office365.com (2603:10a6:10:2b4::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.37 via Frontend Transport; Wed, 8 Apr 2026 09:12:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 172.205.89.229) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (172.205.89.229) by DB3PEPF00008859.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17 via Frontend Transport; Wed, 8 Apr 2026 09:12:16 +0000 Received: from AZ-NEU-EX03.Arm.com (10.240.25.137) by AZ-NEU-EX04.Arm.com (10.240.25.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Wed, 8 Apr 2026 09:12:13 +0000 Received: from ip-10-249-57-232.eu-west-1.compute.internal (10.249.57.232) by mail.arm.com (10.240.25.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29 via Frontend Transport; Wed, 8 Apr 2026 09:12:13 +0000 From: Muhammad Kamran To: CC: Richard Earnshaw , Tamar Christina , Kyrylo Tkachov , "Alice Carlotti" , Alex Coplan , "Andrew Pinski" , Wilco Dijkstra , Jakub Jelinek , Rainer Orth , Mike Stump , "Muhammad Kamran" Subject: [PATCH 1/2] testsuite: Extend object-readelf beyond attributes Date: Wed, 8 Apr 2026 09:12:01 +0000 Message-ID: <20260408091202.13538-2-muhammad.kamran@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260408091202.13538-1-muhammad.kamran@arm.com> References: <20260408091202.13538-1-muhammad.kamran@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB3PEPF00008859:EE_|DB9PR08MB11338:EE_|DB1PEPF00050A00:EE_|PAWPR08MB9591:EE_ X-MS-Office365-Filtering-Correlation-Id: 262f9680-a317-4515-fdcf-08de954f14f2 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|376014|36860700016|82310400026|1800799024|56012099003|18002099003|22082099003|13003099007; X-Microsoft-Antispam-Message-Info-Original: FO0rs/mNDdHYUAfESoMY1+YyjOHBwfCVnr4NUZfHmLkkG0rJjIxkyHJ0nTz//pRmdRA0FbUeuUTLKxh/MzrXyuXLQstcVkyI4DHSSdNPzl/ub/pDPVXoSqFpSeWjiA6lB+VNxnpU/85XEHdo1JN5O1aF8N5MUAniapEY22V0FWEnZ7TFN364ofQVFMqgzuuAlef5AuiUtxbjRj5X8ttqGxFbuKpR74AbUWgl6NWNhoOr4zPKP5pkBYNNyiFCOTt4IWExSFrtc9h9AN0JlUpbCWXRfRW+x94jrJBnIpp4+tVeQ2gnUP0isx2R9XKxmQ7b0kmxz/mA4JxdjHnp+QxqbOmYITCrGoCyZOTx32zeGI45Rc4PYIB2DT7hgGpXY/5QgJnwcKjCTdzvJQ0pSeU/uCj49OtnooEDl+tmhB3pmknUdRq1B25P7+xOeipMoWqHToirLIm+UYLNFAhe1ZzLuyEb5sgcIFeq7/TZ35QliWgup5J9KSLeQdMXtXaLlBSrHnUHKPvWv0JGQIgR98Io9vK9IJfmg7LuOMHJDx2g+HToK010iBBj3n7KmeEMUVy7no/BWCt1aJwZDCmvakQvElDHVodqkiiXprmWgx8o8t9Cxr4HWLuaT5h5wg/iT7Lv5bH2bGMARYt7qE+NzraicYc3Ndn7zuRr3+wM1sz5i0gtL6U+nWYR0faf931fP/rqXh7IaWk5YMHLQgqxM7BvBd5ohbgOSVKzByEiTzWi2Cg= X-Forefront-Antispam-Report-Untrusted: CIP:172.205.89.229; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(36860700016)(82310400026)(1800799024)(56012099003)(18002099003)(22082099003)(13003099007); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: H3ZL/sdQwKBE+5IXlc1cgb7LJ89D0kGz0XE+ySdr64OgL1vbVrUYhlENKPlWpKpWo9u8HSBdSsvowZ2toamA6bBkWoq1ICRxXkUxwDYJ7B0PMJeIm5XqKCbg2+pTX0Wzfxk7vsoC4CV4fqabk56/2+68f8SZPz+CcKcBTojLJayXobn4uGKKRQDwNyRPgEEpJfM+F/1xjUR+b0JnSspbjFHBVluyoUZkYFyAGBfxYoGnfc6pUYkeKeY/Y1//X4hAVb0Be84o9a6rdiM4UfYwcdj8QG6q9BMEspdsmqTvG3KR7PZBFRG1gZeWwhkmotPYZP2R8iolDLvr2Cm86hWcDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB11338 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF00050A00.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f15fc7e0-3ee9-41f4-838a-08de954eee2e X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|14060799003|36860700016|376014|35042699022|18002099003|56012099003|22082099003; X-Microsoft-Antispam-Message-Info: Ie2irFNdq0MziuKYmtaD9VhN6gXyEeVsV2UD1XC2eq9tUKAAu81gww/n296YNo1+NGS2reYQFNgBnqXa8QQ+rR41xgaYD+6sXI3smhFmJT1EVDjnvH5n/zkv7g2q2SSHdo6SPo677uOQ4+ta0qbqtFy1u61JGY0IgvSffGu5tyBMFG0YiNkHS+CCilaSflFSYRqzbdqBAQmj2MTfz/U5fWq632UX4h71wLDayMmIutG/HJXmg2cQrIZnqu59qGwdXoGG9Ex0+RdqL451fEd9oDCbJVhk/LEXFR2xb0XKjTjKwIucjV1GhyexVygo5IgixZVQTy9Bl3mawFgyliNpbdaQqMesZBBQp1sfxPKW42KwLb53zP0BDW+6KU+nvoMgvaejDBCRACUXhwSnVW/2cw4Lmz/lz91HnDvMqMApsvyaL/Tc9wFozfkJKheEHnAIhjMgR6t1+JsroBxPhwNWFqAbdYVL4EvZfs8grBwV+IgBERLfJjf+GhxDMTxDTqi4qXJK4645SV6QzTX/Kq4+APn24d40mLJow/FPRAPXH3Dc1n43ld5i+7kPb+pNZORoM70QkcCDzjmv+7sBNSowzyknN7/kiW/t0gF19EZNRSurFxaOhaIO4xRz7wsSQnaUJePcAsJKjw3psDWJnomZpmZwGcO6W6gZuram/gfxXRrv4zN4KWrM9sU9j+jv9VaZ4xpR3egGJktynNfV0IpKNtb4yXE8nwDYGtrMtwMJm6A= X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(1800799024)(14060799003)(36860700016)(376014)(35042699022)(18002099003)(56012099003)(22082099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: M80ff37OiaECEuo4L8mjOiZZoGIzpoXnR5IV3f2cn0HoVljF4nYj3ZdEVM8DucBE8zivJM6IIxaKYkCPHbWWAM7Bu9L8P57gOLcFPrbQKAvGtApoaUQ0CqpULcOyghaapUtmV2tv9066lDEyPFuXkIs/3oOvwKSMG55uKMSg3rXEhFB8olVuBDEbjIwhsQ1Yiq5qpFHbsayUl4UZOuI+lVljvxmfK2SnfMeZ5boBCo0XpFrJyqeyPP/Ntog5KrTL81pD9tec3NpxKo6TUCyKRfBEMiWPT+GGvt7fDG/j+rNf0lT395hHUkcZGONAtf4MNfYAh4bWq86yI49fPgEMwiuWcOCpB17QgaE4VU2uNGY/KaRC9vWxCwm2mDMY9fhWBMKihy5uNirrgBB5MuFUJTPBfLD/gQd1DeIavFyhkLRLHRJ0yj+xEsWWQO8vept9 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2026 09:13:21.8337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 262f9680-a317-4515-fdcf-08de954f14f2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00050A00.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9591 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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~patchwork=sourceware.org@gcc.gnu.org object-readelf in lib/lto.exp was hard-wired to use readelf -A, limiting it to attribute checks. Extend it to accept a readelf option and a regex, where the option selects the readelf flag and the regex is matched against the output. Add wrapper procedures for common use cases: • attribute checks, and • note checks. Also add support for negative checks via an "is-negative" argument, which requires that the regex is not present in the output. gcc/ChangeLog: * doc/sourcebuild.texi (Scan object metadata with readelf): Document object-readelf-attributes, object-readelf-attributes-not, object-readelf-notes, and object-readelf-notes-not as regex-based checks with optional target/xfail selectors. gcc/testsuite/ChangeLog: * lib/lto.exp (object-readelf): Accept a readelf option and a single regex; match against full readelf output. Keep positive/negative behaviour via wrappers. (object-readelf-attributes, object-readelf-attributes-not, object-readelf-notes, object-readelf-notes-not): Implement as wrappers over the generic matcher. * gcc.dg-selftests/dg-final.exp (dg_final_directive_check_num_args): Update for object-readelf-* wrappers to regex-style arguments (1..3). * gcc.target/arm/lto/pr61123-enum-size_0.c: Update to use object-readelf-attributes with a single regex. --- gcc/doc/sourcebuild.texi | 23 ++++++ gcc/testsuite/gcc.dg-selftests/dg-final.exp | 5 +- .../gcc.target/arm/lto/pr61123-enum-size_0.c | 2 +- gcc/testsuite/lib/lto.exp | 77 ++++++++++--------- 4 files changed, 68 insertions(+), 39 deletions(-) diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 3bccb1384d9..958682907cb 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -3729,6 +3729,29 @@ stands for zero or more unmatched lines; the whitespace after @end table +@subsubsection Scan object metadata with readelf + +These commands inspect the linked test output file with @command{readelf}. +They are mainly intended for LTO tests. + +These commands take a single @var{regex} and test whether it is present +in (or absent from, for @samp{-not}) the corresponding @command{readelf} +output. + +@table @code +@item object-readelf-attributes @var{regex} [@{ target/xfail @var{selector} @}] +Runs @command{readelf -A} and checks that @var{regex} matches. + +@item object-readelf-attributes-not @var{regex} [@{ target/xfail @var{selector} @}] +Runs @command{readelf -A} and checks that @var{regex} does not match. + +@item object-readelf-notes @var{regex} [@{ target/xfail @var{selector} @}] +Runs @command{readelf -n} and checks that @var{regex} matches. + +@item object-readelf-notes-not @var{regex} [@{ target/xfail @var{selector} @}] +Runs @command{readelf -n} and checks that @var{regex} does not match. +@end table + @subsubsection Scan optimization dump files These commands are available for @var{kind} of @code{tree}, @code{ltrans-tree}, diff --git a/gcc/testsuite/gcc.dg-selftests/dg-final.exp b/gcc/testsuite/gcc.dg-selftests/dg-final.exp index 6dcfd3340a8..ff8fdf6d77a 100644 --- a/gcc/testsuite/gcc.dg-selftests/dg-final.exp +++ b/gcc/testsuite/gcc.dg-selftests/dg-final.exp @@ -94,7 +94,10 @@ proc dg_final_directive_check_num_args {} { verify_args scan-lang-dump 2 3 - verify_args object-readelf 2 3 + verify_args object-readelf-attributes 1 3 + verify_args object-readelf-attributes-not 1 3 + verify_args object-readelf-notes 1 3 + verify_args object-readelf-notes-not 1 3 verify_args scan-assembler-times 2 3 verify_args scan-assembler-dem 1 2 diff --git a/gcc/testsuite/gcc.target/arm/lto/pr61123-enum-size_0.c b/gcc/testsuite/gcc.target/arm/lto/pr61123-enum-size_0.c index 4ccbeb39f43..36013040cdf 100644 --- a/gcc/testsuite/gcc.target/arm/lto/pr61123-enum-size_0.c +++ b/gcc/testsuite/gcc.target/arm/lto/pr61123-enum-size_0.c @@ -20,4 +20,4 @@ foo1 (struct debug_ABI_enum_size *x) return sizeof (x->es); } -/* { dg-final { object-readelf Tag_ABI_enum_size int { target arm_eabi } } } */ +/* { dg-final { object-readelf-attributes {Tag_ABI_enum_size:\s+int} { target arm_eabi } } } */ diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp index 2a7b8b0de93..b36ccded5d6 100644 --- a/gcc/testsuite/lib/lto.exp +++ b/gcc/testsuite/lib/lto.exp @@ -915,23 +915,21 @@ proc lto-execute { src1 sid } { initialize_prune_notes } -# Call pass if object readelf is ok, otherwise fail. -# example: /* { dg-final { object-readelf Tag_ABI_enum_size int} } */ -proc object-readelf { args } { +proc object-readelf { option is_negative directive args } { global readelf global base_dir - upvar 2 execname execname + upvar 3 execname execname - if { [llength $args] < 2 } { - error "object-readelf: too few arguments" + if { [llength $args] < 1 } { + error "$directive: too few arguments" return } - if { [llength $args] > 3 } { - error "object-readelf: too many arguments" + if { [llength $args] > 2 } { + error "$directive: too many arguments" return } - if { [llength $args] >= 3 } { - switch [dg-process-target [lindex $args 2]] { + if { [llength $args] >= 2 } { + switch [dg-process-target [lindex $args 1]] { "S" { } "N" { return } "F" { setup_xfail "*-*-*" } @@ -939,7 +937,7 @@ proc object-readelf { args } { } } - # Find size like we find g++ in g++.exp. + # Find readelf like we find g++ in g++.exp. if ![info exists readelf] { set readelf [findfile $base_dir/../../../binutils/readelf \ $base_dir/../../../binutils/readelf \ @@ -949,47 +947,52 @@ proc object-readelf { args } { verbose -log "readelf is $readelf" } - set what [lindex $args 0] - set with [lindex $args 1] + set regex [lindex $args 0] if ![file_on_host exists $execname] { verbose -log "$execname does not exist" - unresolved "object-readelf $what " + unresolved "$directive $regex " return } - set output [remote_exec host "$readelf -A" "$execname"] + set output [remote_exec host "$readelf $option" "$execname"] set status [lindex $output 0] if { $status != 0 } { - verbose -log "object-readelf: $readelf failed" - unresolved "object-readelf $what $execname" + verbose -log "$directive: $readelf failed" + unresolved "$directive $regex $execname" return } set text [lindex $output 1] - set lines [split $text "\n"] + set match [regexp -- $regex $text] - set done 0 - set i 0 - while { !$done } { - set line_tex [lindex $lines $i] - if { [llength ${line_tex}] > 1} { - incr i - if [regexp -- $what $line_tex] { - set match [regexp -- $with $line_tex] - set done 1 - } - } else { - set done 1 - } - } - - verbose -log "$what size is $with;" - if { $match == 1 } { - pass "object-readelf $what size is correct." + if { ($is_negative && $match == 0) || (!$is_negative && $match == 1) } { + pass "$directive $regex pattern is correct." } else { - fail "object-readelf $what size is incorrect." + fail "$directive $regex pattern is incorrect." } } +# Call pass if regex ($args 0) matches readelf -A output, otherwise fail. +# example: /* { dg-final { object-readelf-attributes {Tag_ABI_enum_size:\s+int} } } */ +proc object-readelf-attributes { args } { + object-readelf "-A" 0 object-readelf-attributes {*}$args +} + +# Call pass if regex ($args 0) does not match readelf -A output, otherwise fail. +# example: /* { dg-final { object-readelf-attributes {Tag_ABI_enum_size:\s+int} } } */ +proc object-readelf-attributes-not { args } { + object-readelf "-A" 1 object-readelf-attributes-not {*}$args +} +# Call pass if regex ($args 0) matches readelf -n output, otherwise fail. +# example: /* { dg-final { object-readelf-notes {AArch64 feature:\s+BTI,\s+PAC,\s+GCS} } } */ +proc object-readelf-notes { args } { + object-readelf "-n" 0 object-readelf-notes {*}$args +} + +# Call pass if regex ($args 0) does not match readelf -n output, otherwise fail. +# example: /* { dg-final { object-readelf-notes-not {AArch64 feature:\s+BTI,\s+PAC,\s+GCS} } } */ +proc object-readelf-notes-not { args } { + object-readelf "-n" 1 object-readelf-notes-not {*}$args +} From patchwork Wed Apr 8 09:12:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Muhammad Kamran X-Patchwork-Id: 132796 X-Patchwork-Delegate: tamar.christina@arm.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 440334BA2E1B for ; Wed, 8 Apr 2026 09:14:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 440334BA2E1B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=jGoOe6Tr; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=jGoOe6Tr X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010008.outbound.protection.outlook.com [52.101.69.8]) by sourceware.org (Postfix) with ESMTPS id D979B4BA2E31 for ; Wed, 8 Apr 2026 09:13:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D979B4BA2E31 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D979B4BA2E31 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=52.101.69.8 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1775639623; cv=pass; b=hDqk7rPb/cSUc3H5CIZoHBAe1ehbMVTFKJx69dlYUZh5RH6Uz5dIPqTpUJkF3Ewb1N0W2hPsNqXXDL829nmSwUDB0pHMfeEK/+rhmlVJzUTBQpsWSuZQbgC99Ajvy3Mg8YjWurmwLPi2wrVqdUqpdAOOCZBH70fXD3SHr9rADhw= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1775639623; c=relaxed/simple; bh=O8MEBB+hPQWa+OHUTzYK1l/MWXCZvNlwOMbcESFYDRw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=liyVA/lHSSviueLpUjhLTrcXQvG4jLqGeAjo/b5c26zKutADqgvEDCOrbiWqfkizMsohqgIK80RMRTL+mx+pl+GTvdo9hAsLyGQktz2cycsOYNEI6D/BB9u2w6DaZ+kx21vHz+uJDCMl5gj9MSbtktISAsJvt7WhEuu1OKAtgxg= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D979B4BA2E31 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=isPn3jAiSpo6iwocqVctDfi6ZhuQy2JuCbd6JHahLrqcJximsxMgsv5hgHLHjpMojSOeTMWutZk8VA3FIYKZy2O6LvXuXENbDxEtI7cyAF0yEROu/4toVWVqh5PNZ7FLgk4f4R+5bIhDAhNX0kgGTlbVWXCKrkQ+dtr8qYkGc5wl5VCEHOnhQJm5B6bm/NkN6CHmSv9JPLFw0KqeBcgyjxnXPTEmKAztnLOPLuPiM09iY2H2tR6zai6X9y0pMYmyd1O3v3ZDKf2IIK0HbhW+m7ckoR0rZko+AnhU/VA9IpRXM9Gavl6y9oKelP5OTiyxe+vF6xoxDF3iEpj5M7yWBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=br8qW9KOVPGOI8orn6T1chzfoqxiiW2EK4G5MC45sM4=; b=fZ0haGB+ljfe7LtHttf+Frur/j5EyVv1UaovnynGjlAVSemgSiuIzqZf3DzAC8tTSR5kGSMYofQyApgiGGLmUTaDCIAQhSmnxLZwLVIdLJAOIFjdIPLDUb14669wf70GgAG4w9iw9Mi3BP9vCoFpqonxSOlB54RJKbENml+axn6RYHjtFtoN70+enFXyURk8NWmd/s2xLOHVvgwCPHiPpGBlK0TMiMa46vfE+AWIQipUuQo+MNOLBpU84kOrrhGRIDXgL5Lz6ub/sp8dbaDKgvAQ94z9Y91lvU27OdjkXFkNykLhwMYPpGaa4uqhQe1p9Ax/f0Ai0G9ZbGZ8U21xcg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=br8qW9KOVPGOI8orn6T1chzfoqxiiW2EK4G5MC45sM4=; b=jGoOe6TrnSthivo543CWLK12hMNtE4ogjCKJALCXmJCni8x7k6P88+By7GeBpDUhuaiYekVf7rJcaZxclHUlI3PqfbCmpJb0e6o3fHicZ90ADBoY/fr+Go6I0ESDwFxA/mmgiY40m8cxpPvnZ2sLwmxYcY1Q2/og69fdXsioYfM= Received: from DUZPR01CA0146.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bd::9) by DU0PR08MB8729.eurprd08.prod.outlook.com (2603:10a6:10:403::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17; Wed, 8 Apr 2026 09:13:33 +0000 Received: from DU2PEPF00028D10.eurprd03.prod.outlook.com (2603:10a6:10:4bd:cafe::10) by DUZPR01CA0146.outlook.office365.com (2603:10a6:10:4bd::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.35 via Frontend Transport; Wed, 8 Apr 2026 09:13:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by DU2PEPF00028D10.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9745.21 via Frontend Transport; Wed, 8 Apr 2026 09:13:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NCxPN5PuPbee4qMCMFMr8tNw/NQqEb6X5nybroT9CS2XG6Ze+hxnWQsNhKnvHWtJw2VXBzyZEWXZ7slfrJ8UViRqc/sysawY/lq+TKc6UuL5sQScAExs5WMuLWjEXrPB26DKeXwWfpMN2uzHuplkJzlaUqzbKXJKIw3M4CEJTUPBm5wN6zj4kimubH9RvAVXuo7rmknPgaAdQAc2QKdtGNsQSi5YYxsvGv86SFINUs4hcP6qHPXEkXk0Ey0b5IAMfNkd5AA7JKExmBDGurAnyJOPgJnpwPGcYLwA9dWUFxFOYqIbTtUUcS/5FQmzwsS6kH4Fo8Vd7Sd6XZre6p4x2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=br8qW9KOVPGOI8orn6T1chzfoqxiiW2EK4G5MC45sM4=; b=Atiraj3MOx+7eSv0KGNblFNC9LJWE+2HTHVqMQt14gYLS+66T30lT62v/bWkqKYAreHB4hHMpJ7MzQim4WoDMenfIO+JIeWLFiHgsatwCnBu5RZm6Q09wN9+WgLm+2kiadxECeOkTPD7UxCUlbUih5DTPB1xqAY4EWRDYsDMqx1h+xbVP4DuJSBJ+XJ2ORV1nwCuNfOf18JyWoVoOmF9xjTO+bKtCcr+N9CH6muWdW+tSLRkuYU48np1RSQXiksw0X8MD/3gNGto1wbUaUN49RxqTsDgq+VtbLxmTL/6AjZKXYArpFPJb/j177ATj0QZ2O6CzeYbN6VMDN2o5rdYGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 172.205.89.229) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=br8qW9KOVPGOI8orn6T1chzfoqxiiW2EK4G5MC45sM4=; b=jGoOe6TrnSthivo543CWLK12hMNtE4ogjCKJALCXmJCni8x7k6P88+By7GeBpDUhuaiYekVf7rJcaZxclHUlI3PqfbCmpJb0e6o3fHicZ90ADBoY/fr+Go6I0ESDwFxA/mmgiY40m8cxpPvnZ2sLwmxYcY1Q2/og69fdXsioYfM= Received: from DUZPR01CA0139.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bd::14) by DU0PR08MB8932.eurprd08.prod.outlook.com (2603:10a6:10:467::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17; Wed, 8 Apr 2026 09:12:27 +0000 Received: from DU2PEPF00028D10.eurprd03.prod.outlook.com (2603:10a6:10:4bd:cafe::98) by DUZPR01CA0139.outlook.office365.com (2603:10a6:10:4bd::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.35 via Frontend Transport; Wed, 8 Apr 2026 09:12:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 172.205.89.229) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (172.205.89.229) by DU2PEPF00028D10.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9745.21 via Frontend Transport; Wed, 8 Apr 2026 09:12:26 +0000 Received: from AZ-NEU-EX03.Arm.com (10.240.25.137) by AZ-NEU-EX03.Arm.com (10.240.25.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Wed, 8 Apr 2026 09:12:15 +0000 Received: from ip-10-249-57-232.eu-west-1.compute.internal (10.249.57.232) by mail.arm.com (10.240.25.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29 via Frontend Transport; Wed, 8 Apr 2026 09:12:15 +0000 From: Muhammad Kamran To: CC: Richard Earnshaw , Tamar Christina , Kyrylo Tkachov , "Alice Carlotti" , Alex Coplan , "Andrew Pinski" , Wilco Dijkstra , Jakub Jelinek , Rainer Orth , Mike Stump , "Muhammad Kamran" Subject: [PATCH 2/2] aarch64/testsuite: add LTO coverage for branch-protection notes and attributes Date: Wed, 8 Apr 2026 09:12:02 +0000 Message-ID: <20260408091202.13538-3-muhammad.kamran@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260408091202.13538-1-muhammad.kamran@arm.com> References: <20260408091202.13538-1-muhammad.kamran@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF00028D10:EE_|DU0PR08MB8932:EE_|DU2PEPF00028D10:EE_|DU0PR08MB8729:EE_ X-MS-Office365-Filtering-Correlation-Id: 09165c06-6cdc-4190-10ed-08de954f1b93 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|82310400026|36860700016|1800799024|376014|13003099007|56012099003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info-Original: iIRhJD+/M9kwb4M27e5TTdp0ugTXZ8G5pcdyZuns1Y5WgCpR/xowghhZA3MYoV+tQqm+07HS+UjIrXPYdIwaZkZ3cjEn/TWcDoTbUWsrj0VhZZRP4tlOBYmo671Qa9Gz0BraNtvIIQYR/HGhVz6hk+gZwun8SWRXZlVLiVZ+FNIMYGxI9BRZ+q/1o+BmWAqPgPYDBasNyS6e1tvq958wEAbq4xmxM+5NyR0xcrxVo5TbqvnNtcnt4A7cAPPUyTqitOSZ/NSqknQeaQzY/bO3DEGZN/TwkwGVXPChKWOyR20Zd0R0/ieKgK+OgKETDSD53fektPMsh3aRrZ94jRqOvgmqjtxzZYCN3SkT+Ht/SNQivh8cNmK5AWlQUxDJ+k69ePaESyTA+kWV83Uq1RYKyfiNJhaEv6G59titPywdEaaKdOxtj/p7vzW44p8tjip71xcQ1soELG06MMvKUa70IneleS8EJMV/1uTZZTKDCo/05OlQ6xpRvVW2GN0zzfLjvwivqtADcNvRh0pqnZX3qU+TQ0VHnmrzPh5OsRq/iee5T5U8rOy5e7127u7jc+MCtKoWBvBDvzx1S5iVdavSzTPIIYaIEFxA2rLNnKftwqxqDqJtdJTRYXeWEWB2pjOPTdK21nny8lAI/UFn46ekG0WR/0XnuX9m5Vvfu2TiqQQri7QGS7qupHukGkz2L+l34817oRvXxtJLgKRTnoGIgCse6H3GQGZsvqebgsgvpUI= X-Forefront-Antispam-Report-Untrusted: CIP:172.205.89.229; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700016)(1800799024)(376014)(13003099007)(56012099003)(18002099003)(22082099003); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: H8AyWl7dc4ZEMqZGFVbpB4J3cIytP3eUWxik3m4V/nYc0XHWIImvSqUJprw8LIN8knBWjnxkHq1C0WpFSbtHtxOjuIZGchW98/wiwrgis0cgM+cLj1Lm6R7GbbZCi51Gm5PZzB81yEt6oFmD3j8+ZBQfr0LrYRpIwfMDyvgE7K+qUO/IKLVtCE0IksidZ+OahEEOSechMkUtt93yqbdFNY3u0mSPQt1owCP3TD/9HhfuTe+w8sltMgnKAYsidvz7uU18KplreE92wXoY4USIWQay7pZ+C2DXqIKTWOqqgpZOy+4CO26J4+Yhm5UNyaZYcyzglXJZRZRtNkwpOrnNAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8932 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF00028D10.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6a2be441-1d3a-4dc0-d9fb-08de954ef3f8 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|14060799003|36860700016|1800799024|376014|35042699022|22082099003|13003099007|18002099003|56012099003; X-Microsoft-Antispam-Message-Info: bMJIXjWby/9omAFnBlHXywVmfHqilouqMxdq8AcjiKAwS0pdkBhZlsjS6NZDXh84xWt5fzoSIiiSyn/MgrxMS1rG+TuYF6tIiQ82McX8htz+dBYnWDVc/LnhF56wiW9aRJeXzPbqTd6xRMtAFIbYfFEGZbESuo2weRHJZpjz0LH6QocnNfU4/w82Nxw65dEhs+/VpA7q2hiCJ3ASSKeujpXNZsTNYuYQf6jlpl7BbRZsCZ7xrrkA5NtbB3kbPXK+tVCmMFXdVRlAWBoBzq6zisZioSy9WAyszwJ7L/XXP8ngNLwEZeY16qJt+NpKWqjhToMvYXAYn8e9UmarIR8clVE+BJaXQmqKx+VsnBlhJxM7RLJSraosD3oCO4ByD3A220KJtA1vqOJWp1pB3yrSr/y/lBU8fU62ZGsuYIskYR6XhN4RWYEOZEjb57gOOwsMp5GSxxCjY6pdL2jjZTFWuKIyv4eI5k2mcI+1u4hTIpVrPLvyLXKnPffFZ1xCqmbcicS8gjMK6Sen8T7cWQpnM3TuY7/efJWPnzDkgC0i3LbUzRIHkx+nDfC2BkFpFb4grprMnszdlbvEL+lYXh7PQvtOAYHRmSpzXBNadI82D896CHvIXB8iIMnB4RYj75oxA4vv2+jyQo5egaU3XpyiTwl96y24v3FlArwqV4AHHn6s9L5R5QJN0D1cczxkKfbSq7j1hlq9mEDeSp6wTp+bH6gXN1iO8QIDi5eOJ6Jkk2Y= X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(14060799003)(36860700016)(1800799024)(376014)(35042699022)(22082099003)(13003099007)(18002099003)(56012099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mFTbTPjLVdVz5vhj0za4LH1DXwKPTXTvDlOQuUceEvFWaWzn//6eRAxoDXZKd6W55szkj1zbI+kJK3fr6C6WKk+mtEvtwIqVBNOvbUEa95Y93RyRT1XoKExnrBMLodUF4XKdXr5T8HZ3WT2PBssonPhmmEwgNT91NihqRodvT6GZ8uuZc9q/7fw0Vo/B+XQwcYSGb7NLmO6Qr9lKCPBxH0cal4AMP69xasCRCCwv7zgrhb0OjXOWGsZtINs26U88pk+WmL+Nku2ag/X5WkjvkTUjSZ4F6Si3cbPecDpmGKIxZSRTKCh6MVtvf0gKcfkbIsUwWpB1HDWsw9oP7UXOHhoyapQbG7G6ApfUyDiu45XXRri05Nx/GjqeQ6c7RxdOGTQh9nLpB2a8XTeFWdv0dXZQRkhWgfrp5Bf91UKuRZ4Ww0TAULV7reqOUjBLj8M1 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2026 09:13:32.9688 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09165c06-6cdc-4190-10ed-08de954f1b93 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF00028D10.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8729 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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~patchwork=sourceware.org@gcc.gnu.org Recent binutils (e.g. 2.46) switched AArch64 branch-protection emission from .note.gnu.property to build attributes (Tag_Feature_BTI, Tag_Feature_PAC, Tag_Feature_GCS) when GCC is configured with such toolchains. PR target/124365 exposed an issue where -flto with -mbranch-protection=standard caused loss of branch-protection metadata in build attributes. This was due to an LTO bug, now fixed upstream (8b39ec70741b7fb9d059b6944f30a6743dea996a). Add tests to verify both forms in LTO builds, covering: • older binutils behaviour (.note.gnu.property), and • newer binutils behaviour (build attributes). This ensures branch-protection metadata is preserved across LTO for both toolchain configurations. PR target/124365 gcc/testsuite/ChangeLog: * gcc.target/aarch64/lto/lto.exp: New DejaGnu test driver for LTO tests for aarch64. Copied from gcc/testsuite/gcc.target/arm/lto/lto.exp with minor changes. * gcc.target/aarch64/lto/pr124365-build-attributes-1_0.c: New test for build attributes with branch protection. * gcc.target/aarch64/lto/pr124365-build-attributes-1_1.c: Companion source file for the LTO test. * gcc.target/aarch64/lto/pr124365-build-attributes-2_0.c: New test for build attributes without branch protection. * gcc.target/aarch64/lto/pr124365-build-attributes-2_1.c: Companion source file for the LTO test with branch protection enabled. * gcc.target/aarch64/lto/pr124365-gnu-property-1_0.c: New test for `.note.gnu.property` with branch protection. * gcc.target/aarch64/lto/pr124365-gnu-property-1_1.c: Companion source file for the LTO test. * gcc.target/aarch64/lto/pr124365-gnu-property-2_0.c: New test for `.note.gnu.property` without branch protection. * gcc.target/aarch64/lto/pr124365-gnu-property-2_1.c: Companion source file for the LTO test with branch protection enabled. --- gcc/testsuite/gcc.target/aarch64/lto/lto.exp | 61 +++++++++++++++++++ .../lto/pr124365-build-attributes-1_0.c | 18 ++++++ .../lto/pr124365-build-attributes-1_1.c | 5 ++ .../lto/pr124365-build-attributes-2_0.c | 18 ++++++ .../lto/pr124365-build-attributes-2_1.c | 6 ++ .../aarch64/lto/pr124365-gnu-property-1_0.c | 16 +++++ .../aarch64/lto/pr124365-gnu-property-1_1.c | 5 ++ .../aarch64/lto/pr124365-gnu-property-2_0.c | 16 +++++ .../aarch64/lto/pr124365-gnu-property-2_1.c | 6 ++ 9 files changed, 151 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/lto.exp create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-1_0.c create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-1_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-2_0.c create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-2_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-1_0.c create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-1_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-2_0.c create mode 100644 gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-2_1.c diff --git a/gcc/testsuite/gcc.target/aarch64/lto/lto.exp b/gcc/testsuite/gcc.target/aarch64/lto/lto.exp new file mode 100644 index 00000000000..0c72d343174 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/lto.exp @@ -0,0 +1,61 @@ +# Copyright (C) 2009-2026 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Exit immediately if this isn't an AArch64 target. +if ![istarget aarch64*-*-*] then { + return +} + +# Test link-time optimization across multiple files. +# +# Programs are broken into multiple files. Each one is compiled +# separately with LTO information. The final executable is generated +# by collecting all the generated object files using regular LTO or WHOPR. + +if $tracelevel then { + strace $tracelevel +} + +# Load procedures from common libraries. +load_lib standard.exp +load_lib gcc.exp + +# Load the language-independent compatibility support procedures. +load_lib lto.exp + +# If LTO has not been enabled, bail. +if { ![check_effective_target_lto] } { + return +} + +gcc_init +lto_init no-mathlib + +# Define an identifier for use with this suite to avoid name conflicts +# with other lto tests running at the same time. +set sid "c_lto" + +# Main loop. +foreach src [lsort [find $srcdir/$subdir *_0.c]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + lto-execute $src $sid +} + +lto_finish diff --git a/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-1_0.c b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-1_0.c new file mode 100644 index 00000000000..c2819532f3f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-1_0.c @@ -0,0 +1,18 @@ +/* PR target/124365 */ +/* { dg-lto-do link } */ +/* { dg-skip-if "" { ! aarch64*-*-linux* } } */ +/* { dg-require-effective-target aarch64_gas_has_build_attributes } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-lto-options { { -flto -O2 -mbranch-protection=standard } } } */ +/* { dg-extra-ld-options "-nostdlib -nostartfiles -Wl,-e,main" } */ + +int foo (); +int +main (void) +{ + return foo (); +} + +/* { dg-final { object-readelf-attributes {Tag_Feature_BTI:\s+1\s+\(0x1\)} } } */ +/* { dg-final { object-readelf-attributes {Tag_Feature_PAC:\s+1\s+\(0x1\)} } } */ +/* { dg-final { object-readelf-attributes {Tag_Feature_GCS:\s+1\s+\(0x1\)} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-1_1.c b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-1_1.c new file mode 100644 index 00000000000..8f8b1830bac --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-1_1.c @@ -0,0 +1,5 @@ +int +foo () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-2_0.c b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-2_0.c new file mode 100644 index 00000000000..091ecc83637 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-2_0.c @@ -0,0 +1,18 @@ +/* PR target/124365 */ +/* { dg-lto-do link } */ +/* { dg-skip-if "" { ! aarch64*-*-linux* } } */ +/* { dg-require-effective-target aarch64_gas_has_build_attributes } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-lto-options { { -flto -O2 -mbranch-protection=none } } } */ +/* { dg-extra-ld-options "-nostdlib -nostartfiles -Wl,-e,main" } */ + +int foo (); +int +main (void) +{ + return foo (); +} + +/* { dg-final { object-readelf-attributes {Tag_Feature_BTI:\s+0\s+\(0x0\)} } } */ +/* { dg-final { object-readelf-attributes {Tag_Feature_PAC:\s+0\s+\(0x0\)} } } */ +/* { dg-final { object-readelf-attributes {Tag_Feature_GCS:\s+0\s+\(0x0\)} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-2_1.c b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-2_1.c new file mode 100644 index 00000000000..15f7c94dccb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-build-attributes-2_1.c @@ -0,0 +1,6 @@ +/* { dg-options "-O2 -flto -mbranch-protection=standard" } */ +int +foo () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-1_0.c b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-1_0.c new file mode 100644 index 00000000000..fca83daa0c8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-1_0.c @@ -0,0 +1,16 @@ +/* PR target/124365 */ +/* { dg-lto-do link } */ +/* { dg-skip-if "" { ! aarch64*-*-linux* } } */ +/* { dg-skip-if "" { aarch64_gas_has_build_attributes } } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-lto-options { { -flto -O2 -mbranch-protection=standard } } } */ +/* { dg-extra-ld-options "-nostdlib -nostartfiles -Wl,-e,main" } */ + +int foo (); +int +main (void) +{ + return 0; +} + +/* { dg-final { object-readelf-notes {AArch64 feature:\s+BTI,\s+PAC,\s+(GCS|)} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-1_1.c b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-1_1.c new file mode 100644 index 00000000000..8f8b1830bac --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-1_1.c @@ -0,0 +1,5 @@ +int +foo () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-2_0.c b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-2_0.c new file mode 100644 index 00000000000..728ad8e1ea1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-2_0.c @@ -0,0 +1,16 @@ +/* PR target/124365 */ +/* { dg-lto-do link } */ +/* { dg-skip-if "" { ! aarch64*-*-linux* } } */ +/* { dg-skip-if "" { aarch64_gas_has_build_attributes } } */ +/* { dg-require-effective-target mbranch_protection_ok } */ +/* { dg-lto-options { { -flto -O2 -mbranch-protection=none } } } */ +/* { dg-extra-ld-options "-nostdlib -nostartfiles -Wl,-e,main" } */ + +int foo (); +int +main (void) +{ + return 0; +} + +/* { dg-final { object-readelf-notes-not {AArch64 feature:\s+BTI\s+PAC\s+(GCS|)} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-2_1.c b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-2_1.c new file mode 100644 index 00000000000..15f7c94dccb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lto/pr124365-gnu-property-2_1.c @@ -0,0 +1,6 @@ +/* { dg-options "-O2 -flto -mbranch-protection=standard" } */ +int +foo () +{ + return 0; +}