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=-14.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 70BCAC4724C for ; Fri, 1 May 2020 08:50:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 504532076D for ; Fri, 1 May 2020 08:50:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=golovin.in header.i=@golovin.in header.b="ARiE+ETt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728554AbgEAIuG (ORCPT ); Fri, 1 May 2020 04:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728217AbgEAIuF (ORCPT ); Fri, 1 May 2020 04:50:05 -0400 X-Greylist: delayed 439 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 01 May 2020 01:50:04 PDT Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D87C035494 for ; Fri, 1 May 2020 01:50:04 -0700 (PDT) Received: from mxback27j.mail.yandex.net (mxback27j.mail.yandex.net [IPv6:2a02:6b8:0:1619::227]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 17D8367418E1; Fri, 1 May 2020 11:42:42 +0300 (MSK) Received: from sas8-b61c542d7279.qloud-c.yandex.net (sas8-b61c542d7279.qloud-c.yandex.net [2a02:6b8:c1b:2912:0:640:b61c:542d]) by mxback27j.mail.yandex.net (mxback/Yandex) with ESMTP id SUQtlbkE3G-gf7WPW96; Fri, 01 May 2020 11:42:42 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golovin.in; s=mail; t=1588322562; bh=gan9a/JARj/+uZ3h35bsl+BDo6XiSEqZSpSCQqcjDAA=; h=Subject:To:From:Cc:Date:Message-Id; b=ARiE+ETtWtuGINV5klL98d9ZvWL/iVptFaDgh8qjjv1/oUOxXqzTHCVJqIOVRjbHd rAVoHhk0TEx3w2Hp15CKf34pPinyFErR3+iBSdGlzbD0VsUR/93i2VR9L2rHmNdC1c wOpYREBHQDZlP/bAoldT9LcbSHdFGCM4/cfGQmVY= Authentication-Results: mxback27j.mail.yandex.net; dkim=pass header.i=@golovin.in Received: by sas8-b61c542d7279.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8KmUsRmuq5-ge5iAngf; Fri, 01 May 2020 11:42:40 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Dmitry Golovin To: clang-built-linux@googlegroups.com Cc: Dmitry Golovin , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Nick Desaulniers , Ard Biesheuvel , Masahiro Yamada , Daniel Kiper , linux-kernel@vger.kernel.org Subject: [PATCH] x86/boot: allow a relocatable kernel to be linked with lld Date: Fri, 1 May 2020 08:42:13 +0000 Message-Id: <20200501084215.242-1-dima@golovin.in> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org LLD by default disallows relocations in read-only segments. For a relocatable kernel, we pass -z notext to the linker to explicitly allow relocations. This behavior is the default for BFD. Link: https://github.com/ClangBuiltLinux/linux/issues/579 Signed-off-by: Dmitry Golovin --- arch/x86/boot/compressed/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 5f7c262bcc99..7214751e1671 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -57,6 +57,9 @@ else KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif +ifeq ($(CONFIG_RELOCATABLE), y) +KBUILD_LDFLAGS += -z notext +endif LDFLAGS_vmlinux := -T hostprogs := mkpiggy -- 2.25.1