[PATCH] aarch64: build tst-elf-permissions.cc with correctly named sections

8 views
Skip to first unread message

Waldemar Kozaczuk

unread,
May 3, 2022, 4:56:33 PM5/3/22
to osv...@googlegroups.com, Waldemar Kozaczuk
The assembler on aarch64 uses different characters - '//' - for the end
of line comment (see https://sourceware.org/binutils/docs-2.26/as/i386_002dChars.html#i386_002dChars
and https://sourceware.org/binutils/docs-2.26/as/AArch64_002dChars.html#AArch64_002dChars
respectively). So we add the relevant ifdef directives to make it build
correctly on each arch.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
tests/tst-elf-permissions.cc | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/tests/tst-elf-permissions.cc b/tests/tst-elf-permissions.cc
index 3b704787..4ff045a4 100644
--- a/tests/tst-elf-permissions.cc
+++ b/tests/tst-elf-permissions.cc
@@ -20,9 +20,19 @@ static int test_text_section() __attribute__((noinline));
// solution is to take advantage from the fact that gcc passes section name
// verbatim to the assembler and thus adding '#' makes whatever gcc appends
// to the directive ignored.
+#ifdef __x86_64__
static int test_data_section() __attribute__((noinline, section(".data #")));
+#endif
+#ifdef __aarch64__
+static int test_data_section() __attribute__((noinline, section(".data //")));
+#endif

+#ifdef __x86_64__
static int test_gnu_relro __attribute__((section(".got #")));
+#endif
+#ifdef __aarch64__
+static int test_gnu_relro __attribute__((section(".got //")));
+#endif

volatile int value = 123;
static int test_text_section()
--
2.27.0

Commit Bot

unread,
May 4, 2022, 9:33:04 PM5/4/22
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

aarch64: build tst-elf-permissions.cc with correctly named sections

The assembler on aarch64 uses different characters - '//' - for the end
of line comment (see https://sourceware.org/binutils/docs-2.26/as/i386_002dChars.html#i386_002dChars
and https://sourceware.org/binutils/docs-2.26/as/AArch64_002dChars.html#AArch64_002dChars
respectively). So we add the relevant ifdef directives to make it build
correctly on each arch.

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/tests/tst-elf-permissions.cc b/tests/tst-elf-permissions.cc
Reply all
Reply to author
Forward
0 new messages