From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A30DBC10F11 for ; Wed, 24 Apr 2019 18:05:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7224320652 for ; Wed, 24 Apr 2019 18:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556129141; bh=bySmKbJyZYv1G4DXWoUlswKjTYNmxuBGSqjU9uLxfxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vy8V+Os/rnim+v6rt0XBTOAIaTYwEo9a7uzw693YAGWccB+Z0kEEcuzXTU7vI/cY4 2priH+XKJAdMqoNsq7+HlKfPN3Io2iGP4pXDSDJj8917fXdM6sAaZyWK8zAYYroTp6 nIkd4KDFIoZcI0+8juojynpUONt8h5LCwOc6P2k8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389150AbfDXSFj (ORCPT ); Wed, 24 Apr 2019 14:05:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:43516 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388837AbfDXRS2 (ORCPT ); Wed, 24 Apr 2019 13:18:28 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2C6DD218B0; Wed, 24 Apr 2019 17:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556126307; bh=bySmKbJyZYv1G4DXWoUlswKjTYNmxuBGSqjU9uLxfxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YpRzC0JEvYqhWSNUJybVrwYZ5FDYya94fiPsVmuVc+RieoRO1PBx/LFMMs7r51Viu oAidJQX9wci2KCXNUpPjbGIvtcJm+fljd65Gbgh+6o3LKw5g3Im7Nq12Gosip9rPpu 6V3L6V21CeQQ5OKJ+EWvUrEmyb8qeMOk1gPUz4+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Golovin , =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= , Nick Desaulniers , Borislav Petkov , "H. Peter Anvin" , Andy Lutomirski , Brijesh Singh , Cao Jin , Ingo Molnar , Joerg Roedel , Masahiro Yamada , Masami Hiramatsu , Thomas Gleixner , Tri Vo , morbo@google.com, x86-ml , Sasha Levin Subject: [PATCH 4.4 066/168] x86/build: Mark per-CPU symbols as absolute explicitly for LLD Date: Wed, 24 Apr 2019 19:08:30 +0200 Message-Id: <20190424170927.666520353@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170923.452349382@linuxfoundation.org> References: <20190424170923.452349382@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit d071ae09a4a1414c1433d5ae9908959a7325b0ad ] Accessing per-CPU variables is done by finding the offset of the variable in the per-CPU block and adding it to the address of the respective CPU's block. Section 3.10.8 of ld.bfd's documentation states: For expressions involving numbers, relative addresses and absolute addresses, ld follows these rules to evaluate terms: Other binary operations, that is, between two relative addresses not in the same section, or between a relative address and an absolute address, first convert any non-absolute term to an absolute address before applying the operator." Note that LLVM's linker does not adhere to the GNU ld's implementation and as such requires implicitly-absolute terms to be explicitly marked as absolute in the linker script. If not, it fails currently with: ld.lld: error: ./arch/x86/kernel/vmlinux.lds:153: at least one side of the expression must be absolute ld.lld: error: ./arch/x86/kernel/vmlinux.lds:154: at least one side of the expression must be absolute Makefile:1040: recipe for target 'vmlinux' failed This is not a functional change for ld.bfd which converts the term to an absolute symbol anyways as specified above. Based on a previous submission by Tri Vo . Reported-by: Dmitry Golovin Signed-off-by: Rafael Ávila de Espíndola [ Update commit message per Boris' and Michael's suggestions. ] Signed-off-by: Nick Desaulniers [ Massage commit message more, fix typos. ] Signed-off-by: Borislav Petkov Tested-by: Dmitry Golovin Cc: "H. Peter Anvin" Cc: Andy Lutomirski Cc: Brijesh Singh Cc: Cao Jin Cc: Ingo Molnar Cc: Joerg Roedel Cc: Masahiro Yamada Cc: Masami Hiramatsu Cc: Thomas Gleixner Cc: Tri Vo Cc: dima@golovin.in Cc: morbo@google.com Cc: x86-ml Link: https://lkml.kernel.org/r/20181219190145.252035-1-ndesaulniers@google.com Signed-off-by: Sasha Levin --- arch/x86/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index a703842b54de..17e1e60b6b40 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -365,7 +365,7 @@ SECTIONS * Per-cpu symbols which need to be offset from __per_cpu_load * for the boot processor. */ -#define INIT_PER_CPU(x) init_per_cpu__##x = x + __per_cpu_load +#define INIT_PER_CPU(x) init_per_cpu__##x = ABSOLUTE(x) + __per_cpu_load INIT_PER_CPU(gdt_page); INIT_PER_CPU(irq_stack_union); -- 2.19.1