runtime constants: move list of constants to vmlinux.lds.h
authorJann Horn <jannh@google.com>
Tue, 30 Jul 2024 20:15:16 +0000 (22:15 +0200)
committerArnd Bergmann <arnd@arndb.de>
Mon, 19 Aug 2024 07:48:14 +0000 (09:48 +0200)
Refactor the list of constant variables into a macro.
This should make it easier to add more constants in the future.

Signed-off-by: Jann Horn <jannh@google.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/arm64/kernel/vmlinux.lds.S
arch/s390/kernel/vmlinux.lds.S
arch/x86/kernel/vmlinux.lds.S
include/asm-generic/vmlinux.lds.h

index 55a8e31..58d89d9 100644 (file)
@@ -264,8 +264,7 @@ SECTIONS
                EXIT_DATA
        }
 
-       RUNTIME_CONST(shift, d_hash_shift)
-       RUNTIME_CONST(ptr, dentry_hashtable)
+       RUNTIME_CONST_VARIABLES
 
        PERCPU_SECTION(L1_CACHE_BYTES)
        HYPERVISOR_PERCPU_SECTION
index e67cd40..5e2e445 100644 (file)
@@ -191,8 +191,7 @@ SECTIONS
        . = ALIGN(PAGE_SIZE);
        INIT_DATA_SECTION(0x100)
 
-       RUNTIME_CONST(shift, d_hash_shift)
-       RUNTIME_CONST(ptr, dentry_hashtable)
+       RUNTIME_CONST_VARIABLES
 
        PERCPU_SECTION(0x100)
 
index 6e73403..6726be8 100644 (file)
@@ -357,8 +357,7 @@ SECTIONS
        PERCPU_SECTION(INTERNODE_CACHE_BYTES)
 #endif
 
-       RUNTIME_CONST(shift, d_hash_shift)
-       RUNTIME_CONST(ptr, dentry_hashtable)
+       RUNTIME_CONST_VARIABLES
 
        . = ALIGN(PAGE_SIZE);
 
index 1ae4479..2157d88 100644 (file)
 
 #define RUNTIME_CONST(t,x) NAMED_SECTION(runtime_##t##_##x)
 
+#define RUNTIME_CONST_VARIABLES                                                \
+               RUNTIME_CONST(shift, d_hash_shift)                      \
+               RUNTIME_CONST(ptr, dentry_hashtable)
+
 /* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */
 #define KUNIT_TABLE()                                                  \
                . = ALIGN(8);                                           \