Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10524730ybi; Thu, 25 Jul 2019 00:53:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqz01tnDx3JsT72DeoR1PSfFNiTrww975H+dPe99gVp5tPJpzVuQ8UaknwmX8nJe66RT+/41 X-Received: by 2002:a17:90a:2ec1:: with SMTP id h1mr92217697pjs.119.1564041220705; Thu, 25 Jul 2019 00:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564041220; cv=none; d=google.com; s=arc-20160816; b=f2hxmWWn3xy2rpGNqJ7Huyb0e5AJcuvra+DBBU/NReP4w5r6dCfhC8RJ8wG6TWGGdg No5PIDwoffAZkRQEtm/Qm3YO7vORP3DJR1XmVGyZE4wjKEFEu9IMEjoPiwu+L+llGzc3 OwLc20yn2AtjN9myLyrho7iRRanhdvP075QIqlJAJMAtV/iqiMj/xeAVOzmCj9gTkk5Y bJmxMooQ4tW3FSx3jylzivnY2ncDMBRMkmpXaOPSFJlh7ZFApySTwCCnqOaHXfDiPTFe 6zD1XxnqeTbuH/17GFEZujPB1b9YfbStDDoCzQnI7l9mdBX7z5E0a8TeoJVqe/5DBiLP WjWg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0JJODty8ia0ub930Nv4NA/8LHiaWXkOrHN9EKGJw68Y=; b=Y8z2aLtMzDm6NabTFadvC3jFIfQ32tfxWjjmko49kZGsMjWsZU3/YsimW9RGAeN51Q t9QtIzfEJhbDIYifufNPCxhxi58961eHjeIEGiIATQ8+Iz2P56a+D2Tsl9iIcudfWK6D 4JAPPcSWYE+MVQ5HNJuaZ2a4KXMnStojSgi983kVnw3kLIwSgmKoh8YN3IxcuO3b0Pkp Z/T/7oXwgk4zBY4tKvA8x1Q0qK5FdXfclp/yhbf5sT6TiNfXYJv9sDCGHJzkA5vurOBd tsUEugTpFge3G8Fn09qO7hfhHngXXzOOCsBXt/+4M9vd6DdXX6U8MO/Lts1rzZfss3Uq mrVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yWP18rkb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j185si16733616pge.91.2019.07.25.00.53.21; Thu, 25 Jul 2019 00:53:40 -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=yWP18rkb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405512AbfGXUC2 (ORCPT + 99 others); Wed, 24 Jul 2019 16:02:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:52110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392243AbfGXUCY (ORCPT ); Wed, 24 Jul 2019 16:02:24 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 CA4CB206BA; Wed, 24 Jul 2019 20:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998543; bh=W+A3HzL8frahF/4NuTWlyBvv3yQCjtHeV+jsA0nVNHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWP18rkb9N4gb/iOe0jPgbN5qGtfnqeq8nzBsbEFIeZct0pi5f5QA8AH7ONNOboeJ CMuSPZpSnZJYDqf5+5SJ6qz1LzokX3f26+HU1dL1wkaLuIBWhhLRkXyFsjyctb8vQf Tdvc6dLtrB8+BjA5Gq/KiHeXqTEAkY9g8+6Fujcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Fangrui Song , Nathan Chancellor , Will Deacon , Sasha Levin , Peter Smith Subject: [PATCH 4.19 003/271] arm64/efi: Mark __efistub_stext_offset as an absolute symbol explicitly Date: Wed, 24 Jul 2019 21:17:52 +0200 Message-Id: <20190724191655.533901343@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 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 8da289dc843a..eff6a564ab80 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