+++ Stephen Rothwell [09/02/21 21:08 +1100]:
Hi all, After merging the modules tree, today's linux-next build (powerpc allyesconfig) failed like this: In file included from include/linux/export.h:123, from include/linux/linkage.h:7, from arch/powerpc/include/asm/unistd.h:18, from <stdin>:2: ./include/generated/autoksyms.h:5:9: warning: missing whitespace after the macro name 5 | #define __KSYM_.HT_update_self_and_peer_setting 1 | ^~~~~~~ ./include/generated/autoksyms.h:6:9: warning: missing whitespace after the macro name 6 | #define __KSYM_.RemovePeerTS 1 | ^~~~~~~ ./include/generated/autoksyms.h:6: warning: "__KSYM_" redefined 6 | #define __KSYM_.RemovePeerTS 1 | ./include/generated/autoksyms.h:5: note: this is the location of the previous definition and on and on :-( Caused by commit 367948220fce ("module: remove EXPORT_UNUSED_SYMBOL*") I have reverted that commit for today.
[ Adding Michael and Masahiro to CC ] Hi Stephen, Hmm, these errors don't look like it's related to that particular commit. I was able to reproduce these weird autoksym errors even without any modules-next patches applied, and on a clean v5.11-rc7 tree. To reproduce it, CONFIG_TRIM_UNUSED_KSYMS needs to be enabled. I guess that's why we run into these errors with allyesconfig. I used a gcc-7 ppc64le cross compiler and got the same compiler warnings. It seems to not compile on powerpc properly because it looks like some symbols have an extra dot "." prefix, for example in kthread.o: 168: 0000000000000318 24 NOTYPE GLOBAL DEFAULT 6 kthread_create_worker 169: 0000000000001d90 104 FUNC GLOBAL DEFAULT 1 .kthread_create_worker 170: 0000000000000330 24 NOTYPE GLOBAL DEFAULT 6 kthread_create_worker_on_cpu 171: 0000000000001e00 88 FUNC GLOBAL DEFAULT 1 .kthread_create_worker_on_cpu 172: 0000000000000348 24 NOTYPE GLOBAL DEFAULT 6 kthread_queue_work 173: 0000000000001e60 228 FUNC GLOBAL DEFAULT 1 .kthread_queue_work So I suppose this dot prefix is specific to powerpc. From the ppc64 elf abi docs: Symbol names with a dot (.) prefix are reserved for holding entry point addresses. The value of a symbol named ".FN", if it exists, is the entry point of the function "FN". I guess the presence of the extra dot symbols is confusing scripts/gen_autoksyms.sh, so we get the dot symbols in autoksyms.h, which the preprocessor doesn't like. I am wondering how this was never caught until now and also now curious if this feature was ever functional on powerpc.. Thanks, Jessica