public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: libc-alpha@sourceware.org
Cc: Sudakshina Das <Sudi.Das@arm.com>
Subject: [PATCH 08/12] Rewrite abi-note.S in C.
Date: Thu, 30 Apr 2020 18:43:30 +0100	[thread overview]
Message-ID: <20200430174329.GD29015@arm.com> (raw)
In-Reply-To: <20200430173458.GV29015@arm.com>

[-- Attachment #1: 0008-Rewrite-abi-note.S-in-C.patch --]
[-- Type: text/x-diff, Size: 1863 bytes --]

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


  parent reply	other threads:[~2020-04-30 17:43 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 17:34 [PATCH 00/12] aarch64: branch protection support Szabolcs Nagy
2020-04-30 17:37 ` [PATCH 01/12] elf.h: Add PT_GNU_PROPERTY Szabolcs Nagy
2020-05-07 14:49   ` Adhemerval Zanella
2020-04-30 17:37 ` [PATCH 02/12] elf.h: add aarch64 property definitions Szabolcs Nagy
2020-05-07 14:50   ` Adhemerval Zanella
2020-04-30 17:39 ` [PATCH 03/12] aarch64: Add BTI landing pads to assembly code Szabolcs Nagy
2020-05-07 16:55   ` Adhemerval Zanella
2020-05-11 11:38     ` Szabolcs Nagy
2020-05-11 19:13       ` Adhemerval Zanella
2020-04-30 17:40 ` [PATCH 04/12] aarch64: Rename place holder .S files to .c Szabolcs Nagy
2020-05-07 18:29   ` Adhemerval Zanella
2020-04-30 17:41 ` [PATCH 05/12] aarch64: fix swapcontext for BTI Szabolcs Nagy
2020-05-07 18:42   ` Adhemerval Zanella
2020-04-30 17:42 ` [PATCH 06/12] aarch64: fix RTLD_START " Szabolcs Nagy
2020-05-07 18:49   ` Adhemerval Zanella
2020-05-07 19:24     ` Szabolcs Nagy
2020-05-07 19:55       ` Adhemerval Zanella
2020-05-07 20:14         ` Szabolcs Nagy
2020-05-07 20:20           ` Adhemerval Zanella
2020-04-30 17:42 ` [PATCH 07/12] aarch64: fix syscalls " Szabolcs Nagy
2020-05-07 19:40   ` Adhemerval Zanella
2020-05-11 11:46     ` Szabolcs Nagy
2020-04-30 17:43 ` Szabolcs Nagy [this message]
2020-04-30 20:07   ` [PATCH 08/12] Rewrite abi-note.S in C Zack Weinberg
2020-05-01  9:23     ` Szabolcs Nagy
2020-05-01 14:07       ` Zack Weinberg
2020-04-30 17:44 ` [PATCH 09/12] aarch64: support BTI enabled binaries Szabolcs Nagy
2020-05-07 21:07   ` Adhemerval Zanella
2020-05-11 11:04     ` Szabolcs Nagy
2020-05-11 18:38       ` Adhemerval Zanella
2020-04-30 17:44 ` [PATCH 10/12] aarch64: Add pac-ret support to asm files Szabolcs Nagy
2020-05-08 16:59   ` Adhemerval Zanella
2020-05-11  8:27     ` Szabolcs Nagy
2020-05-11 18:39       ` Adhemerval Zanella
2020-04-30 17:45 ` [PATCH 11/12] aarch64: redefine RETURN_ADDRESS to strip PAC Szabolcs Nagy
2020-05-08 17:44   ` Adhemerval Zanella
2020-05-11 12:38     ` Szabolcs Nagy
2020-05-11 19:15       ` Adhemerval Zanella
2020-05-11 19:21         ` Florian Weimer
2020-05-11 20:13           ` Adhemerval Zanella
2020-05-11 20:18             ` Florian Weimer
2020-05-11 19:22   ` Florian Weimer
2020-05-11 20:45     ` Adhemerval Zanella
2020-05-12  8:42     ` Szabolcs Nagy
2020-04-30 17:45 ` [PATCH 12/12] aarch64: Configure option to build glibc with branch protection Szabolcs Nagy
2020-04-30 19:02   ` Joseph Myers
2020-05-08 17:53   ` Adhemerval Zanella
2020-05-04 11:27 ` [PATCH 00/12] aarch64: branch protection support Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200430174329.GD29015@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=Sudi.Das@arm.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).