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=-15.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,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 108D6C74A21 for ; Wed, 10 Jul 2019 15:03:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D68E021537 for ; Wed, 10 Jul 2019 15:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562771013; bh=CbmMWEeV6MOMCbYKjw+SxwbG0mG1v/wTHIyvOGV82N4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ihYbiCxA6Zxx1rGXlFPbjiL+xJNPty8h1iCTREBDGKLkFIUrHatpNwLIL+6XfbsWH M9jLacdYFvUi7RsdEJH7KGhco1pORmJMjGz1j1MSwjCD9r/hGaH7G1Kfrr6ibgeN3l t4neAYi/VuMcJjIPpTGAj+iptZL4rCmC7af5BsgQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728205AbfGJPDc (ORCPT ); Wed, 10 Jul 2019 11:03:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:35448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728167AbfGJPD2 (ORCPT ); Wed, 10 Jul 2019 11:03:28 -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 66C7A2064A; Wed, 10 Jul 2019 15:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562771007; bh=CbmMWEeV6MOMCbYKjw+SxwbG0mG1v/wTHIyvOGV82N4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wk+3KErBooiH15vwv4gT1Z4FFSdo2CSPaG+zmVbD5/GDsi7ytzKFqvljVZmNhEJae TeSX+OYvaZ4pLWcp4eSmHVfUgQJbg2a/f1c6zyeOJigGQkjoFGFIq1vw9KK8tGxn6c 74zfg/QkWoh34N1MsSv9DTcMFs6ZKvkLM1qEjqeo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , Ard Biesheuvel , Fangrui Song , Peter Smith , Will Deacon , Sasha Levin , clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 4.14 3/8] arm64/efi: Mark __efistub_stext_offset as an absolute symbol explicitly Date: Wed, 10 Jul 2019 11:03:13 -0400 Message-Id: <20190710150319.7258-3-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190710150319.7258-1-sashal@kernel.org> References: <20190710150319.7258-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review 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: Nathan Chancellor [ Upstream commit aa69fb62bea15126e744af2e02acc0d6cf3ed4da ] After r363059 and r363928 in LLVM, a build using ld.lld as the linker with CONFIG_RANDOMIZE_BASE enabled fails like so: ld.lld: error: relocation R_AARCH64_ABS32 cannot be used against symbol __efistub_stext_offset; recompile with -fPIC Fangrui and Peter figured out that ld.lld is incorrectly considering __efistub_stext_offset as a relative symbol because of the order in which symbols are evaluated. _text is treated as an absolute symbol and stext is a relative symbol, making __efistub_stext_offset a relative symbol. Adding ABSOLUTE will force ld.lld to evalute this expression in the right context and does not change ld.bfd's behavior. ld.lld will need to be fixed but the developers do not see a quick or simple fix without some research (see the linked issue for further explanation). Add this simple workaround so that ld.lld can continue to link kernels. Link: https://github.com/ClangBuiltLinux/linux/issues/561 Link: https://github.com/llvm/llvm-project/commit/025a815d75d2356f2944136269aa5874721ec236 Link: https://github.com/llvm/llvm-project/commit/249fde85832c33f8b06c6b4ac65d1c4b96d23b83 Acked-by: Ard Biesheuvel Debugged-by: Fangrui Song Debugged-by: Peter Smith Suggested-by: Fangrui Song Signed-off-by: Nathan Chancellor [will: add comment] Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/kernel/image.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h index 40f9f0b078a4..12af2ba8d558 100644 --- a/arch/arm64/kernel/image.h +++ b/arch/arm64/kernel/image.h @@ -73,7 +73,11 @@ #ifdef CONFIG_EFI -__efistub_stext_offset = stext - _text; +/* + * Use ABSOLUTE() to avoid ld.lld treating this as a relative symbol: + * https://github.com/ClangBuiltLinux/linux/issues/561 + */ +__efistub_stext_offset = ABSOLUTE(stext - _text); /* * The EFI stub has its own symbol namespace prefixed by __efistub_, to -- 2.20.1