build failure caused by RUNTIME_CONST()
From: Oleg Nesterov
Date: Fri Aug 02 2024 - 07:45:30 EST
make bzImage results in
undefined reference to `__start_runtime_shift_d_hash_shift'
undefined reference to `__stop_runtime_shift_d_hash_shift'
undefined reference to `__start_runtime_ptr_dentry_hashtable'
undefined reference to `__stop_runtime_ptr_dentry_hashtable'
The patch below seems to fix the problem, but I didn't find any report on lkml,
so perhaps I am the only one which hits this problem? And perhaps this is because
my gcc 5.3.1 is quite old?
OTOH, I know nothing about lds magic, so I fail to understand where these
__start/stop_runtime_xxx can come from without something like the change below...
Oleg.
---
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index ad6afc5c4918..6846fa6bdd81 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -913,10 +913,12 @@
#define RUNTIME_NAME(t,x) runtime_##t##_##x
-#define RUNTIME_CONST(t,x) \
+#define RUNTIME_CONST(t,x) _RUNTIME_CONST(RUNTIME_NAME(t,x))
+
+#define _RUNTIME_CONST(name) \
. = ALIGN(8); \
- RUNTIME_NAME(t,x) : AT(ADDR(RUNTIME_NAME(t,x)) - LOAD_OFFSET) { \
- *(RUNTIME_NAME(t,x)); \
+ name : AT(ADDR(name) - LOAD_OFFSET) { \
+ BOUNDED_SECTION_PRE_LABEL(name, name, __start_, __stop_) \
}
/* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */