[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200527135329.1172644-1-arnd@arndb.de>
Date: Wed, 27 May 2020 15:53:19 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org
Cc: Arnd Bergmann <arnd@...db.de>, "H. Peter Anvin" <hpa@...or.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Zhenzhong Duan <zhenzhong.duan@...cle.com>,
Kees Cook <keescook@...omium.org>,
Peter Zijlstra <peterz@...radead.org>,
Juergen Gross <jgross@...e.com>,
Andy Lutomirski <luto@...nel.org>,
Andrew Cooper <andrew.cooper3@...rix.com>,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: [PATCH] x86: work around clang IAS bug referencing __force_order
When using the clang integrated assembler, we get a reference
to __force_order that should normally get ignored in a few
rare cases:
ERROR: modpost: "__force_order" [drivers/cpufreq/powernow-k6.ko] undefined!
Add a 'static' definition so any file in which this happens can
have a local copy.
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
arch/x86/boot/compressed/pgtable_64.c | 2 ++
arch/x86/include/asm/special_insns.h | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c
index c8862696a47b..8595194cea41 100644
--- a/arch/x86/boot/compressed/pgtable_64.c
+++ b/arch/x86/boot/compressed/pgtable_64.c
@@ -12,7 +12,9 @@
* It is not referenced from the code, but GCC < 5 with -fPIE would fail
* due to an undefined symbol. Define it to make these ancient GCCs work.
*/
+#ifndef CONFIG_CC_IS_CLANG
unsigned long __force_order;
+#endif
#define BIOS_START_MIN 0x20000U /* 128K, less than this is insane */
#define BIOS_START_MAX 0x9f000U /* 640K, absolute maximum */
diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
index 82436cb04ccf..7081e587c1ea 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -16,8 +16,15 @@
* A memory clobber would solve the problem, but would prevent reordering of
* all loads stores around it, which can hurt performance. Solution is to
* use a variable and mimic reads and writes to it to enforce serialization
+ *
+ * Clang sometimes fails to kill the reference to the dummy variable, so
+ * provide an actual copy.
*/
+#ifdef CONFIG_CC_IS_CLANG
+static unsigned long __force_order;
+#else
extern unsigned long __force_order;
+#endif
void native_write_cr0(unsigned long val);
--
2.26.2
Powered by blists - more mailing lists