From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753142AbdLEOAH (ORCPT ); Tue, 5 Dec 2017 09:00:07 -0500 Received: from mga07.intel.com ([134.134.136.100]:38426 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752830AbdLEOAA (ORCPT ); Tue, 5 Dec 2017 09:00:00 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,364,1508828400"; d="scan'208";a="9781067" From: "Kirill A. Shutemov" To: Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" Cc: Linus Torvalds , Andy Lutomirski , Cyrill Gorcunov , Borislav Petkov , Andi Kleen , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , stable@vger.kernel.org Subject: [PATCHv4 1/4] x86/boot/compressed/64: Fix build with GCC < 5 Date: Tue, 5 Dec 2017 16:59:39 +0300 Message-Id: <20171205135942.24634-2-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171205135942.24634-1-kirill.shutemov@linux.intel.com> References: <20171205135942.24634-1-kirill.shutemov@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 0-day reported this build error: arch/x86/boot/compressed/pgtable_64.o: In function `l5_paging_required': pgtable_64.c:(.text+0x22): undefined reference to `__force_order' The issue is only with GCC < 5 and when KASLR is disabled. Newer GCC works fine. __force_order is used by special_insns.h asm code to force instruction serialization. It doesn't actually referenced from the code, but GCC < 5 with -fPIE would still generate undefined symbol. I didn't noticed this before and failed to move __force_order definition from pagetable.c (which compiles only with KASLR enabled) to pgtable_64.c. Signed-off-by: Kirill A. Shutemov Fixes: 10c9a5346f72 ("x86/boot/compressed/64: Detect and handle 5-level paging at boot-time") Cc: stable@vger.kernel.org --- arch/x86/boot/compressed/pagetable.c | 3 --- arch/x86/boot/compressed/pgtable_64.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/x86/boot/compressed/pagetable.c b/arch/x86/boot/compressed/pagetable.c index 6bd51de4475c..250826ac216e 100644 --- a/arch/x86/boot/compressed/pagetable.c +++ b/arch/x86/boot/compressed/pagetable.c @@ -38,9 +38,6 @@ #define __PAGE_OFFSET __PAGE_OFFSET_BASE #include "../../mm/ident_map.c" -/* Used by pgtable.h asm code to force instruction serialization. */ -unsigned long __force_order; - /* Used to track our page table allocation area. */ struct alloc_pgt_data { unsigned char *pgt_buf; diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c index 7bcf03b376da..491fa2d08bca 100644 --- a/arch/x86/boot/compressed/pgtable_64.c +++ b/arch/x86/boot/compressed/pgtable_64.c @@ -1,5 +1,16 @@ #include +/* + * __force_order is used by special_insns.h asm code to force instruction + * serialization. + * + * It doesn't actually referenced from the code, but GCC < 5 with -fPIE + * would still generate undefined symbol. + * + * Let's workaround this by defining the variable. + */ +unsigned long __force_order; + int l5_paging_required(void) { /* Check if leaf 7 is supported. */ -- 2.15.0