Message ID | 20200430174329.GD29015@arm.com |
---|---|
State | Superseded |
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> 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 047EB396E47C; Thu, 30 Apr 2020 17:43:49 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00047.outbound.protection.outlook.com [40.107.0.47]) by sourceware.org (Postfix) with ESMTPS id F2722396D838 for <libc-alpha@sourceware.org>; Thu, 30 Apr 2020 17:43:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F2722396D838 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Szabolcs.Nagy@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8UjoptEGyc6yYLRoYnLHYA7v+mNqRF4FoRTI2Qj3Vyg=; b=hlzEHQg4o/BorwUs+t7hZaWa1hIboU89Tay06HDtz7hI3/7l4Fb2Qd8K3bdvNAGFOhgEoLZdEDsCrq4JLq62/QreG9hPit2M630k+CaXt1ql4gvupSPEQwnMgGUB7HI+CHROWwuH9TO7nxtG2oF5xNrTsp19shl0K4NIgnUPo6g= Received: from AM7PR03CA0018.eurprd03.prod.outlook.com (2603:10a6:20b:130::28) by DB8SPR01MB0023.eurprd08.prod.outlook.com (2603:10a6:10:146::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19; Thu, 30 Apr 2020 17:43:44 +0000 Received: from VE1EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:130:cafe::31) by AM7PR03CA0018.outlook.office365.com (2603:10a6:20b:130::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 17:43:43 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=bestguesspass 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT049.mail.protection.outlook.com (10.152.19.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 17:43:43 +0000 Received: ("Tessian outbound 4cdf5642225a:v54"); Thu, 30 Apr 2020 17:43:43 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 5b79d80dfe597d61 X-CR-MTA-TID: 64aa7808 Received: from e032eb60604e.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B889B6D7-FEF3-4093-8887-4E5DAC82BBDF.1; Thu, 30 Apr 2020 17:43:37 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e032eb60604e.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:43:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FuxZvR1ie5NXAHQzYRDd6MBSPl7W8priGAE7AdaFfi+ThIcIOFFVZrLpPSdlKVlRNsfgi/3uPWAHBYbxwF9YWOkEmEr3WSUxR+tb9FblK1mS6IolkfFDhdGYKKvtJQOmUklxTF1uqexil+xsA7FBn7trtPXEOE/mfbC7Nbhb5LyUZOEuxiIB/BJU05FrRuHLYiP6GyutciIWs64dj6VlF1IwbgCwctHVjmfJIvnua1V6QyBUoVkbJxda1bWxf00kwj7rExBydfz+Ze5FQJzC/h9O+HrifvuBNfkh7HRuZhUb+iZ9GOxE88NNDeU5So5iE65yvMGGIAyCBq7bgPIvhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8UjoptEGyc6yYLRoYnLHYA7v+mNqRF4FoRTI2Qj3Vyg=; b=NuHVBijKOqqdnYt3hMciSzFnTTBz6NnorqoIxY8kZjYN7jcs2i97uvOHc2TQeCQAbJAw0a7W9gP64H1TslrbH2SwFYjrRMDTH3Xx+kMAaA73t2yoQcv1BhHpYpJl8eEslZb3GofYXlS76Xr+E08C/XPUn+nNHmUvLCWS+ynI77yTRQXnFYgsQoJz4TM90G7OWP3yNfB0EBYNOOXp34LI4MAOZYwTm9a6lrNmTJuWy84sWPo4QqKGgk1HnjDcqEUlgj/UJqgYpZSoSzoTcgH5UziJhPAJCXBaVYxGLC+NkTWC3aZr8ztHj5AvNp6rEbfyTsaHhSxU2VGKxFB9IHLAbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8UjoptEGyc6yYLRoYnLHYA7v+mNqRF4FoRTI2Qj3Vyg=; b=hlzEHQg4o/BorwUs+t7hZaWa1hIboU89Tay06HDtz7hI3/7l4Fb2Qd8K3bdvNAGFOhgEoLZdEDsCrq4JLq62/QreG9hPit2M630k+CaXt1ql4gvupSPEQwnMgGUB7HI+CHROWwuH9TO7nxtG2oF5xNrTsp19shl0K4NIgnUPo6g= Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) by AM6PR08MB3224.eurprd08.prod.outlook.com (2603:10a6:209:47::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19; Thu, 30 Apr 2020 17:43:37 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 17:43:37 +0000 Date: Thu, 30 Apr 2020 18:43:30 +0100 From: Szabolcs Nagy <szabolcs.nagy@arm.com> To: libc-alpha@sourceware.org Subject: [PATCH 08/12] Rewrite abi-note.S in C. Message-ID: <20200430174329.GD29015@arm.com> References: <20200430173458.GV29015@arm.com> In-Reply-To: <20200430173458.GV29015@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: SN6PR01CA0032.prod.exchangelabs.com (2603:10b6:805:b6::45) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by SN6PR01CA0032.prod.exchangelabs.com (2603:10b6:805:b6::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 17:43:35 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2d738563-e6e7-4ff3-e713-08d7ed2e06a4 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|DB8SPR01MB0023: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <DB8SPR01MB00239FFEA159D2AE1D3C2D55EDAA0@DB8SPR01MB0023.eurprd08.prod.outlook.com> x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: aBDk0KzfgjV/WrJaGJLCnaaxHhb4noEmrbC7v4C+OYxqEs8Dx7Qz6gtL4ySJLzzhnKsFfBMO+L6nFbWOIuUAvoN92ot5Xxsq+ynVRO9BDQXJqWHeJNRYeRP5tyJT2Llgv99Z5PiDcOrwAQsFa4CfigwALO3RhZFpiA8o98RFPeAV8hfl0czfxkXYyqs2gWnrWhXTvH7FkYdNnUikey+NqsOkgzUgov92m/yw2a8d0pv7uW9SUSplFZ30IFnaZSo+LJefyt2NqTnS7sPbuwjLl/2lqSBX1zV3Jl5lSnXTB33nn0H6ByJInr9QoZ6BOwd6MjODtdU7faA90ikk8YZyX7IHIJYYHJdp8BrwNEVDZmqqK8QTR10eymz8JdOs/Hql X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(1076003)(86362001)(33656002)(36756003)(66946007)(235185007)(66476007)(8886007)(55016002)(66556008)(66616009)(564344004)(478600001)(16526019)(26005)(186003)(52116002)(6916009)(44832011)(7696005)(33964004)(2906002)(4326008)(8676002)(8936002)(44144004)(6666004)(956004)(2616005)(316002)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RPEcXtSZWNsOalnlcCAcrJ27Y5AfkBOxoL3DWEXoYxiJZS39Mx+TJ6LJ4m+IMh1+BnIY8JqrFYLgI00CGD4HfOl0JIQRhtVMm9I5H1ZHqMCCr+R4yrGiYTxK6txsC+cb2Rz/rZ+41AfHS99zV7nFXN2FEOgmX36AXtOoxpZZwpB+yWqAJH6B5z3to0gDS8wlukfclgQr3YHXPW45NQO4ZJZ8qCCcC7EBFGWA0qRot7ztpoS6O2ZGJ1NVAXxRoyF7Lde6oaHJ22owjd4fqsgI1ranaMmkjMuhL2QdYjLtYuEnumaDBoLOQ8ig+8Xl6f/jTuADx5lT2AvjI5OXfZp1H4qGu4lBPQzZOsvm/Z2cPsAu9Gcviow//K7GEuAXv/5MD9P3YKuRE3FjEf5aCUT4mTmcy9VnZXv9Fi8UJrW5XUIfTGPl/vmVrstXLJ6M4cLi76soFHijoWGhMLDD+7Pdbe8nC8oN0tQolRllen7KEtSMhnk8HEWJHjMmrWWZOloC3SPX8XiF4008QS0K8d/PmyzoFzswabix0QMu2UoggRsX0jeasq4CSR2ZlTNsMfilPnCLM46kg1zTiGG85pa1TDvJ+MVQ50Mk4YlfTNEVpim96qZd9qXOhDCia5yyYHfER5HDM6ijv0PgrlH8txSQHdJMhVJaNIk+ZEga+5eVLidw9+TOYsk4VmCdt5hYjBb1yA9sFSvnsjkaP2rTis4pZJKEKusN8lnh/w/TQuhaSlvnBBmaB/iKurEsc9vHYIyTkpyyvfHUEybphGKUwzWKZAKcjFRBugpjJpm+Zk/u8ek= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3224 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT049.eop-EUR03.prod.protection.outlook.com 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; SFTY:; SFS:(4636009)(39860400002)(396003)(376002)(136003)(346002)(46966005)(8936002)(564344004)(356005)(6916009)(82310400002)(47076004)(8676002)(82740400003)(81166007)(4326008)(55016002)(86362001)(956004)(2906002)(36756003)(44832011)(26005)(16526019)(186003)(235185007)(1076003)(336012)(2616005)(36906005)(478600001)(316002)(33656002)(33964004)(66616009)(44144004)(70586007)(6666004)(7696005)(8886007)(70206006)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 78903919-9059-4737-dc78-08d7ed2e02ab X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pH9pA88ZwhOM0nhIOEscoSPmcWnQxeIms/ROHNrsm+i+0tveChwsw62PlTesVCc3n/f2O/9sEKagjNs3l0Je2GjCXssgGWKwtsrPuDfUNBBgMvVPuvwd0jAaGNJ2/tCgxSyTREmLYg8rodykuRKnovaAfqOoouZEuYsUk7dumCEoyEJUW4kAL5IIO2dMbUx6XVzwzNmhjYJGLdgW2idgiCgZWd+py6T5/UsHqfGq3OyOx7f1HNtM5eQQAcb+DuEB0H7iW1RhT1k3NuXZnNkctcPQW05eWePSJxGyYKmHrg8eOaa6Im+6T2fscisOluq7MSUxUpHgvUg5Vlr0SOkc0z3b8wszMESQ6C87nNSSP3JgRv8USFRguU3XwrzXHGrbLrCGDzkx6pxKe8Mrdea/2+/hlBzv3s9tIZFkQa0H+Cs= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:43:43.0933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d738563-e6e7-4ff3-e713-08d7ed2e06a4 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8SPR01MB0023 X-Spam-Status: No, score=-28.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0008-Rewrite-abi-note.S-in-C.patch" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <http://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <http://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Cc: Sudakshina Das <Sudi.Das@arm.com> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
aarch64: branch protection support
|
|
Commit Message
Szabolcs Nagy
April 30, 2020, 5:43 p.m. UTC
Comments
On Thu, Apr 30, 2020 at 1:43 PM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote: > > Using C code with __asm() allows the compiler to add target > specific object file markings based on CFLAGS. > This is e.g. needed for building glibc with branch-protection > on AArch64. Hmm. If we're going to do this, should we maybe go further and use actual C? This snippet produces a matching .note.ABI-tag section for me: #include <stdint.h> #include <config.h> #include <endian.h> #include <abi-tag.h> const int32_t __attribute__((section(".note.ABI-tag"))) __abi_tag[] = { 4, /* name length: 4 */ 16, /* data length: 4 32-bit numbers */ 1, #if BYTE_ORDER == BIG_ENDIAN 0x474E5500, /* "GNU\0" */ #else 0x00554E47, /* same, little-endian */ #endif __ABI_TAG_OS, __ABI_TAG_VERSION }; I don't see a problem with hardwiring a name length of 4, and code elsewhere appears to assume that the payload will always be 4 32-bit integers, so maybe it's OK to hardwire the 16 too. If it's not OK, perhaps we could figure out a way to count the commas in __ABI_TAG_VERSION in the preprocessor and do a little math. The other potential problem I can think of is that there's a symbol pointing into the .note.ABI-tag section now; I don't know if that might break anything. zw
The 04/30/2020 16:07, Zack Weinberg wrote: > On Thu, Apr 30, 2020 at 1:43 PM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote: > > > > Using C code with __asm() allows the compiler to add target > > specific object file markings based on CFLAGS. > > This is e.g. needed for building glibc with branch-protection > > on AArch64. > > Hmm. If we're going to do this, should we maybe go further and use > actual C? This snippet produces a matching .note.ABI-tag section for > me: yes this makes sense. > #include <stdint.h> > #include <config.h> > #include <endian.h> > #include <abi-tag.h> > const int32_t > __attribute__((section(".note.ABI-tag"))) > __abi_tag[] = { > 4, /* name length: 4 */ > 16, /* data length: 4 32-bit numbers */ > 1, > #if BYTE_ORDER == BIG_ENDIAN > 0x474E5500, /* "GNU\0" */ > #else > 0x00554E47, /* same, little-endian */ > #endif > __ABI_TAG_OS, > __ABI_TAG_VERSION > }; > > I don't see a problem with hardwiring a name length of 4, and code > elsewhere appears to assume that the payload will always be 4 32-bit > integers, so maybe it's OK to hardwire the 16 too. If it's not OK, > perhaps we could figure out a way to count the commas in > __ABI_TAG_VERSION in the preprocessor and do a little math. > > The other potential problem I can think of is that there's a symbol > pointing into the .note.ABI-tag section now; I don't know if that > might break anything. what about /* Note: Custom type is used as ElfW(Nhdr) is wrong on 64 bit targets. */ __attribute__((used, aligned(4), section(".note.ABI-tag"))) static const struct { int32_t namesz; int32_t descsz; int32_t type; char name[4]; int32_t desc[4]; } __abi_tag = { 4, /* name length: 4 */ 16, /* data length: 4 32-bit numbers */ 1, "GNU", { __ABI_TAG_OS, __ABI_TAG_VERSION } }; this fixes the alignment, makes the symbol local, does not need endian.h and uses identifiers according to the gabi specification.
On Fri, May 1, 2020 at 5:24 AM Szabolcs Nagy <szabolcs.nagy@arm.com> wrote: > what about > > /* Note: Custom type is used as ElfW(Nhdr) is wrong on 64 bit targets. */ > > __attribute__((used, aligned(4), section(".note.ABI-tag"))) > static const struct > { > int32_t namesz; > int32_t descsz; > int32_t type; > char name[4]; > int32_t desc[4]; > } __abi_tag = { > 4, /* name length: 4 */ > 16, /* data length: 4 32-bit numbers */ > 1, > "GNU", > { __ABI_TAG_OS, __ABI_TAG_VERSION } > }; > > this fixes the alignment, makes the symbol local, does not need > endian.h and uses identifiers according to the gabi specification. Looks good to me. Fixing the array length means the compiler should complain if __ABI_TAG_VERSION ever expands to the wrong number of initializers. zw
From 0647d5658df82f89d8bf73dec65ef4aa6a4b77a9 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy <szabolcs.nagy@arm.com> Date: Wed, 1 Apr 2020 16:02:03 +0100 Subject: [PATCH 08/12] Rewrite abi-note.S in C. Using C code with __asm() allows the compiler to add target specific object file markings based on CFLAGS. This is e.g. needed for building glibc with branch-protection on AArch64. --- csu/{abi-note.S => abi-note.c} | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) rename csu/{abi-note.S => abi-note.c} (85%) diff --git a/csu/abi-note.S b/csu/abi-note.c similarity index 85% rename from csu/abi-note.S rename to csu/abi-note.c index 2b4b5f8824..5d86b452d9 100644 --- a/csu/abi-note.S +++ b/csu/abi-note.c @@ -56,17 +56,21 @@ offset length contents #include <config.h> #include <abi-tag.h> /* OS-specific ABI tag value */ +#define STRINGIFY(...) STRINGIFY_1 (__VA_ARGS__) +#define STRINGIFY_1(...) #__VA_ARGS__ + /* The linker (GNU ld 2.8 and later) recognizes an allocated section whose name begins with `.note' and creates a PT_NOTE program header entry pointing at it. */ - .section ".note.ABI-tag", "a" - .p2align 2 - .long 1f - 0f /* name length */ - .long 3f - 2f /* data length */ - .long 1 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: .p2align 2 -2: .long __ABI_TAG_OS /* note data: the ABI tag */ - .long __ABI_TAG_VERSION -3: .p2align 2 /* pad out section */ +__asm ( + " .section \".note.ABI-tag\", \"a\"\n" + " .p2align 2\n" + " .long 1f - 0f\n" /* name length */ + " .long 3f - 2f\n" /* data length */ + " .long 1\n" /* note type */ + "0: .asciz \"GNU\"\n" /* vendor name */ + "1: .p2align 2\n" + "2: .long " STRINGIFY (__ABI_TAG_OS) "\n" /* note data: the ABI tag */ + " .long " STRINGIFY (__ABI_TAG_VERSION) "\n" + "3: .p2align 2"); /* pad out section */ -- 2.17.1