Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp928638ybm; Wed, 27 May 2020 11:23:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNualLGwC4vzwtIz7jc5CK1ISDSiU07GpKQjIG7cmpRWqR8L4G3miax5GBPFWJzr2ywar0 X-Received: by 2002:aa7:da04:: with SMTP id r4mr24627758eds.346.1590603819738; Wed, 27 May 2020 11:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590603819; cv=none; d=google.com; s=arc-20160816; b=SIum1oVG4pzIcUB4mNdQzPnAXMxjWMCRUmQvKEgQKZaLiviLqMKWvHuEnXrnyFYUgT CL7IQ+JEy5Lb7jCJ0wPQxIobj3O0HRdLAXN5A7LLbzWdvQLcDOyCuB3vOI5nAM+ZfqO4 m4QMonB+AyKmaojnT3ZXqGzq6TltT78ZRRqx2ZR5NSrdWWlTRt7H0xhMQMUnorrqfDHu SDvCRdlq2rwtfeXZ7VHg4t0j5ZbKlH4+jVlusHyKcaB8bJsx1Yut5wn/yClbi5SRqdmc dkt6vZOsRuuRprcDgzwZbhtc0alUSLmaMnECG+1z/Ggbc8hes6bs4GrTkOnPjhsCIH4y 0HGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3OrbvJl1+u8ctjMZoCdQgF5ZV/h/AZJHsksjuO1IF7M=; b=d888qZTF2RJ2dUKgJbdAkOAIzoP69L4eks+qd7vXa/P/rCTk9Dhc9TKZE/MIOuSg3q FFHXFoPsMUIt1MG6KjwPeZqKTytBZtzRb6cZG1mLiAWQOn2kIpJ/gZdZOHKzZpozQfvC 3I8dy0B5AReH/YnQvSgacHgvPQUvx4SqWtpwxlEiU8m3DRLmZi3snoUfvqF+mwqMWCL9 jeGXW4gqpPU4kvVpv0CxqAbv/qlI4b3Etc/OGPIl44xw+jbdbIcjO7lbNQI6IfdNsyFf Jy5uxBZ1ct5qKFDbqpxIujcGezMpt5/nNrrP/hpaM/T8nT4Ym5reb8bVEgI1L0Dtun6u 2nQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds8si3038278ejc.350.2020.05.27.11.23.15; Wed, 27 May 2020 11:23:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388591AbgE0NyM (ORCPT + 99 others); Wed, 27 May 2020 09:54:12 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:50787 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387581AbgE0NyM (ORCPT ); Wed, 27 May 2020 09:54:12 -0400 Received: from threadripper.lan ([149.172.98.151]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MJm8H-1jKMLM2LCT-00K8Nw; Wed, 27 May 2020 15:53:33 +0200 From: Arnd Bergmann To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org Cc: Arnd Bergmann , "H. Peter Anvin" , "Kirill A. Shutemov" , Zhenzhong Duan , Kees Cook , Peter Zijlstra , Juergen Gross , Andy Lutomirski , Andrew Cooper , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] x86: work around clang IAS bug referencing __force_order Date: Wed, 27 May 2020 15:53:19 +0200 Message-Id: <20200527135329.1172644-1-arnd@arndb.de> X-Mailer: git-send-email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7eMZvAvBPHq/88y5eU pu/PPoXunnSctZWlfOvL6pDkVcJUPl6lTK24QuvoItc1tYZ9HOO92obr2kVBIIHTfefxQWp0M ri9ItI+AQjsep3e55X17LZfWUAp0pDioitA40fBjN3LHpZo0Uw= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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