From patchwork Mon Oct 14 10:17:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Khrustalev X-Patchwork-Id: 98839 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 297AE3857711 for ; Mon, 14 Oct 2024 10:19:36 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20613.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::613]) by sourceware.org (Postfix) with ESMTPS id 056753858C31 for ; Mon, 14 Oct 2024 10:18:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 056753858C31 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 056753858C31 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2606::613 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1728901140; cv=pass; b=bFfPr2B37L1PmdkQnuZOxGRnrEI9nf/uzJlU04niKtkvwnW1Ods2kz9un0ZwhAklL8DC9xFEgV5nTwWUTI759w4tB7XqT4j+AwXg+JFhSjUIsBkOCR/FGHT1jf2iPT9vfa5XBIwoAh8hrS06Bcg2897so0e9vQBY0MtvuXyY0LY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1728901140; c=relaxed/simple; bh=wOop6V+TnqEbWFkSmyOwejipWcKhnftuaLiJyYcX+5k=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=NGhd+t7fC1K3/3w1+0KhK6yteXn5MA061uijyy5/6O1ey2PWlppmgIg67d6LTwH0XYrVnxuoWgOyjHSjd9eOKqBarO2tIfxd9s4TcvfaBYkJdqkMno9u73Vcf3S8Qk3T6acyMvXHZ6xv/t4oanwkp+7Z6QGhsWhVllHmQUPBykM= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=qKWXGhnHn/q2yrlqzPzvqWk9Y0SNjb38hlwyrteZbLeZWxRGFa+FrDujpAvj4ILD+vHCatsEMHSMuNxQ/tezzkN/r1mqZ+UZxv/Adjcs/ACrQNlpOavFGBfzUfg/9t5mU9Xg+ese4A33bfjgL6rMhMdQFZhT3u3cCkiiTZYevB/hchG9NncvFSgiREPWsY7Q2g3j+J/n0fDp4RrlhbUw0Q0aUv0oqHEugLuaNY8IHcXvts0Lj7SZAW/upjs0xB5Y5UzUUXY7oOViZFKA3+y/qk1ZH2lEFeBt5MV7IpjDA/gWOKUb63kjN9sqP4Ko0LAq4WNyjhMDTquXr8Sb1dAnLQ== 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=nHimOGa8BW5XSDG2hNFRGVhyAyf06xcciRfEmOFMZvc=; b=gU4ZbFgD2YXUs+SINA463mYWJi7Fc3LXHUQZ2PUczuHZ5iKXD3jrA58tEcnPwS1mh+Mc9qrboi3bcVPg+XEmzX+ffmzxyXYwFgLFRID+fVd73mWKp7CSbB9o8gVTL5gnvsFzUCqwSXydY9L1b4OI0Mq1S149dst9PcPte09dwVTtAaf+Vahr4/D9wfqBqklsHboPjyqquuV4W3C7/X6DJkvgEChq7Yb7j7L3u9xKjqdQxqIsd0il9RrODksBbl7VROP/twOz5y4X4+ypohZimYnWlqS3ChPwn9qPd6VHuvUGA7C8CdV8F3SRClDjGhx+QCfqI9roMu9/IyToYhZZXA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.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=nHimOGa8BW5XSDG2hNFRGVhyAyf06xcciRfEmOFMZvc=; b=IxfdIyE3yEkKT6MKH8AyXjgx3aHBpifIieylRAH+roj3rWDJ6GgIJa4GqD/ZKOAxuM9dAFezXjK/qgwUFc+I4s11g5SC7TC4MLE3/VAAxI2pku4KSnsPR1CKZ8budG1tNQiGGu7XzvIK2KccDIQ07tOZTd8p59J7W89KWsO81nc= Received: from AS9PR05CA0258.eurprd05.prod.outlook.com (2603:10a6:20b:493::29) by DU4PR08MB11030.eurprd08.prod.outlook.com (2603:10a6:10:576::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Mon, 14 Oct 2024 10:18:39 +0000 Received: from AM2PEPF0001C716.eurprd05.prod.outlook.com (2603:10a6:20b:493:cafe::91) by AS9PR05CA0258.outlook.office365.com (2603:10a6:20b:493::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Mon, 14 Oct 2024 10:18:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) 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 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM2PEPF0001C716.mail.protection.outlook.com (10.167.16.186) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Mon, 14 Oct 2024 10:18:38 +0000 Received: ("Tessian outbound da7ba6582322:v473"); Mon, 14 Oct 2024 10:18:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: fa1e0ec1a2ce0359 X-TessianGatewayMetadata: 0QD/Qb2FIReG6swY37j2A05VCDwetMQPZ3da5CHKfExInxzg5C5moFii36rki5/ssY020ZQzL1v+LKQqdMFqOaDuZIrlH4z6w9xKRFxC0b02xhQwZCvDkLgTmJCmZ9ZFS9mZkBMmdKduR5HGTWv/5nxCKKu0w/+X1L04Tdhi1QM= X-CR-MTA-TID: 64aa7808 Received: from Lac9956d23677.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 69F51222-BE4F-4AC5-B4AC-BD850CD5CA84.1; Mon, 14 Oct 2024 10:18:29 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lac9956d23677.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Oct 2024 10:18:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UEKQ0OOuD5ZieIVh3NkFMfb+33KwRvOSMNTLs1UyfTrM9e0crMnDMw1ZnQGbJ8Sqaprtxs4fTHz/A544925p6xiamZjWfQXXChX2uK/IaWIUOMIMb+OSvqytn0S7vLZbCQsczaacNSS1tLLWB3zjscqnUmtlPcMd2j6Tj5snbaxM2/jUktC4+8Hq2V+EFu6ed23aE1wJdGSEcib/3UDC4JO1sc8kDGzRIqqSm/J2ELVx3QdVcTtINKZSp73KXjLMJy78egkjntoN4GHQJzrOHOIl5vUvmQTIXVPEisbA3+iRnb9DXxcfzp+pYl65NrGZA8VALdRBoPWS023OtGKo9g== 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=nHimOGa8BW5XSDG2hNFRGVhyAyf06xcciRfEmOFMZvc=; b=HOjn+zOxqG2TshZugjKJY1fhjiuPg7qm+ZJLAR2YywkpjGGXH0kA3/MtMAg/hlcDUakiS7LbRQiLKIvj3FvP2Dq1cZva+/YbwTU0WlvxsOLQPcG1+BQNZWcl5q1L6PJcJWaHWy5AIe1e4sBYoqExp1fR23zGG3I21vd8CwH2uyTbokZlfJreURk6A3jqAv+Pu9McdsO7CMpE+pveg0Z5VsazGbAHbJkB6pysapJKGSkqpyfYyJjSC9l1qSCXjVsW3GlMEj8yLpF1enEc07b5kYN8Jxn3TIUEBlXZ3k0zXDGmbYxrDrEWDPCeyr4X+Sq6R4Mt3iK/ULa12Wj6sDoRNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.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=nHimOGa8BW5XSDG2hNFRGVhyAyf06xcciRfEmOFMZvc=; b=IxfdIyE3yEkKT6MKH8AyXjgx3aHBpifIieylRAH+roj3rWDJ6GgIJa4GqD/ZKOAxuM9dAFezXjK/qgwUFc+I4s11g5SC7TC4MLE3/VAAxI2pku4KSnsPR1CKZ8budG1tNQiGGu7XzvIK2KccDIQ07tOZTd8p59J7W89KWsO81nc= Received: from DUZPR01CA0025.eurprd01.prod.exchangelabs.com (2603:10a6:10:46b::13) by GVXPR08MB11153.eurprd08.prod.outlook.com (2603:10a6:150:1f8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 10:18:18 +0000 Received: from DB5PEPF00014B95.eurprd02.prod.outlook.com (2603:10a6:10:46b:cafe::11) by DUZPR01CA0025.outlook.office365.com (2603:10a6:10:46b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26 via Frontend Transport; Mon, 14 Oct 2024 10:18:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) 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 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DB5PEPF00014B95.mail.protection.outlook.com (10.167.8.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Mon, 14 Oct 2024 10:18:18 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 14 Oct 2024 10:18:10 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX06.Arm.com (10.240.25.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 14 Oct 2024 10:18:09 +0000 Received: from udebian.localdomain (10.1.28.139) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 14 Oct 2024 10:18:09 +0000 From: Yury Khrustalev To: CC: , , , , Subject: [PATCH v4] aarch64: Add support for GCS to AArch64 linker Date: Mon, 14 Oct 2024 11:17:43 +0100 Message-ID: <20241014101743.3222246-1-yury.khrustalev@arm.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB5PEPF00014B95:EE_|GVXPR08MB11153:EE_|AM2PEPF0001C716:EE_|DU4PR08MB11030:EE_ X-MS-Office365-Filtering-Correlation-Id: 012523ef-8e82-4a56-804e-08dcec39921c X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr 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|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info-Original: nGdPjPJSmFH8R6qS1/ddX/ZfOFjvsKoePx6fn8VDoZRDMj2LegAG3WUKdSseCMB5Am7OOISokuKOPTadeiJ66q1OvibrdwOFuUzY1X2/pqA3WSfuepW5fbMXhhok3PNU9VwdRB5n05MQ10b/mejxpiOH5hc2PPB8+Qy3whgYccYs1sd5NX7/O4wgOGrltT5qdRakXCTx8Zv2qQzs5h8haZNZubdp7BFP59f4jFf3HMHYhSpv8LsPU1XUgZOmk7+1wkiyDQFgvmmHmcy1g95v48vDFndU8bLFMWRW2ahFx0bTf1dpR63CWeKyT3sArviet//KvjaIiTQBQztbrI2K5Krik8jc1yiO0eJxJ0mwOUp4AWfDEIxDNmLJUP+nWdwrntZ8S335hdw9nduTirEnDMGbUMTrDrL9fOK//SFTSj6EEwVUptdBshJ7O3FahPVWh3w44e1ZutKgPqKzOdyiZRthPT4eyalbJhNYaeYQsSQvojvpN8Ob+b1hVs431MCMuUSp5HD8U5Vjf3lAVMLZ1/F2ojCeeZ6hbnRqTvTsEjV8ubs4A4GaGnw/MJF5+nmcr+hhwrqhjw5Ng3FQYiwg4fPdaR3fMg6fn/g2SM7vkx+fjaYFEw9XTtcSiURIFt+wiTJKYnOJq/sVJSUlm+onY+diI0tmKFg8lMiKxUWQG40/+iyMeOQJBXdQsRnD3szXscDJ1cQ188dxa8uO5+ctEL8nBBqtZXGRBx4BSqPrUQnz0O5WihI3/pUcqHxkCWBRkk687F+OMkcZIMgGv6vAUUR18LahiCiHYsyi/ozGgWlQwAnUmxuOC3ppa31RblMD8TLSrpC5brIkUsilzkAhHCbHCMrz5HOPrKmtgMTm8/cArFReRa3T1mADlIMijaGw+rrwS6MeuF8NAdKDAOp2M52li3y38tWU1N0CtThTWfUVXEkZphX0ZJ4nz/WE/zpjlXB3DOgEhxw5vG9vqtKmRgWQPqY/lgzpJqVyw1cWVTbEpkEF725coGQTAzg6/QUJ7OkIBkM3djpsofE+wk4MTIr+mgmHk1WwrlFug8Dy55J9qTIcuqlhaeNCwQsRw394zZA7j3OQVgM0rJL7YAQv/Se4+wsUY7stjnfG26kWqSLHtnQ8BAF8AIjql4dEsC8L6a95q+kj/a3KHU1b7RtDPotxvApujOASf8PlE8D3ji8pABSbmDBdSaRM4QZ3io9GAJTELpUHHSt6ifsEZqdX2AnRWobydzWMkGbVFiH/pYudORwZWAomvvqQohZ12nwZPlcWgC2m+62/QACHx/ZjO8rKIoJIsinvZay5Rbs2jB6Y2XqNMwHp4/f1bf4w7WwKrGkcKVtzxlMcEiGP+twGlTDRaxB7RjqoUNPsIc3EtM3fLaLumwx5oNuP1E0asmrw X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB11153 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:10:46b::13]; domain=DUZPR01CA0025.eurprd01.prod.exchangelabs.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM2PEPF0001C716.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0146337d-ff7b-47b7-e8aa-08dcec3985c7 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|35042699022|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: +ZCouRoWeyxmOqqF39IzXcLV+UrA+4sLDvE/JmaJ3Clur83mxK66YcgqNCayhDhk3EuIFfrMywwaCGORyw8/xge9HlBNrTN1WG7lajj2D4wbgxC6hm9efXg494k0VX7s9OOmg7LEiJv1DvPZouOpMPguk6/M7kt2twxPRkYzYmy1mDKVjBrvlo9d+uK97eVGz6KakVVHs7xZ+CiPo3Nbn38rPNshD7n1lrFRFRrUwotgpBS/P2jGwPWzOAvkphBaSCDP7yQmBKdiBwJKmHo8QSG/F35HFHHIJA8QZ7Y/eOroRqwtpvhvQi476nXbGSGTB+ueHuGUHxstF7Pqh2T8yzaS7J2FW7D442bMmZFjGoZTOx/GoJeLcvRDazyco3QHMp+emDWaWVR9aBDVBmqgSWNp+/xN+ABUym+qj7nw2M8G+myxWoa0J0WvQRuoUqJL7KNZ99hC6uKc/fDAR1eH90sWp5lwTwvh0SAX/Te9TwUR3b5pcINyi3XsTKLqkj0yiumBfNjF61xWldJZ8D+/sc/PKkNUNkZptS6CkrKZHk1kKjyebD8Cg8P0E0ZMRkatlPUk3OPKK6EhohI0mWfZ4IsTU0qssGWN4Hz4wiGTjZ/mVc0gqmSixlXgi6S+ocuzRJqlvcd4gr28E3k2AqwP5VXhQFaMVWmeOSM69aOBWoJzpP8yqTwOyF8cWUdv74Edxmng4rru6ZQdZ29h0i+x0BZKcWmcL2um0qiCZoP8ZQQTgYlmibvlvJPA/vk7xwJquefMDw7PpqYtSnfHCbUcLWlQrezQqKa98kpa85quMOmK/H3YBlwMVoI7oPzT806YzaUXNVdLpT805pECHIq7A1Acea+U81k1C1PacZI/GHL8IPbXmCAIeDuJeUQfmDBSpVBZxejLZuhobq9A16jQ5ZG7IKS64OREtptXhwz41VH25rmrFDHBJePDrQ+3+FoOirxuVFbwQ2bvILrzqETu09hN3m37Qvo04FuMUpC4i1Imz2GzD5uVkUMjQPenT48XqY8erXBngeX6OuyiIi3gkqIlIWNQXh2k7jP2PiySzVS5ArVXzc9NdmocMOdBVi5+DIl3GzsX2BH5eCaJsBN9GhunHntkD2ppC30DjYLpmted1KYqLNYkBzPLmjONYEB2Kt+fbOKS2zgRzkWmA9bIA94jquU4CigFHc8o8g1lyTt83AFntkraWyfI5QP7OtppgJA+PqYCwIr+QFSZu10dBl2UNRpX+U/b71hVKliu1IWphNjEBI/N1itPKiXWkRuGWCf9S8SBSjXrkILoT9ox0Hxi7hfczyw68fFQA0c4ehVeMfy9Wvj6gOLzTc33llEE7YZXTFgBpJbru+I5EjT9ab1ALrZhkdJrIFMJc3VQWT4KI47oabz+TCsbRjrcRaaT X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230040)(376014)(36860700013)(35042699022)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 10:18:38.7775 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 012523ef-8e82-4a56-804e-08dcec39921c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM2PEPF0001C716.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4PR08MB11030 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org From: Srinath Parvathaneni This patch adds support for Guarded Control Stack in AArch64 linker. This patch implements the following: 1) Defines GNU_PROPERTY_AARCH64_FEATURE_1_GCS bit for GCS in GNU_PROPERTY_AARCH64_FEATURE_1_AND macro. 2) Adds readelf support to read and print the GNU properties in AArch64. Displaying notes found in: .note.gnu.property [ ]+Owner[ ]+Data size[ ]+Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: AArch64 feature: GCS 3) Adds support for the "-z gcs" linker option and document all the values allowed with this option (-z gcs[=always|never|implicit]) where "-z gcs" is equivalent to "-z gcs=always" and when this option is not passed in the command line, it defaults to "implicit". 4) Adds support for the "-z gcs-report" linker option and document all the values allowed with this option (-z gcs-report[=none|warning|error]) where "-z gcs-report" is equivalent to "-z gcs-report=none" and when this option is not passed in the command line, it defaults to "none". The ABI changes adding GNU_PROPERTY_AARCH64_FEATURE_1_GCS to the GNU property GNU_PROPERTY_AARCH64_FEATURE_1_AND is merged into main and can be found in [1]. [1] https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst Co-authored-by: Matthieu Longo Co-authored-by: Yury Khrustalev --- Changes in v4: - Improved parsing of linker command line options (COMPILE_TIME_STRLEN macro). - Renamed aarch64_bti_pac_info into aarch64_gnu_prop_info. - Fixed type missmatch warning / error for gcs_type parameter. - Removed prefix "experimental" from GCS-related linker flags. Link to v3: https://inbox.sourceware.org/binutils/20240911130344.1230746-1-srinath.parvathaneni@arm.com/ Regression tested on the aarch64-none-linux-gnu target and no regressions was found. Is this OK for trunk? I do not have commit rights, if OK, can someone commit on my behalf? --- bfd/elfnn-aarch64.c | 93 ++++++++++++++++----- bfd/elfxx-aarch64.c | 37 +++++++- bfd/elfxx-aarch64.h | 36 ++++++-- binutils/readelf.c | 4 + include/elf/common.h | 1 + ld/emultempl/aarch64elf.em | 58 +++++++++++-- ld/testsuite/ld-aarch64/aarch64-elf.exp | 23 +++++ ld/testsuite/ld-aarch64/property-bti-pac1.d | 2 +- ld/testsuite/ld-aarch64/property-bti-pac1.s | 14 ++++ ld/testsuite/ld-aarch64/property-gcs.s | 25 ++++++ ld/testsuite/ld-aarch64/property-gcs1.d | 6 ++ ld/testsuite/ld-aarch64/property-gcs10.d | 6 ++ ld/testsuite/ld-aarch64/property-gcs11.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs12.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs13.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs14.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs15.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs16.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs17.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs18.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs19.d | 6 ++ ld/testsuite/ld-aarch64/property-gcs2.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs2.s | 33 ++++++++ ld/testsuite/ld-aarch64/property-gcs20.d | 6 ++ ld/testsuite/ld-aarch64/property-gcs21.d | 6 ++ ld/testsuite/ld-aarch64/property-gcs22.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs3.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs4.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs5.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs6.d | 12 +++ ld/testsuite/ld-aarch64/property-gcs7.d | 6 ++ ld/testsuite/ld-aarch64/property-gcs8.d | 11 +++ ld/testsuite/ld-aarch64/property-gcs9.d | 12 +++ 33 files changed, 506 insertions(+), 34 deletions(-) create mode 100644 ld/testsuite/ld-aarch64/property-gcs.s create mode 100644 ld/testsuite/ld-aarch64/property-gcs1.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs10.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs11.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs12.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs13.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs14.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs15.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs16.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs17.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs18.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs19.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs2.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs2.s create mode 100644 ld/testsuite/ld-aarch64/property-gcs20.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs21.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs22.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs3.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs4.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs5.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs6.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs7.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs8.d create mode 100644 ld/testsuite/ld-aarch64/property-gcs9.d diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 94c9a01069b..e4c2f558844 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -2546,6 +2546,12 @@ struct elf_aarch64_obj_tdata GNU_PROPERTY_AARCH64_FEATURE_1_BTI. */ int no_bti_warn; + /* Mark output with GCS based on -z gcs. */ + aarch64_gcs_type gcs_type; + /* Report linker warning/error for -z gcs-report based on + -z gcs. */ + aarch64_gcs_report gcs_report; + /* PLT type based on security. */ aarch64_plt_type plt_type; }; @@ -5024,7 +5030,7 @@ bfd_elfNN_aarch64_set_options (struct bfd *output_bfd, int fix_erratum_835769, erratum_84319_opts fix_erratum_843419, int no_apply_dynamic_relocs, - aarch64_bti_pac_info bp_info) + aarch64_gnu_prop_info gnu_prop_info) { struct elf_aarch64_link_hash_table *globals; @@ -5041,7 +5047,7 @@ bfd_elfNN_aarch64_set_options (struct bfd *output_bfd, elf_aarch64_tdata (output_bfd)->no_enum_size_warning = no_enum_warn; elf_aarch64_tdata (output_bfd)->no_wchar_size_warning = no_wchar_warn; - switch (bp_info.bti_type) + switch (gnu_prop_info.bti_type) { case BTI_WARN: elf_aarch64_tdata (output_bfd)->no_bti_warn = 0; @@ -5052,8 +5058,26 @@ bfd_elfNN_aarch64_set_options (struct bfd *output_bfd, default: break; } - elf_aarch64_tdata (output_bfd)->plt_type = bp_info.plt_type; - setup_plt_values (link_info, bp_info.plt_type); + + switch (gnu_prop_info.gcs_type) + { + case GCS_ALWAYS: + elf_aarch64_tdata (output_bfd)->gnu_and_prop + |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + break; + case GCS_NEVER: + elf_aarch64_tdata (output_bfd)->gnu_and_prop + &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + break; + + default: + break; + } + + elf_aarch64_tdata (output_bfd)->gcs_type = gnu_prop_info.gcs_type; + elf_aarch64_tdata (output_bfd)->gcs_report = gnu_prop_info.gcs_report; + elf_aarch64_tdata (output_bfd)->plt_type = gnu_prop_info.plt_type; + setup_plt_values (link_info, gnu_prop_info.plt_type); } static bfd_vma @@ -10619,7 +10643,12 @@ static bfd * elfNN_aarch64_link_setup_gnu_properties (struct bfd_link_info *info) { uint32_t prop = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop; - bfd *pbfd = _bfd_aarch64_elf_link_setup_gnu_properties (info, &prop); + aarch64_gcs_report gcs_report + = elf_aarch64_tdata (info->output_bfd)->gcs_report; + aarch64_gcs_type gcs_type + = elf_aarch64_tdata (info->output_bfd)->gcs_type; + bfd *pbfd = _bfd_aarch64_elf_link_setup_gnu_properties (info, &prop, + gcs_report, gcs_type); elf_aarch64_tdata (info->output_bfd)->gnu_and_prop = prop; elf_aarch64_tdata (info->output_bfd)->plt_type |= (prop & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ? PLT_BTI : 0; @@ -10638,30 +10667,54 @@ elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info, { uint32_t prop = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop; + aarch64_gcs_report gcs_report + = elf_aarch64_tdata (info->output_bfd)->gcs_report; + aarch64_gcs_type gcs_type + = elf_aarch64_tdata (info->output_bfd)->gcs_type; - /* If output has been marked with BTI using command line argument, give out - warning if necessary. */ /* Properties are merged per type, hence only check for warnings when merging GNU_PROPERTY_AARCH64_FEATURE_1_AND. */ - if (((aprop && aprop->pr_type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) + if ((aprop && aprop->pr_type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) || (bprop && bprop->pr_type == GNU_PROPERTY_AARCH64_FEATURE_1_AND)) - && (prop & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) - && (!elf_aarch64_tdata (info->output_bfd)->no_bti_warn)) { - if ((aprop && !(aprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) - || !aprop) + /* If output has been marked with BTI using command line argument, give + out warning if necessary. */ + if ((prop & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) + && (!elf_aarch64_tdata (info->output_bfd)->no_bti_warn)) { - _bfd_error_handler (_("%pB: warning: BTI turned on by -z force-bti when " - "all inputs do not have BTI in NOTE section."), - abfd); + if ((aprop && !(aprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) + || !aprop) + { + _bfd_error_handler (_("%pB: warning: BTI turned on by -z " + "force-bti when all inputs do not have BTI " + "in NOTE section."), abfd); + } + if ((bprop && !(bprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) + || !bprop) + { + _bfd_error_handler (_("%pB: warning: BTI turned on by -z " + "force-bti when all inputs do not have BTI " + "in NOTE section."), bbfd); + } } - if ((bprop && !(bprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) - || !bprop) + + /* If output has been marked with GCS using -z gcs and input + is missing GCS marking throw warning/error on + -z gcs-report=warning/error. */ + if ((prop & GNU_PROPERTY_AARCH64_FEATURE_1_GCS) && gcs_report != GCS_NONE) { - _bfd_error_handler (_("%pB: warning: BTI turned on by -z force-bti when " - "all inputs do not have BTI in NOTE section."), - bbfd); + if ((aprop && !(aprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)) + || !aprop) + _bfd_aarch64_elf_check_gcs_report (gcs_report, abfd); + if ((bprop && !(bprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)) + || !bprop) + _bfd_aarch64_elf_check_gcs_report (gcs_report, bbfd); } + + if (gcs_type == GCS_NEVER && aprop != NULL) + aprop->u.number &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + if (gcs_type == GCS_NEVER && bprop != NULL) + bprop->u.number &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS; } return _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop, diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index d1279adc2e4..abe1ea68874 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -702,7 +702,9 @@ _bfd_aarch64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_ty GPROP accordingly. */ bfd * _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info, - uint32_t *gprop) + uint32_t *gprop, + aarch64_gcs_report gcs_report, + aarch64_gcs_type gcs_type) { asection *sec; bfd *pbfd; @@ -738,6 +740,11 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info, _bfd_error_handler (_("%pB: warning: BTI turned on by -z force-bti " "when all inputs do not have BTI in NOTE " "section."), ebfd); + + if ((gnu_prop & GNU_PROPERTY_AARCH64_FEATURE_1_GCS) + && !(prop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)) + _bfd_aarch64_elf_check_gcs_report (gcs_report, ebfd); + prop->u.number |= gnu_prop; prop->pr_kind = property_number; @@ -765,6 +772,14 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info, elf_section_type (sec) = SHT_NOTE; } } + else if (ebfd != NULL && gcs_type == GCS_NEVER) + { + prop = _bfd_elf_get_property (ebfd, GNU_PROPERTY_AARCH64_FEATURE_1_AND, + 4); + prop->u.number &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS; + if (prop->u.number == 0) + prop->pr_kind = property_remove; + } pbfd = _bfd_elf_link_setup_gnu_properties (info); @@ -785,7 +800,8 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info, { gnu_prop = (p->property.u.number & (GNU_PROPERTY_AARCH64_FEATURE_1_PAC - | GNU_PROPERTY_AARCH64_FEATURE_1_BTI)); + | GNU_PROPERTY_AARCH64_FEATURE_1_BTI + | GNU_PROPERTY_AARCH64_FEATURE_1_GCS)); break; } else if (GNU_PROPERTY_AARCH64_FEATURE_1_AND < p->property.pr_type) @@ -922,3 +938,20 @@ _bfd_aarch64_elf_link_fixup_gnu_properties } } } + +/* Check AArch64 GCS report. */ +void +_bfd_aarch64_elf_check_gcs_report (aarch64_gcs_report gcs_report, bfd *ebfd) +{ + if (gcs_report == GCS_WARN) + _bfd_error_handler (_("%pB: warning: GCS turned on by -z gcs " + "on the output when all inputs do not have GCS in NOTE " + "section."), ebfd); + else if (gcs_report == GCS_ERROR) + { + _bfd_error_handler (_("%pB: error: GCS turned on by -z gcs " + "on the output when all inputs do not have GCS in " + "NOTE section."), ebfd); + _exit (EXIT_FAILURE); + } +} diff --git a/bfd/elfxx-aarch64.h b/bfd/elfxx-aarch64.h index f21e5ee5efc..4852d33be3e 100644 --- a/bfd/elfxx-aarch64.h +++ b/bfd/elfxx-aarch64.h @@ -46,6 +46,27 @@ typedef enum BTI_WARN = 1, /* BTI is enabled with -z force-bti. */ } aarch64_enable_bti_type; +/* To indicate whether GNU_PROPERTY_AARCH64_FEATURE_1_GCS bit is + enabled/disabled on the output when -z gcs linker + command line option is passed. */ +typedef enum +{ + GCS_NEVER = 0, /* gcs is disabled on output. */ + GCS_IMPLICIT = 1, /* gcs is deduced from input object. */ + GCS_ALWAYS = 2, /* gsc is enabled on output. */ +} aarch64_gcs_type; + +/* To indicate whether to generate linker warning/errors for + -z gcs-report when -z gcs=always is passed. */ +typedef enum +{ + GCS_NONE = 0, /* Does not emit any warning/error messages. */ + GCS_WARN = 1, /* Emit warning when the input objects are missing gcs + markings and output have gcs marking. */ + GCS_ERROR = 2, /* Emit error when the input objects are missing gcs + markings and output have gcs marking. */ +} aarch64_gcs_report; + /* A structure to encompass all information coming from BTI or PAC related command line options. This involves the "PLT_TYPE" to determine which version of PLTs to pick and "BTI_TYPE" to determine if @@ -54,7 +75,9 @@ typedef struct { aarch64_plt_type plt_type; aarch64_enable_bti_type bti_type; -} aarch64_bti_pac_info; + aarch64_gcs_type gcs_type; + aarch64_gcs_report gcs_report; +} aarch64_gnu_prop_info; /* An enum to define what kind of erratum fixes we should apply. This gives the user a bit more control over the sequences we generate. */ @@ -67,11 +90,11 @@ typedef enum extern void bfd_elf64_aarch64_set_options (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, - aarch64_bti_pac_info); + aarch64_gnu_prop_info); extern void bfd_elf32_aarch64_set_options (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, - aarch64_bti_pac_info); + aarch64_gnu_prop_info); /* AArch64 stub generation support for ELF64. Called from the linker. */ extern int elf64_aarch64_setup_section_lists @@ -146,8 +169,9 @@ _bfd_aarch64_elf_write_core_note (bfd *, char *, int *, int, ...); #define elf_backend_write_core_note _bfd_aarch64_elf_write_core_note extern bfd * -_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *, - uint32_t *); +_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *, uint32_t *, + aarch64_gcs_report, + aarch64_gcs_type); extern enum elf_property_kind _bfd_aarch64_elf_parse_gnu_properties (bfd *, unsigned int, @@ -157,6 +181,8 @@ extern bool _bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *, bfd *, elf_property *, elf_property *, uint32_t); +extern void +_bfd_aarch64_elf_check_gcs_report (aarch64_gcs_report, bfd *); extern void _bfd_aarch64_elf_link_fixup_gnu_properties (struct bfd_link_info *, diff --git a/binutils/readelf.c b/binutils/readelf.c index 0f8dc1b9716..f905a10b194 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -21246,6 +21246,10 @@ decode_aarch64_feature_1_and (unsigned int bitmask) printf ("PAC"); break; + case GNU_PROPERTY_AARCH64_FEATURE_1_GCS: + printf ("GCS"); + break; + default: printf (_(""), bit); break; diff --git a/include/elf/common.h b/include/elf/common.h index c9920e7731a..c4eb33bf308 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -1037,6 +1037,7 @@ #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) #define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1) +#define GNU_PROPERTY_AARCH64_FEATURE_1_GCS (1U << 2) /* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG). */ #define GNU_ABI_TAG_LINUX 0 diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em index aa2859d4f73..ba536b0e379 100644 --- a/ld/emultempl/aarch64elf.em +++ b/ld/emultempl/aarch64elf.em @@ -36,6 +36,15 @@ static erratum_84319_opts fix_erratum_843419 = ERRAT_NONE; static int no_apply_dynamic_relocs = 0; static aarch64_plt_type plt_type = PLT_NORMAL; static aarch64_enable_bti_type bti_type = BTI_NONE; +static aarch64_gcs_type gcs_type = GCS_IMPLICIT; +static aarch64_gcs_report gcs_report = GCS_NONE; + +#define COMPILE_TIME_STRLEN(s) \ + (sizeof(s) - 1) +#define EGR "gcs-report" +#define EG "gcs" +#define EGR_LEN COMPILE_TIME_STRLEN (EGR) +#define EG_LEN COMPILE_TIME_STRLEN (EG) static void gld${EMULATION_NAME}_before_parse (void) @@ -321,9 +330,11 @@ aarch64_elf_create_output_section_statements (void) return; } - aarch64_bti_pac_info bp_info; - bp_info.plt_type = plt_type; - bp_info.bti_type = bti_type; + aarch64_gnu_prop_info gnu_prop_info; + gnu_prop_info.plt_type = plt_type; + gnu_prop_info.bti_type = bti_type; + gnu_prop_info.gcs_type = gcs_type; + gnu_prop_info.gcs_report = gcs_report; bfd_elf${ELFSIZE}_aarch64_set_options (link_info.output_bfd, &link_info, no_enum_size_warning, @@ -331,7 +342,7 @@ aarch64_elf_create_output_section_statements (void) pic_veneer, fix_erratum_835769, fix_erratum_843419, no_apply_dynamic_relocs, - bp_info); + gnu_prop_info); stub_file = lang_add_input_file ("linker stubs", lang_input_file_is_fake_enum, @@ -398,16 +409,51 @@ PARSE_AND_LIST_OPTIONS=' fprintf (file, _(" --no-apply-dynamic-relocs Do not apply link-time values for dynamic relocations\n")); fprintf (file, _(" -z force-bti Turn on Branch Target Identification mechanism and generate PLTs with BTI. Generate warnings for missing BTI on inputs\n")); fprintf (file, _(" -z pac-plt Protect PLTs with Pointer Authentication.\n")); + fprintf (file, _("\ + -z gcs[=always|never|implicit] Turn on Guarded Control Stack(gcs) mechanism on the output.\n\ + implicit(default): deduce gcs from input objects.\n\ + always: always marks the output with gcs.\n\ + never: never marks the output with gcs.\n")); + fprintf (file, _("\ + -z gcs-report[=none|warning|error] Emit warning/error on mismatch of gcs marking between input objects and ouput.\n\ + none (default): Does not emit any warning/error messages.\n\ + warning: Emit warning when the input objects are missing gcs markings\n\ + and output have gcs marking.\n\ + error: Emit error when the input objects are missing gcs markings\n\ + and output have gcs marking.\n")); + ' PARSE_AND_LIST_ARGS_CASE_Z_AARCH64=' - else if (strcmp (optarg, "force-bti") == 0) + else if (strcmp (optarg, "force-bti") == 0) { plt_type |= PLT_BTI; bti_type = BTI_WARN; } - else if (strcmp (optarg, "pac-plt") == 0) + else if (strcmp (optarg, "pac-plt") == 0) plt_type |= PLT_PAC; + else if (strncmp (optarg, EGR, EGR_LEN) == 0) + { + if (strlen (optarg) == EGR_LEN || strcmp (optarg + EGR_LEN, "=none") == 0) + gcs_report = GCS_NONE; + else if (strcmp (optarg + EGR_LEN, "=warning") == 0) + gcs_report = GCS_WARN; + else if (strcmp (optarg + EGR_LEN, "=error") == 0) + gcs_report = GCS_ERROR; + else + einfo (_("%P: error: unrecognized: `%s'\''\n"), optarg); + } + else if (strncmp (optarg, EG, EG_LEN) == 0) + { + if (strlen (optarg) == EG_LEN || strcmp (optarg + EG_LEN, "=always") == 0) + gcs_type = GCS_ALWAYS; + else if (strcmp (optarg + EG_LEN, "=never") == 0) + gcs_type = GCS_NEVER; + else if (strcmp (optarg + EG_LEN, "=implicit") == 0) + gcs_type = GCS_IMPLICIT; + else + einfo (_("%P: error: unrecognized: `%s'\''\n"), optarg); + } ' PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_AARCH64" diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index c7d97f3ced9..d5a208f6768 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -487,3 +487,26 @@ if { [supports_dt_relr] } { if { ![skip_sframe_tests] } { run_dump_test "sframe-simple-1" } + +run_dump_test "property-gcs1" +run_dump_test "property-gcs2" +run_dump_test "property-gcs3" +run_dump_test "property-gcs4" +run_dump_test "property-gcs5" +run_dump_test "property-gcs6" +run_dump_test "property-gcs7" +run_dump_test "property-gcs8" +run_dump_test "property-gcs9" +run_dump_test "property-gcs10" +run_dump_test "property-gcs11" +run_dump_test "property-gcs12" +run_dump_test "property-gcs13" +run_dump_test "property-gcs14" +run_dump_test "property-gcs15" +run_dump_test "property-gcs16" +run_dump_test "property-gcs17" +run_dump_test "property-gcs18" +run_dump_test "property-gcs19" +run_dump_test "property-gcs20" +run_dump_test "property-gcs21" +run_dump_test "property-gcs22" diff --git a/ld/testsuite/ld-aarch64/property-bti-pac1.d b/ld/testsuite/ld-aarch64/property-bti-pac1.d index 59fa695165a..c28a0cbf850 100644 --- a/ld/testsuite/ld-aarch64/property-bti-pac1.d +++ b/ld/testsuite/ld-aarch64/property-bti-pac1.d @@ -8,4 +8,4 @@ Displaying notes found in: .note.gnu.property [ ]+Owner[ ]+Data size[ ]+Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 - Properties: AArch64 feature: BTI, PAC + Properties: AArch64 feature: BTI, PAC, GCS diff --git a/ld/testsuite/ld-aarch64/property-bti-pac1.s b/ld/testsuite/ld-aarch64/property-bti-pac1.s index 414c9277f1d..42156917d58 100644 --- a/ld/testsuite/ld-aarch64/property-bti-pac1.s +++ b/ld/testsuite/ld-aarch64/property-bti-pac1.s @@ -12,6 +12,20 @@ _start: .long 5f - 2f /* data length */ .long 5 /* note type */ 0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long 0xc0000000 /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long 0x4 /* GCS. */ +4: + .p2align 3 +5: + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long 5 /* note type */ +0: .asciz "GNU" /* vendor name */ 1: .p2align 3 2: .long 0xc0000000 /* pr_type. */ diff --git a/ld/testsuite/ld-aarch64/property-gcs.s b/ld/testsuite/ld-aarch64/property-gcs.s new file mode 100644 index 00000000000..bc7e66e8933 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs.s @@ -0,0 +1,25 @@ + .text + .globl _start + .type _start,@function +_start: + mov x1, #2 +.ifndef __mult__ + bl foo +.endif +.ifdef __property_gcs__ + .section ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long 5 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long 0xc0000000 /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long 0x4 /* GCS. */ +4: + .p2align 3 +5: +.endif diff --git a/ld/testsuite/ld-aarch64/property-gcs1.d b/ld/testsuite/ld-aarch64/property-gcs1.d new file mode 100644 index 00000000000..c724ac56ca3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs1.d @@ -0,0 +1,6 @@ +#name: GNU Property (input without gcs) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -shared +#readelf: -n diff --git a/ld/testsuite/ld-aarch64/property-gcs10.d b/ld/testsuite/ld-aarch64/property-gcs10.d new file mode 100644 index 00000000000..3a2c992f974 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs10.d @@ -0,0 +1,6 @@ +#name: GNU Property (input without gcs output forced with gcs=always gcs-report=error) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs=always -z gcs-report=error +#error: .*property-gcs.*: error: GCS turned on by -z gcs on the output when all inputs do not have GCS in NOTE section. diff --git a/ld/testsuite/ld-aarch64/property-gcs11.d b/ld/testsuite/ld-aarch64/property-gcs11.d new file mode 100644 index 00000000000..094b9be2582 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs11.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs12.d b/ld/testsuite/ld-aarch64/property-gcs12.d new file mode 100644 index 00000000000..355544775f3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs12.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs=always) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs=always +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs13.d b/ld/testsuite/ld-aarch64/property-gcs13.d new file mode 100644 index 00000000000..c6543ba168c --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs13.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs gcs-report=none) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs -z gcs-report=none +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs14.d b/ld/testsuite/ld-aarch64/property-gcs14.d new file mode 100644 index 00000000000..1c612b5c9bd --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs14.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs gcs-report=warning) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs -z gcs-report=warning +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs15.d b/ld/testsuite/ld-aarch64/property-gcs15.d new file mode 100644 index 00000000000..7e46e8eae2f --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs15.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs gcs-report=error) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs -z gcs-report=error +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs16.d b/ld/testsuite/ld-aarch64/property-gcs16.d new file mode 100644 index 00000000000..c20cbe531be --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs16.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs=always gcs-report=none) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs=always -z gcs-report=none +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs17.d b/ld/testsuite/ld-aarch64/property-gcs17.d new file mode 100644 index 00000000000..2ee3f103701 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs17.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs=always gcs-report=warning) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs=always -z gcs-report=warning +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs18.d b/ld/testsuite/ld-aarch64/property-gcs18.d new file mode 100644 index 00000000000..6c45d77c179 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs18.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs=always gcs-report=error) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs=always -z gcs-report=error +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs19.d b/ld/testsuite/ld-aarch64/property-gcs19.d new file mode 100644 index 00000000000..588af48859b --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs19.d @@ -0,0 +1,6 @@ +#name: GNU Property (input without gcs output forced with gcs=never) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs=never +#readelf: -n diff --git a/ld/testsuite/ld-aarch64/property-gcs2.d b/ld/testsuite/ld-aarch64/property-gcs2.d new file mode 100644 index 00000000000..ed545a180b3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs2.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -shared +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs2.s b/ld/testsuite/ld-aarch64/property-gcs2.s new file mode 100644 index 00000000000..6db7d8396c8 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs2.s @@ -0,0 +1,33 @@ + .text + .global foo + .type foo, %function +foo: + sub sp, sp, #16 + mov w0, 9 + str w0, [sp, 12] + ldr w0, [sp, 12] + add w0, w0, 4 + str w0, [sp, 12] + nop + add sp, sp, 16 + ret + .size foo, .-foo + .global bar + .type bar, %function +.ifdef __property_gcs__ + .section ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length */ + .long 5f - 2f /* data length */ + .long 5 /* note type */ +0: .asciz "GNU" /* vendor name */ +1: + .p2align 3 +2: .long 0xc0000000 /* pr_type. */ + .long 4f - 3f /* pr_datasz. */ +3: + .long 0x4 /* GCS. */ +4: + .p2align 3 +5: +.endif diff --git a/ld/testsuite/ld-aarch64/property-gcs20.d b/ld/testsuite/ld-aarch64/property-gcs20.d new file mode 100644 index 00000000000..779e845f680 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs20.d @@ -0,0 +1,6 @@ +#name: GNU Property (input without gcs output forced with gcs=implicit) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs=implicit +#readelf: -n diff --git a/ld/testsuite/ld-aarch64/property-gcs21.d b/ld/testsuite/ld-aarch64/property-gcs21.d new file mode 100644 index 00000000000..dbfb5ec0264 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs21.d @@ -0,0 +1,6 @@ +#name: GNU Property (input with gcs output forced with gcs=never) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs=never +#readelf: -n diff --git a/ld/testsuite/ld-aarch64/property-gcs22.d b/ld/testsuite/ld-aarch64/property-gcs22.d new file mode 100644 index 00000000000..dd92399fc4f --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs22.d @@ -0,0 +1,11 @@ +#name: GNU Property (input with gcs output forced with gcs=implicit) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 -defsym __property_gcs__=1 +#ld: -z gcs=implicit +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs3.d b/ld/testsuite/ld-aarch64/property-gcs3.d new file mode 100644 index 00000000000..0ea2d7ed79c --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs3.d @@ -0,0 +1,11 @@ +#name: GNU Property (input without gcs output forced with gcs) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs4.d b/ld/testsuite/ld-aarch64/property-gcs4.d new file mode 100644 index 00000000000..0669d64b530 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs4.d @@ -0,0 +1,11 @@ +#name: GNU Property (input without gcs output forced with gcs=always) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs=always +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs5.d b/ld/testsuite/ld-aarch64/property-gcs5.d new file mode 100644 index 00000000000..df8643a9d18 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs5.d @@ -0,0 +1,11 @@ +#name: GNU Property (input without gcs output forced with gcs gcs-report=none) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs -z gcs-report=none +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs6.d b/ld/testsuite/ld-aarch64/property-gcs6.d new file mode 100644 index 00000000000..3646e8a58ff --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs6.d @@ -0,0 +1,12 @@ +#name: GNU Property (input without gcs output forced with gcs gcs-report=warning) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs -z gcs-report=warning +#readelf: -n +#warning: .*property-gcs.*: warning: GCS turned on by -z gcs on the output when all inputs do not have GCS in NOTE section. + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs7.d b/ld/testsuite/ld-aarch64/property-gcs7.d new file mode 100644 index 00000000000..ba58fe24ad2 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs7.d @@ -0,0 +1,6 @@ +#name: GNU Property (input without gcs output forced with gcs gcs-report=error) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs -z gcs-report=error +#error: .*property-gcs.*: error: GCS turned on by -z gcs on the output when all inputs do not have GCS in NOTE section. diff --git a/ld/testsuite/ld-aarch64/property-gcs8.d b/ld/testsuite/ld-aarch64/property-gcs8.d new file mode 100644 index 00000000000..f442b71aee3 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs8.d @@ -0,0 +1,11 @@ +#name: GNU Property (input without gcs output forced with gcs=always gcs-report=none) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs=always -z gcs-report=none +#readelf: -n + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS diff --git a/ld/testsuite/ld-aarch64/property-gcs9.d b/ld/testsuite/ld-aarch64/property-gcs9.d new file mode 100644 index 00000000000..82b93ec0850 --- /dev/null +++ b/ld/testsuite/ld-aarch64/property-gcs9.d @@ -0,0 +1,12 @@ +#name: GNU Property (input without gcs output forced with gcs=always gcs-report=warning) +#source: property-gcs.s +#alltargets: [check_shared_lib_support] *linux* +#as: -march=armv9.4-a+gcs -defsym __mult__=0 +#ld: -z gcs=always -z gcs-report=warning +#readelf: -n +#warning: .*property-gcs.*: warning: GCS turned on by -z gcs on the output when all inputs do not have GCS in NOTE section. + +Displaying notes found in: .note.gnu.property +[ ]+Owner[ ]+Data size[ ]+Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: GCS