Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp304701ybh; Wed, 15 Jul 2020 02:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBWd00vFGWhW8csEZg8tM3a6ClnREb8Y5a9ZMRfm5hJb5o8aT3+7p5/GdFpplgWd9cPrFx X-Received: by 2002:a17:906:6dd7:: with SMTP id j23mr8135911ejt.529.1594804981220; Wed, 15 Jul 2020 02:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594804981; cv=none; d=google.com; s=arc-20160816; b=RHyozyv6ouHrLQSJlpWIZfqLL0frq4pGS/z9WsIk6zNrHCJuhH0SX+EKtW43GdJLXR 5UjtZ/qTNBnhCw05Xwz0s+wWJjXQxeJI6pcLeKBFTUwXIG1hdnHqRjDJHE3bE1NJtpec BLG5fatFDMHcD6MA1XLyJIzgAk6wGWcvYigqPxCAvfwvZfqNOy+OcqiNJqQ3JBILK/2Y otsXUZgMto8oIpsdbERdSf4f7Ba6YrYzXf3qbxQTgob1vNqIzFr9vyxJz5JzD2Hc5uO1 LFIp3Uxs+/OY3OcCPSaEHAl5BeqnXG6Tty2v4qhrzHT4kmW0yviy9YzannJr7TmZ0VDk 2vnQ== 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=RsnVN0E19i3bHghc9pYkTMlrihhqaH+/1a+LCxqn6J8=; b=JprJ9Da395bsP9DN+ypnaJXZW44qBMiGsy5UMuhHmPuo44Bcgjr6ThxJJ680EybhAP Rc645mRvzwea80o82Sij5DfgSwxc21J2welaM2bjgI4seM6bvAfoI3Z32avysNs6ebL2 HVWOZ8J873c0cXtEvvqFX1du6MOQ1m9zcwC1D/zlM1HOFchE/0SFCniYV5yjyN6FDFJo Y/Pjq4yDtLkO4Tusm+eb5lFu/rxdpy0+EQdhAOvTve+AY+nKz909UKiC/uuLztjqWucG YnwuEvwVQV7Y5aFI5r+3HCLyA3He9/gxSsDE1SrmXQulogJeR64EfrZ+DLBKXk0OL7TD HLXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UwzvjHZg; 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 lu24si804164ejb.477.2020.07.15.02.22.37; Wed, 15 Jul 2020 02:23:01 -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=UwzvjHZg; 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 S1728368AbgGOIzo (ORCPT + 99 others); Wed, 15 Jul 2020 04:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727930AbgGOIzo (ORCPT ); Wed, 15 Jul 2020 04:55:44 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04939C061755 for ; Wed, 15 Jul 2020 01:55:44 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id p205so1413876iod.8 for ; Wed, 15 Jul 2020 01:55:43 -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=RsnVN0E19i3bHghc9pYkTMlrihhqaH+/1a+LCxqn6J8=; b=UwzvjHZgjR8vfGdEBbjZtNDn4fj5o2UBdEqSv9SDkqZVJAYZwQTyal1lb/jgTGun3C 0jOcPVcRNyxYa1tC9ocDhc5wcOURTNYhB3OzBMoMppOCdKYRqEjg0z03ORA4VCgx/DvP fgrRO3Zo4x6PoSi57C0iAC1bc6Z/ejCtIj+//w/pPCG20j3SePm93TMWAmueRSWMfg9a AXzWmhHIlzNAdTUxCDYiMTF3jOPstnab1TfTAuQh0hvvJ/87BMEB+7A49c41wZ//maP2 U1WSe1FBxjstKxebO+ms8ZLwbDT/JNVp70lksO9Ke8R7e0Zl5jq6dapCglSJtHetjSKE FP2g== 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=RsnVN0E19i3bHghc9pYkTMlrihhqaH+/1a+LCxqn6J8=; b=aY5dC1Pc8050a/3dkbu2ZM2CsSqSEpj0SONMI8Q8SOGEm/w00Kbmikmrqbex6MtKN4 AGDKorEyLqL+sKWPSGV+ycN/KpdXAtlLMCcuiqxEvbrCd9Gv7mA/llxTSqT9RmBgeOze NpDh0pXHNwoyakgIz2q5UWxaV304q2de/0YXDQvGehwRAXstX6niwfRsc8dzcsVO981J PB7KeFxFgGyrLkHzKsnYlsFoiWfYk/NP8AtZu1ZlTO35qqmKGegH0Y6oC8gyopfVm2ys VI42qTuEvWmQpDvFzV2mjTv/36fdnr2qNkuGBqbdkJz3Xr+RqsNM5yNIeq/HelPlNPe9 aQSQ== X-Gm-Message-State: AOAM533qKJtZLACUepW4Gh4mvQjbJv3HGOivCkvarXHKOYtr2HpjUI+h 1WnjK1gMBgNDzRDM+gHV9IFexNQb06oNDPaViiw= X-Received: by 2002:a5e:9309:: with SMTP id k9mr8925467iom.135.1594803343386; Wed, 15 Jul 2020 01:55:43 -0700 (PDT) MIME-Version: 1.0 References: <20200714023836.2310569-1-nivedita@alum.mit.edu> <20200715004133.1430068-5-nivedita@alum.mit.edu> In-Reply-To: <20200715004133.1430068-5-nivedita@alum.mit.edu> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Wed, 15 Jul 2020 10:55:32 +0200 Message-ID: Subject: Re: [PATCH v5 4/7] x86/boot: Add .text.* to setup.ld 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 Wed, Jul 15, 2020 at 2:41 AM Arvind Sankar wrote: > > gcc puts the main function into .text.startup when compiled with -Os (or > -O2). This results in arch/x86/boot/main.c having a .text.startup > section which is currently not included explicitly in the linker script > setup.ld in the same directory. > > The BFD linker places this orphan section immediately after .text, so > this still works. However, LLD git, since [1], is choosing to place it > immediately after the .bstext section instead (this is the first code > section). This plays havoc with the section layout that setup.elf > requires to create the setup header, for eg on 64-bit: > > LD arch/x86/boot/setup.elf > ld.lld: error: section .text.startup file range overlaps with .header > >>> .text.startup range is [0x200040, 0x2001FE] > >>> .header range is [0x2001EF, 0x20026B] > > ld.lld: error: section .header file range overlaps with .bsdata > >>> .header range is [0x2001EF, 0x20026B] > >>> .bsdata range is [0x2001FF, 0x200398] > > ld.lld: error: section .bsdata file range overlaps with .entrytext > >>> .bsdata range is [0x2001FF, 0x200398] > >>> .entrytext range is [0x20026C, 0x2002D3] > > ld.lld: error: section .text.startup virtual address range overlaps > with .header > >>> .text.startup range is [0x40, 0x1FE] > >>> .header range is [0x1EF, 0x26B] > > ld.lld: error: section .header virtual address range overlaps with > .bsdata > >>> .header range is [0x1EF, 0x26B] > >>> .bsdata range is [0x1FF, 0x398] > > ld.lld: error: section .bsdata virtual address range overlaps with > .entrytext > >>> .bsdata range is [0x1FF, 0x398] > >>> .entrytext range is [0x26C, 0x2D3] > > ld.lld: error: section .text.startup load address range overlaps with > .header > >>> .text.startup range is [0x40, 0x1FE] > >>> .header range is [0x1EF, 0x26B] > > ld.lld: error: section .header load address range overlaps with > .bsdata > >>> .header range is [0x1EF, 0x26B] > >>> .bsdata range is [0x1FF, 0x398] > > ld.lld: error: section .bsdata load address range overlaps with > .entrytext > >>> .bsdata range is [0x1FF, 0x398] > >>> .entrytext range is [0x26C, 0x2D3] > > Add .text.* to the .text output section to fix this, and also prevent > any future surprises if the compiler decides to create other such > sections. > > [1] https://reviews.llvm.org/D75225 > > Reviewed-by: Kees Cook > Reviewed-by: Ard Biesheuvel > Reviewed-by: Fangrui Song > Signed-off-by: Arvind Sankar Tested-by: Sedat Dilek - Sedat - > --- > arch/x86/boot/setup.ld | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld > index 24c95522f231..49546c247ae2 100644 > --- a/arch/x86/boot/setup.ld > +++ b/arch/x86/boot/setup.ld > @@ -20,7 +20,7 @@ SECTIONS > .initdata : { *(.initdata) } > __end_init = .; > > - .text : { *(.text) } > + .text : { *(.text .text.*) } > .text32 : { *(.text32) } > > . = ALIGN(16); > -- > 2.26.2 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200715004133.1430068-5-nivedita%40alum.mit.edu.