From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by sourceware.org (Postfix) with ESMTPS id BE2B1389853D for ; Thu, 30 Apr 2020 20:07:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BE2B1389853D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zackw@panix.com Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by mailbackend.panix.com (Postfix) with ESMTPSA id 49CmdF31RxzZfL for ; Thu, 30 Apr 2020 16:07:29 -0400 (EDT) Received: by mail-ej1-f47.google.com with SMTP id e2so5700454eje.13 for ; Thu, 30 Apr 2020 13:07:29 -0700 (PDT) X-Gm-Message-State: AGi0Pua6ALcfTHtjcIuVtVRzDFWtw7oqrsP9PtCPGlHVCc610AjAWF/n 648aJ1557I8tsoa98uDWKFzciisfZEI2cpbeRR8= X-Google-Smtp-Source: APiQypJHX1yXNNqh3lghWDRfTpbTb+aOacFmLzqxyHPnF0QqXYKCCAoJ0AVGsRXIRsgsDDd9yM5j/Gb4V2/0FiXIkW4= X-Received: by 2002:a17:906:1ccb:: with SMTP id i11mr114153ejh.101.1588277248424; Thu, 30 Apr 2020 13:07:28 -0700 (PDT) MIME-Version: 1.0 References: <20200430173458.GV29015@arm.com> <20200430174329.GD29015@arm.com> In-Reply-To: <20200430174329.GD29015@arm.com> From: Zack Weinberg Date: Thu, 30 Apr 2020 16:07:17 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/12] Rewrite abi-note.S in C. To: Szabolcs Nagy Cc: GNU C Library , Sudakshina Das Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 20:07:31 -0000 On Thu, Apr 30, 2020 at 1:43 PM Szabolcs Nagy 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 #include #include #include 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