Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5639930img; Wed, 27 Mar 2019 12:14:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1Z6t/E43FeWIDn3BEplQdzTtHBFY4CaQ93Qq+YGoJhRMp4/RHk/DhYF5SU8YhAOfgZpa9 X-Received: by 2002:a63:6985:: with SMTP id e127mr36483906pgc.101.1553714071615; Wed, 27 Mar 2019 12:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714071; cv=none; d=google.com; s=arc-20160816; b=iR6kiG1l4ToQccf2S3xlYDdNZN9/OZDeeqV7wvK8jBjYIkdajsQcZ1Blfs0fwKk0sR Q4kav8tQ2sBOUXMEwC3dGCUusLCaEMidSQVKNeWTH1VLBDdqjciBRWFlf7DPdmFJRB3V ouDvkLx5kcaZtCkMy5C7IeulPQys4xWgI7VZ8n565IAZ5u23sDAmfASYqo2HceINxFLr xCYADR2VypBdtOmNDx2NZb31e21gOV/WBNti6F5uBqy6snxSveesOwW3GqihCYK8bxDs SBx2wAE65rMrhW6z8CiBwher0CqI1hTY/nT+hJe7Id2FYThbpiXKh8EqWKwchhOiI89V uvWg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=j4y924INlsfOcd4iO6rW50RxekoHjFa8Q4KDUYTTuew=; b=kf60DNFZ25ArBebg466v6YITv2+zlqxd3aGgnDZwQmTmi0qpt/dVX5qCu5/xUY8men jGn26rCHEDH55LBu8Tw0ypZJoGDlWBrEnU2EE7fXxTwTKgf4JjF2GwyDtVFZ8wVAKsO6 BEVZUq1X2EXaTxV0f8kdZZuz3b0csJ0jnVeZKmAIVX+x79rLW2ojSkaK6CpSDAARLRBY 2SyWPZ70t91HFay2gkuNiNZWYJoKDwM0QOIenE0FB2IONBTgYqaR4vnh0yLpGCop3Ik+ 2rKY1K2Llz7KJQB0OEkSTJugeJnyEuEn9F+RTgXJnnbzZaW720NJcpWsBDjM6B9eAeKw EnvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NgBVAw7C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f20si6355193pfd.51.2019.03.27.12.14.16; Wed, 27 Mar 2019 12:14:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NgBVAw7C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388721AbfC0SKE (ORCPT + 99 others); Wed, 27 Mar 2019 14:10:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:51958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387842AbfC0SKD (ORCPT ); Wed, 27 Mar 2019 14:10:03 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 38B1C217F5; Wed, 27 Mar 2019 18:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710202; bh=H83m7k6HEq1j/R9JVvwoogyGOHWzdbitz2Xwp1up8y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NgBVAw7C+UqLlmyqeKJpj4eZ54chOdLSrGeZKj4ZhA2mpGY3u0menpGoasqEBs1hj MaHSQvkmv3dDBQPgEAeqReZdyC92DuVaSKNr4QaXYRSudhj5ROIMeBJkjWHn7U4QN7 d0DE6f4MV9RXRxTAbs3Nh35UaUjjeEQqTBw6U1zo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?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 , dima@golovin.in, morbo@google.com, x86-ml , Sasha Levin Subject: [PATCH AUTOSEL 5.0 247/262] x86/build: Mark per-CPU symbols as absolute explicitly for LLD Date: Wed, 27 Mar 2019 14:01:42 -0400 Message-Id: <20190327180158.10245-247-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael Ávila de Espíndola [ 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 0d618ee634ac..ee3b5c7d662e 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -401,7 +401,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