[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241014125703.2287936-6-ardb+git@google.com>
Date: Mon, 14 Oct 2024 14:57:06 +0200
From: Ard Biesheuvel <ardb+git@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: Ard Biesheuvel <ardb@...nel.org>, Linus Torvalds <torvalds@...ux-foundation.org>,
Masahiro Yamada <masahiroy@...nel.org>, Nathan Chancellor <nathan@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>, Kent Overstreet <kent.overstreet@...ux.dev>,
Arnd Bergmann <arnd@...db.de>, linux-arch@...r.kernel.org, linux-mm@...ck.org,
linux-kbuild@...r.kernel.org
Subject: [PATCH 2/2] runtime-const: Use dot prefix for section names
From: Ard Biesheuvel <ardb@...nel.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@...nel.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
Powered by blists - more mailing lists