Subject: Re: linux-next: build failure after merge of the modules tree

From: Jessica Yu <[email-masked]>
Date: Wed, 10 Feb 2021 17:16:31 +0100

+++ Stephen Rothwell [10/02/21 23:21 +1100]:
>Hi Jessica,
>
>On Wed, 10 Feb 2021 09:06:48 +0100 Jessica Yu <[email-masked]> wrote:
>>
>> Sorry, by "feature" I meant CONFIG_TRIM_UNUSED_KSYMS. This config
>> option was introduced around v4.7. If simply enabling it produces
>> these compilation errors I was wondering if it ever built properly on
>> powerpc.
>
>Ah, of course.  So for a quick fix, you could revert just the changes
>to lib/Kconfig and all the defconfigs.  That way all the UNUSED_SYMBOLS
>infrastructure is still removed, but TRIM_UNUSED_KSYMS remains (un)set
>whenever it used to be (un)set and that could then be cleaned up in a
>followup patch set per architecture when we know it works.

Hi Stephen,

What's maybe simpler is marking this as BROKEN on PPC64 as a temporary
fix for linux-next until Masahiro's patch (the real fix) is posted. I
think the real problem is that TRIM_UNUSED_KSYMS was pretty much
hiding behind UNUSED_SYMBOLS=y until it finally got removed. Anyway
the main point is that TRIM_UNUSED_KSYMS=y shouldn't be breaking any
builds. I've pushed this change and hope that won't break linux-next now.

---
	
 From 1fa67f8391acb88a54e7defe6b73f8f171450f4a Mon Sep 17 00:00:00 2001
From: Jessica Yu <[email-masked]>
Date: Wed, 10 Feb 2021 16:59:53 +0100
Subject: [PATCH] module: mark TRIM_UNUSED_KSYMS as BROKEN on powerpc

Commit 367948220fce, which removed CONFIG_UNUSED_SYMBOLS, unraveled the
TRIM_UNUSED_KSYMS config option to be generally available without depending
on CONFIG_UNUSED_SYMBOLS=y. With CONFIG_UNUSED_SYMBOLS gone, this means
allyesconfig will now select this option without being "behind"
CONFIG_UNUSED_SYMBOLS. Unfortunately, this revealed some underlying build
issues on powerpc. When CONFIG_TRIM_UNUSED_KSYMS is enabled on powerpc, the
build would fail 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

This is due to the addition of a dot "." prefix to some symbols that is
specific to powerpc, which confuses the gen_autoksyms script.

This is a temporary workaround for linux-next until gen_autoksyms and
modpost gets fixed.

Link: http://lore.kernel.org/r/[email-masked]
Signed-off-by: Jessica Yu <[email-masked]>
---
  init/Kconfig | 1 +
  1 file changed, 1 insertion(+)

diff --git a/init/Kconfig b/init/Kconfig
index 11b803b45c19..e4504a04b601 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -2264,6 +2264,7 @@ config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
  
  config TRIM_UNUSED_KSYMS
  	bool "Trim unused exported kernel symbols"
+	depends on !PPC64 || BROKEN
  	help
  	  The kernel and some modules make many symbols available for
  	  other modules to use via EXPORT_SYMBOL() and variants. Depending