Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1342920ybz; Fri, 1 May 2020 20:47:07 -0700 (PDT) X-Google-Smtp-Source: APiQypJuPgf+PwstxSEq1Q70JlYWw3ZI1/FwApQeulqpgPUuqqUS6BGVJVfvZFXEKgXyQsq4IhtW X-Received: by 2002:a17:906:1443:: with SMTP id q3mr6244776ejc.325.1588391227167; Fri, 01 May 2020 20:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588391227; cv=none; d=google.com; s=arc-20160816; b=xjzDu5vUPU0osG1jcuiqFGjj7Y7xS7/MHwEl7frowGbHvL4D+Uwos+Q55vuEaG9yPg rLyhjD6tHb5LxUCTfqPzIleiRI3GKCBeby1sC6jAg5D70k0sgPiuEmPFhwfcPjImE/Dl 0hQYVk7dT+tZPY3PKirFtiYALs3w5OqoK6fuKwCKJAkI1SIR6FC9B1/WWYAeNIxkNan/ /63WtqzI2OtinyPHJ9Eu3FTe5T7RsEMKdy99z920Cb+M/3+ymBH9QJAdgvec/K0E4vG9 yK7qQyOGwFrH8RfRmtry/IoNBNCgEY8UZ4Q38wrLok2M3BPzcbcOol/FLj8iZN2xlb5U a6hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=R5gKcAhtGMy8Ketx1mS4p/ONHNY9/H41NnazeLBqjX0=; b=HOXJi+5vu7E4ubw1VlRqp/68GCSi6qi9ojMj/HI5WApoD9/327qGjyF8nwdN1CVCLD p393kSV7MuTDGMrWA55rkWJ3lMfK8yGeFRv+va658fBYo9i9ws/DOpRP2FgkIvBjxaBn 1PTQN6wGJGnwZMNAKniIsSJcGopH8YW1gUqY8Fr7cAo0D9KA8g1K1knCR2rUguwm56Ky jdH8vyZpQ/xqrkYZyEX+PM4MVb6lqpd1cR2j/41QyEnbZi5KA5H6k+QhEKsfV1B4GxlG oeJp78bwMXCdpfe9i8IDf9alnCVD20K69kaY9U5XOaXn/z7uRjXxBtmnknQFy5NdPWDz BvZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T14eaIz6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si2618763edq.231.2020.05.01.20.46.42; Fri, 01 May 2020 20:47:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=T14eaIz6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726654AbgEBDnK (ORCPT + 99 others); Fri, 1 May 2020 23:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbgEBDnK (ORCPT ); Fri, 1 May 2020 23:43:10 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10C89C061A0C for ; Fri, 1 May 2020 20:43:10 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id i13so1600675oie.9 for ; Fri, 01 May 2020 20:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=R5gKcAhtGMy8Ketx1mS4p/ONHNY9/H41NnazeLBqjX0=; b=T14eaIz6l5Sw2CzC8t5t34Q0gf+5KG+tJDPxVBq0eJQP9PEIhijlBDQP1ktR1+Uklz A4XkDfvY0ByeViP6Qk7MaasB3fIASD3NL4vF7i3of/ttceW/jBhuWw1QgTNIx3bGR6T0 ezDWK1fdSMJ1oZLTvUj6Py41gJcKs8fq0oY1GCVTQDIKJjXBteaxTz5ZnZBT7prkxuF5 ncVh5QbG8Qy2R7wbbwnH23NsEXFIwu9f0DOTy+XBRoEp7RvuE7m7s6GTqDz/2sWlEDqa M4RBVlFFfb+qhBVxc2ow8PtzDVVhZ5WE/q/E/9RPInCNzFIAABlhN4buahJLOoFUVBH2 7JGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=R5gKcAhtGMy8Ketx1mS4p/ONHNY9/H41NnazeLBqjX0=; b=RZpGTv2+cAvZmTxrKAVa+3CjvLcED+eKVe+nbGNZx9squjn06J6VOiCF0+h9nwZGI1 Yp6cZ6CmOP2LSmGRcuSORA46wGO5fn3Bfvo7J62CrNWK+zm7XLhmAO/8FWCFQ2mtoU9T u89fnYVV3yeyN4FcauLz1n81DlgFoIPaxFFtYJKpbLlU1cfFIoU0BCzpQV+n042UZQIo gWlkwa6IZdM2xAHg1SmewqtYRRfYMCqkB/FmXDvC5st+dHqXN4+MVkHQRXxygNaJDUJk qF0BMcKmdJSFj1mDyydFR5+lSRk33CDeoMXW1IyZlKApCK+rgZi5gmcD9vXoOKLJjJ1+ tk+g== X-Gm-Message-State: AGi0PuZToQfkqiFmi2vF9Pj2bs8zQF6A8f5CiDKTs5ieeKzL/W0VBsV0 5mlW0krXZMx1a7jKrDixcHI= X-Received: by 2002:aca:f2d5:: with SMTP id q204mr1981188oih.98.1588390989226; Fri, 01 May 2020 20:43:09 -0700 (PDT) Received: from ubuntu-s3-xlarge-x86 ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id e91sm1362262otb.40.2020.05.01.20.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 20:43:08 -0700 (PDT) Date: Fri, 1 May 2020 20:43:07 -0700 From: Nathan Chancellor To: Dmitry Golovin Cc: clang-built-linux@googlegroups.com, 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: Re: [PATCH] x86/boot: allow a relocatable kernel to be linked with lld Message-ID: <20200502034307.GA2971661@ubuntu-s3-xlarge-x86> References: <20200501084215.242-1-dima@golovin.in> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200501084215.242-1-dima@golovin.in> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 01, 2020 at 08:42:13AM +0000, Dmitry Golovin wrote: > 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 I was able to link a Clang built i386_defconfig kernel with ld.lld and boot it in QEMU 5.0 after this change. A GCC built kernel links still with ld.bfd and also boots in QEMU successfully. x86_64_defconfig with both compilers and their respective linkers did not regress. Tested-by: Nathan Chancellor > --- > 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 >