Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp736611ybb; Fri, 10 Apr 2020 09:05:02 -0700 (PDT) X-Google-Smtp-Source: APiQypIMAx6fiCReVasbyDkcnXMXcXD9wNOkBc/kw2+SUDtm9LxNHQ7O5nd6GG5mAN4umQ8hzN/o X-Received: by 2002:ac8:2398:: with SMTP id q24mr5000470qtq.342.1586534702546; Fri, 10 Apr 2020 09:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586534702; cv=none; d=google.com; s=arc-20160816; b=ePj4OnjsuBxInKpdCqxSwbnuj4pSq1jikQUG2/f+55FSMHPdNC0Uhr9u9h/4QHwlFX 4LqSKSrb5nTPX5Hye+jb/LBDddvaMa5vA7GUHUnVhkxwKP+w+NK0GHDOiMzYM6FfJQOQ YuCz/XXmW2DsYe1yw/V8PlM7KDvQdqBAEKC4eSwLNC6C0MfvbX5/irraqpbQfx7uMZgS 7nAWhRtKi68EESBbr6CoEnU5ADNqvT9MC0lwg13NCBD/dcXTQW4DPBTTB60SH7BeGkaC cdYbJ/OTJLiCV78jXjvJn0G6gpPXvcCGpFOVH6b4Q1IMDziRa4KgwDupXUYyV+HdBTEs 4yGQ== 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 :in-reply-to:references:mime-version:dkim-signature; bh=Kl+8vGM4I9kgnLlbcHftU4c6kdkU9Fh1KxH/fC8RnDg=; b=IXmwuTUUJXC6KLH1ibb3N4OPYRMcid+F61u5W2g0nswsVPAKr4MVeUdtFeCXCKa7zA dQGhmdF2BWpIXObtZZ3rzzhNFhYsCNf36UYZOlxTzdElPX9SRykbP9z7cCb8CoFSDa9z UGqy6Dzfub9yEp6UYDtSySvQPgWKL6u57n23ERd5H9LLQOJCIFvNfLL7QtJUQWrgEU4z 4kuTTV2TRRNLjqSjl9fnJNIUylka6z1aps7/s4b49n1WFHEpIx80o/3ddX0MpKbFcyf1 e6YDESWBx0uw7RDGnPkFcoJCG0q/O6P4DlwT8OadgRo+84SKiF1IY+fKGLC7CmUsiqcH zf2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mmOI4iyp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si981081qtb.386.2020.04.10.09.04.46; Fri, 10 Apr 2020 09:05:02 -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=mmOI4iyp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbgDJQDu (ORCPT + 99 others); Fri, 10 Apr 2020 12:03:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:45486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbgDJQDu (ORCPT ); Fri, 10 Apr 2020 12:03:50 -0400 Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (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 D5EAC20CC7; Fri, 10 Apr 2020 16:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586534629; bh=BdB60nUXn9u2TACtpWcd00QkWUVoCM7XwHfa5QxDaDA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mmOI4iypZSjrrhzKzzTiGYLWosQ+A4Gc6krVGIC3hfqWktkg1y0f1+Wrq9HRJBo4n MQut9uhi4AmU6jr8Md9jtplSmempAazKmG8Ll+TT/SykqrNHuupCKDmddFwPcxFOnE KFGuzOM8ZdcEVzUP9P1dGDONSWUQDmAKC+Xjonrg= Received: by mail-il1-f172.google.com with SMTP id i75so2194134ild.13; Fri, 10 Apr 2020 09:03:49 -0700 (PDT) X-Gm-Message-State: AGi0PubLLCxhKfFH8drQQamUEIpU5M7OOaGKFTE5+0USaHBkXaKMJSI8 AmmGjJ0SYTTFd5forIkD7fHQHyPLQhT1rrsS7xU= X-Received: by 2002:a92:443:: with SMTP id 64mr238786ile.258.1586534629266; Fri, 10 Apr 2020 09:03:49 -0700 (PDT) MIME-Version: 1.0 References: <20200409130434.6736-1-ardb@kernel.org> <20200409130434.6736-4-ardb@kernel.org> <20200409210847.GA1312580@rani.riverdale.lan> <20200410151612.GA970420@rani.riverdale.lan> In-Reply-To: <20200410151612.GA970420@rani.riverdale.lan> From: Ard Biesheuvel Date: Fri, 10 Apr 2020 18:03:38 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/9] efi/x86: Move efi stub globals from .bss to .data To: Arvind Sankar Cc: Brian Gerst , linux-efi , Ingo Molnar , Thomas Gleixner , Linux Kernel Mailing List , Arnd Bergmann , Borislav Petkov , Colin Ian King , Gary Lin , Jiri Slaby , Sergey Shatunov , Takashi Iwai 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 Fri, 10 Apr 2020 at 17:16, Arvind Sankar wrote: > > On Fri, Apr 10, 2020 at 10:20:42AM +0200, Ard Biesheuvel wrote: > > On Thu, 9 Apr 2020 at 23:08, Arvind Sankar wrote: > > > > > > On Thu, Apr 09, 2020 at 04:53:07PM -0400, Brian Gerst wrote: > > > > > Can we use the -fno-zero-initialized-in-bss compiler flag instead of > > > > > explicitly marking global variables? > > > > > > > > Scratch that. Apparently it only works when a variable is explicitly > > > > initialized to zero. > > > > > > > > -- > > > > Brian Gerst > > > > > > Right, there doesn't seem to be a compiler option to turn off the use of > > > .bss altogether. > > > > Yeah. I'll try to come up with a way to consolidate this a bit across > > architectures (which is a bit easier now that all of the EFI stub C > > code lives in the same place). It is probably easiest to use a section > > renaming trick similar to the one I added for ARM (as Arvind suggested > > as well, IIRC), and get rid of the per-symbol annotations altogether. > > Does that work for 32-bit ARM, or does it need to be .data to tell the > compiler to avoid generating GOT references? If that's fine, we don't > actually need to rename sections -- linker script magic is enough. For > eg, the below pulls the EFI stub bss into .data for x86 without the need > for the annotations. > > diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S > index 508cfa6828c5..e324819c95bc 100644 > --- a/arch/x86/boot/compressed/vmlinux.lds.S > +++ b/arch/x86/boot/compressed/vmlinux.lds.S > @@ -52,6 +52,7 @@ SECTIONS > _data = . ; > *(.data) > *(.data.*) > + drivers/firmware/efi/libstub/lib.a:(.bss .bss.*) > _edata = . ; > } > . = ALIGN(L1_CACHE_BYTES); No, we can add this to ARM as well, and get rid of the __efistub_global annotations entirely. We'll still need .data.efistub for the .data pieces, but that is a separate issue.