From: Ard Biesheuvel <ardb+git@google.com>
To: linux-kernel@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Kent Overstreet <kent.overstreet@linux.dev>,
Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, linux-mm@kvack.org,
linux-kbuild@vger.kernel.org
Subject: [PATCH 2/2] runtime-const: Use dot prefix for section names
Date: Mon, 14 Oct 2024 14:57:06 +0200 [thread overview]
Message-ID: <20241014125703.2287936-6-ardb+git@google.com> (raw)
In-Reply-To: <20241014125703.2287936-4-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
Sections typically use leading dots in their names, and deviating from
this breaks some assumptions in the existing code, e.g., in strip_relocs
on x86, as the linker prepends .rela to the section names when emitting
static relocations.
[59] .relaruntime_ptr_dentry_hashtable RELA 0000000000000000 792c758 000078 18 I 56 38 8
[60] .relaruntime_shift_d_hash_shift RELA 0000000000000000 792c7d0 000078 18 I 56 37 8
So use a leading dot for the runtime const sections.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/arm64/include/asm/runtime-const.h | 4 ++--
arch/s390/include/asm/runtime-const.h | 4 ++--
arch/x86/include/asm/runtime-const.h | 4 ++--
include/asm-generic/vmlinux.lds.h | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/include/asm/runtime-const.h b/arch/arm64/include/asm/runtime-const.h
index be5915669d23..2c3521765cfe 100644
--- a/arch/arm64/include/asm/runtime-const.h
+++ b/arch/arm64/include/asm/runtime-const.h
@@ -14,7 +14,7 @@
"movk %0, #0x89ab, lsl #16\n\t" \
"movk %0, #0x4567, lsl #32\n\t" \
"movk %0, #0x0123, lsl #48\n\t" \
- ".pushsection runtime_ptr_" #sym ",\"a\"\n\t" \
+ ".pushsection .runtime_ptr_" #sym ",\"a\"\n\t" \
".long 1b - .\n\t" \
".popsection" \
:"=r" (__ret)); \
@@ -24,7 +24,7 @@
unsigned long __ret; \
asm_inline("1:\t" \
"lsr %w0,%w1,#12\n\t" \
- ".pushsection runtime_shift_" #sym ",\"a\"\n\t" \
+ ".pushsection .runtime_shift_" #sym ",\"a\"\n\t"\
".long 1b - .\n\t" \
".popsection" \
:"=r" (__ret) \
diff --git a/arch/s390/include/asm/runtime-const.h b/arch/s390/include/asm/runtime-const.h
index 17878b1d048c..d19f54567d48 100644
--- a/arch/s390/include/asm/runtime-const.h
+++ b/arch/s390/include/asm/runtime-const.h
@@ -11,7 +11,7 @@
asm_inline( \
"0: iihf %[__ret],%[c1]\n" \
" iilf %[__ret],%[c2]\n" \
- ".pushsection runtime_ptr_" #sym ",\"a\"\n" \
+ ".pushsection .runtime_ptr_" #sym ",\"a\"\n" \
".long 0b - .\n" \
".popsection" \
: [__ret] "=d" (__ret) \
@@ -26,7 +26,7 @@
\
asm_inline( \
"0: srl %[__ret],12\n" \
- ".pushsection runtime_shift_" #sym ",\"a\"\n" \
+ ".pushsection .runtime_shift_" #sym ",\"a\"\n" \
".long 0b - .\n" \
".popsection" \
: [__ret] "+d" (__ret)); \
diff --git a/arch/x86/include/asm/runtime-const.h b/arch/x86/include/asm/runtime-const.h
index 24e3a53ca255..0de5a40ee6d0 100644
--- a/arch/x86/include/asm/runtime-const.h
+++ b/arch/x86/include/asm/runtime-const.h
@@ -5,7 +5,7 @@
#define runtime_const_ptr(sym) ({ \
typeof(sym) __ret; \
asm_inline("mov %1,%0\n1:\n" \
- ".pushsection runtime_ptr_" #sym ",\"a\"\n\t" \
+ ".pushsection .runtime_ptr_" #sym ",\"a\"\n\t" \
".long 1b - %c2 - .\n\t" \
".popsection" \
:"=r" (__ret) \
@@ -19,7 +19,7 @@
#define runtime_const_shift_right_32(val, sym) ({ \
typeof(0u+(val)) __ret = (val); \
asm_inline("shrl $12,%k0\n1:\n" \
- ".pushsection runtime_shift_" #sym ",\"a\"\n\t" \
+ ".pushsection .runtime_shift_" #sym ",\"a\"\n\t"\
".long 1b - 1 - .\n\t" \
".popsection" \
:"+r" (__ret)); \
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index eeadbaeccf88..da097ba2d4d8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -914,8 +914,8 @@
#define NAMED_SECTION(name) \
. = ALIGN(8); \
- name : AT(ADDR(name) - LOAD_OFFSET) \
- { BOUNDED_SECTION_PRE_LABEL(name, name, __start_, __stop_) }
+ . ## name : AT(ADDR(. ## name) - LOAD_OFFSET) \
+ { BOUNDED_SECTION_PRE_LABEL(. ## name, name, __start_, __stop_) }
#define RUNTIME_CONST(t,x) NAMED_SECTION(runtime_##t##_##x)
--
2.47.0.rc1.288.g06298d1525-goog
next prev parent reply other threads:[~2024-10-14 12:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 12:57 [PATCH 0/2] Use dot prefixes for section names Ard Biesheuvel
2024-10-14 12:57 ` [PATCH 1/2] codetag: Use dot prefix for section name Ard Biesheuvel
2024-10-14 21:16 ` Suren Baghdasaryan
2024-10-14 12:57 ` Ard Biesheuvel [this message]
2024-10-14 17:29 ` [PATCH 0/2] Use dot prefixes for section names Linus Torvalds
2024-10-14 17:43 ` Ard Biesheuvel
2024-10-14 18:10 ` Linus Torvalds
2024-10-14 18:19 ` Ard Biesheuvel
2024-10-15 12:08 ` Petr Mladek
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=20241014125703.2287936-6-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=kent.overstreet@linux.dev \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=surenb@google.com \
--cc=torvalds@linux-foundation.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