Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2015008ybh; Tue, 14 Jul 2020 13:12:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5cvIv9LTOE/jbt+Eop+ZjVlJRGjKl3KkqU9brce1Hl7gx+JWxaMD5fjOdyX41SKoDoOw4 X-Received: by 2002:aa7:c398:: with SMTP id k24mr6182306edq.95.1594757578555; Tue, 14 Jul 2020 13:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594757578; cv=none; d=google.com; s=arc-20160816; b=sOC833q73+MzMiZiJajkw+0VK8GIyzCqiaWlDEcZYJTqQKsfBeirNUEBpxBubjt9sM SG4cSwR4uhQ6AHTutW44N5ZNtTW76rq60WWPzrvPIvJFU4PcIz9iMWI9+fZBHaZZmEcT t13W6Kd5tENY+BA3DpnrJ5P/AteWiOjdOkhyeYh1UT7bITNu1Hh2X5FWQlNHTYTDPNcM XsIuR8QNaruWc/zY4+yfRl5SQ5C7l8teuPflqhrBxjP4+xwAGmX2IKF1VCdPiasmU+Lk XhadoEabTbo8RD/rKRQsAG+E0rWNYVadOq9q7Sa40NN/UwYWDUnDh9VfzDbEDmx8RSlF Mz2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=7R3dCXqsSoyh387FNpg7of+Vy2Uow0OshGTXM3A59Lo=; b=VmIpb5eya/ZI0vXvWy+K7uDDPKFqoNmO5nXkVY/8hFS5TN3tafrKWNQMhUQwma2/6E oexGjZBOkP/s7q7JH5zLCzo5CUuroZ1Vl03grrDW/lUr7PRsbzPBwloun4xpGXi45GJa 8tIjS0s4kWL2A3x3BoTpX3YaNtIvNwDUUu1np2IW82PfuQzXvR5Pfz6Ksuos9iZ7mJza 0iKeBWQchXm0YytTbb/Un2/fTHNEHg0ffMDaaKksm2NVeqQ2jVXLJ+iz4mmJJ1Ygn29w D39mQGQCiHKi+V3chTqxgRDxUlvzlNk+x4iyBnK29n49Iy5TB/YO2lNZfeD82HeU3lJB yOPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qa5xbbgS; 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 u14si11674162edq.122.2020.07.14.13.12.34; Tue, 14 Jul 2020 13:12:58 -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=qa5xbbgS; 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 S1728722AbgGNUIR (ORCPT + 99 others); Tue, 14 Jul 2020 16:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726400AbgGNUIQ (ORCPT ); Tue, 14 Jul 2020 16:08:16 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE63BC061755 for ; Tue, 14 Jul 2020 13:08:16 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id v8so18687643iox.2 for ; Tue, 14 Jul 2020 13:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=7R3dCXqsSoyh387FNpg7of+Vy2Uow0OshGTXM3A59Lo=; b=qa5xbbgSqDFSqHmM56KWb16bYK0iDbPVkZs70iYrW4xgJyjSKR/5uqwiLmSlmoCLD9 /4wNRu7Jy4WdnXZk+YtEC9lEYRjwP60InPz+yhlBVv/xKq/+AFvNv/g7xYLFGs++7V4Q EOApNkQiaQV20m1vFh8bJBgBCEP+mZd8wb/VEOnQ4fGygVqEDV8zQxIKGun8GwWZ5xay dN++q5KoeejqFDJD/jhkYjkuYrJqBzy3m7PcimIFSz9P2nzhZrLfJzqh7+y+vLqsbvd8 wImg9/1/81zcreyoQLJzYKEM7unzDAjUfhdMT47DS8NQRt4DLo5FzJ+qY/95TSucfoFT 0TyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=7R3dCXqsSoyh387FNpg7of+Vy2Uow0OshGTXM3A59Lo=; b=k1iahIeGVjcZSgv2Jehi68jwfgybmUdD0BTqPgiq07bIQKiyvHIzKK3nAlY+G+OCtl UaCif/m+xrjG1VrTw/i3McuZX0q/+mU7GV2pZCk7dF+lGb7aisZ0b92p5lvBnnAVqKZc 8NAgW1g/SkuNXxOpTZX2yr5Ltfa6SAYoSnI5idloXNBCFjCmlbHVC6BUau91g4pfUOVA OSXVerBzWttWva6KWLgMGKwjEVFfKTiKW+i3gJKrGcD2rj4gqtbREwWWtEaJSICHXHgh E4VoabQ7XAwkQ1bRBBTRCdZvPhevKrfzYo+9ZZGt6VeBPPcl3jTpRYOOk5fc/LQHlN/G e+Sw== X-Gm-Message-State: AOAM5310HAjfuZ/Mlau5L+7wf2icDKeTx2vGeMKImrp5rkbpQGkX6jHq rddiV4W90tu/rbCWh2XwrSaEgZNR+g0H44Vd+2E= X-Received: by 2002:a05:6638:2591:: with SMTP id s17mr7925053jat.23.1594757296233; Tue, 14 Jul 2020 13:08:16 -0700 (PDT) MIME-Version: 1.0 References: <20200629140928.858507-1-nivedita@alum.mit.edu> <20200714023836.2310569-1-nivedita@alum.mit.edu> <20200714141550.GA329060@rani.riverdale.lan> <20200714192956.GA689174@rani.riverdale.lan> In-Reply-To: Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Tue, 14 Jul 2020 22:08:04 +0200 Message-ID: Subject: Re: [PATCH v4 0/7] x86/boot: Remove runtime relocations from compressed kernel To: Arvind Sankar Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Nick Desaulniers , Fangrui Song , Dmitry Golovin , Clang-Built-Linux ML , Ard Biesheuvel , Masahiro Yamada , Daniel Kiper , Kees Cook , Nathan Chancellor , Arnd Bergmann , "H . J . Lu" , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 14, 2020 at 9:53 PM Sedat Dilek wrote: > > On Tue, Jul 14, 2020 at 9:29 PM Arvind Sankar wrote: > > > > On Tue, Jul 14, 2020 at 08:30:14PM +0200, Sedat Dilek wrote: > > > > I did a full new build... > > > > > > > > ...and it fails with ld.lld-11 as linker: > > > > > > > > ld.lld-11 -m elf_x86_64 -pie --no-dynamic-linker -r -o > > > > arch/x86/boot/compressed/.tmp_misc.o arch/x86/boot/compressed/misc.o > > > > -T arch/x86/boot/compressed/.tmp_misc.ver; mv -f > > > > arch/x86/boot/compressed/.tmp_misc.o arch/x86/boot/compressed/misc.o; > > > > rm -f arch/x86/boot/compressed/.tmp_misc.ver; fi > > > > *** ld.lld-11: error: -r and -pie may not be used together *** > > > > make[5]: *** [scripts/Makefile.build:281: > > > > arch/x86/boot/compressed/misc.o] Error 1 > > > > > > > > It's annoying to fail on the last minutes of a build. > > > > Sorry for being very honest. > > > > > > > > > > I applied this diff... > > > > > > $ git diff arch/x86/boot/compressed/Makefile > > > diff --git a/arch/x86/boot/compressed/Makefile > > > b/arch/x86/boot/compressed/Makefile > > > index 789d5d14d8b0..9ba52a656838 100644 > > > --- a/arch/x86/boot/compressed/Makefile > > > +++ b/arch/x86/boot/compressed/Makefile > > > @@ -51,7 +51,10 @@ UBSAN_SANITIZE :=n > > > KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) > > > # Compressed kernel should be built as PIE since it may be loaded at any > > > # address by the bootloader. > > > +# LLD linker does not allow -r and -pie options to be used together. > > > +ifndef CONFIG_LD_IS_LLD > > > KBUILD_LDFLAGS += -pie $(call ld-option, --no-dynamic-linker) > > > +endif > > > LDFLAGS_vmlinux := -T > > > > > > hostprogs := mkpiggy > > > > > > ...and was able to build, assemble, link arch/x86/boot/compressed/*. > > > > > > - Sedat - > > > > Thanks for the test. > > > > Can you share your .config? The error messages look like they're coming > > from running modversions on misc.o, which is unexpected as it shouldn't > > have any exported symbols, and it doesn't in my builds. > > > > In any case, I think the right fix here would be to add -pie and > > --no-dynamic-linker to LDFLAGS_vmlinux instead of KBUILD_LDFLAGS. > > Hmm, you might be right with moving to LDFLAGS_vmlinux. > We will need the "ifndef CONFIG_LD_IS_LLD" as -r and -pie cannot be used together. Is that the or not the fact when moving to LDFLAGS_vmlinux? I cannot test as I modified my local Git and re-invoking my build-script is doing a whole new build-dance. - Sedat -