Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2914783ybv; Mon, 24 Feb 2020 14:18:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzPft5mZxIn/haKKLKRM5df2GEw9lr9GJi7eCT+89hCZpHtXx6IaqwqAXRckHHKaVPucsDe X-Received: by 2002:a05:6808:209:: with SMTP id l9mr1044918oie.112.1582582721964; Mon, 24 Feb 2020 14:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582582721; cv=none; d=google.com; s=arc-20160816; b=KIGSOsP4SN+1PXfpPI2YM+NxtOON9vaHNJI3TSCiVFWMSjKprVxiYJbHdi/oS/zgTF ZKDDiZwjykPF6l0Kzjq/y/oYVo7Hc4yRYyG3qIE0psRhrp1tSr2VMCikLtcdS1T7d7De MDxU4z+UG+ykSOeEcYUyNMtRPXYgF+Hc+w9eZhd0hu8YWk5zfou63/Yg7g9eTFgM44E/ ZUHkQ5nkXmSQiI4JIbu/ffvMH0QYe0xFiVF9KhW5iRKxG7fNa+HtzJJcZnN0TyUWacuw GhoJpawtouZybBjM8G1+T16VCWOgpDEHRD1LpDfEq2ePp0RTqcW9LGbdA1IlZ0BEJsB9 +/UQ== 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=4+q1hPU+vBxz37Lq9CoAPE294r5aS1T2lyZxNwgE7xE=; b=qP+icDjrL4N5y/wkPKOWmSx7C8j3//iHA/5JpbnbjySwflUsuw2GlSIfst7g/lpm8g ViJdyVuBonpRsfWHDEvRFDM1iHJpnIC7aGwf3v2hz+qtSRUtG4eJtWdygPX8zXfrJMod xBEH3yPGFPw946lmB0ICjZeHedZfOQ8SJ69bfhYgcyzHIMnowls5Q80ltvzjvCEsVDo1 EFHNn6Qs6yvufaDK7VmbLoT6h5x6YriKSXfjqNwJKK/dI0tDHXvWG8nEhWrbbjxoGbaS JbBoXBXM5W4mZR6hBoKSeuwHAg9qn91+5YWXF0gM9dq4+wcfQX4BjEyVLov3H3ObKQk2 OeqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SSKlPPTC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t127si5857620oih.45.2020.02.24.14.18.29; Mon, 24 Feb 2020 14:18:41 -0800 (PST) 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=@google.com header.s=20161025 header.b=SSKlPPTC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbgBXWRI (ORCPT + 99 others); Mon, 24 Feb 2020 17:17:08 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37237 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbgBXWRH (ORCPT ); Mon, 24 Feb 2020 17:17:07 -0500 Received: by mail-pl1-f193.google.com with SMTP id q4so486681pls.4 for ; Mon, 24 Feb 2020 14:17:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=4+q1hPU+vBxz37Lq9CoAPE294r5aS1T2lyZxNwgE7xE=; b=SSKlPPTCLk+ZA4hJeCNpQagaJofineoLXz01RYCuKFEzavebiZvXMe7yqp4UxCm7hR ebFQty2zUoBZEgZ4uXFMEWn1kJgSkOcXVzXdJ9ptz5l8HG/Z7HkrE9VdJHyBvDQfd07Z mpYsHoTXbnCbxN125vQht/V1PsSvLr2lSxM6P5ADJi0xOVftEOzTdjWSIGRNFCc+PlPK XX9OI/HDJitZM4JRHLJHXLdfBZw7430jgt9H4CprGyScaBqx8OowhuLlEVuQRUPPLLFa 1W2V0AHXCniZb3GE1yCFYnS6gaP2y17y8w+nOPrt82XkCLyexiV37RlWT6YhqrD3NYJM 3KgQ== 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=4+q1hPU+vBxz37Lq9CoAPE294r5aS1T2lyZxNwgE7xE=; b=RQU1NsapcP/3O5lOauZnSLtwVbGUH6DnXTXrGUIdirdhcb9gfbaTB2/Luy2pgY7GZL 0DyGjm7A2UmD9VDIoolYV6yNSHTJT/kfw9f6NbmjYT3eB8VWwpyGAID6ArxvyLPhSXnn m0a076rF0wTiZYrdkqp9wve8Hx6vs6oXMBqXFRO5ulrGmRn84v6AMS5Mp6/iySqA32vg Bb/4U5TOw3kMsCBhXQ5agZIJuqPBhuie1vEyVhHkF40cXNf5G99CHygJFJiyUfpWZkHK OmOHyJpVeZBtIYrkJTRYmUvx+4092fRGqkRgVZvBzDVzDk6U7JWj7WQ+xdZgwa4C5fW8 iTLQ== X-Gm-Message-State: APjAAAWy1mNRmDn7GcuLDRCzKfNKWZFcv3UOV4E8KHlkFCTiSTkJpznh 6/xFGZ0eNkmG9ghsOpfbwVY05g== X-Received: by 2002:a17:90a:fe8:: with SMTP id 95mr1411740pjz.98.1582582626875; Mon, 24 Feb 2020 14:17:06 -0800 (PST) Received: from google.com ([2620:15c:2ce:0:9efe:9f1:9267:2b27]) by smtp.gmail.com with ESMTPSA id l2sm10574403pgp.0.2020.02.24.14.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 14:17:06 -0800 (PST) Date: Mon, 24 Feb 2020 14:17:03 -0800 From: Fangrui Song To: Arvind Sankar Cc: Nick Desaulniers , Michael Matz , Borislav Petkov , Nathan Chancellor , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , clang-built-linux , Kees Cook Subject: Re: [PATCH 2/2] x86/boot/compressed: Remove unnecessary sections from bzImage Message-ID: <20200224221703.eqql5hrx4ccngwa5@google.com> References: <20200222065521.GA11284@zn.tnic> <20200222070218.GA27571@ubuntu-m2-xlarge-x86> <20200222072144.asqaxlv364s6ezbv@google.com> <20200222074254.GB11284@zn.tnic> <20200222162225.GA3326744@rani.riverdale.lan> <20200224212828.xvxl3mklpvlrdtiw@google.com> <20200224214845.GC409112@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200224214845.GC409112@rani.riverdale.lan> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-02-24, Arvind Sankar wrote: >On Mon, Feb 24, 2020 at 01:28:28PM -0800, Fangrui Song wrote: >> Hi Michael, please see my other reply on this thread: https://lkml.org/lkml/2020/2/24/47 >> >> Synthesized sections can be matched as well. For example, SECTIONS { .pltfoo : { *(.plt) }} can rename the output section .plt to .pltfoo >> It seems that in GNU ld, the synthesized section is associated with the >> original object file, so it can be written as: >> >> SECTIONS { .pltfoo : { a.o(.plt) }} >> >> In lld, you need a wildcard to match the synthesized section *(.plt) >> >> .rela.dyn is another example. >> > >With the BFD toolchain, file matching doesn't actually seem to work at >least for .rela.dyn. I've tried playing around with it in the past and >if you try to use file-matching to capture relocations from a particular >input file, it just doesn't work sensibly. I think most things are working in GNU ld... /* a.x */ SECTIONS { .rela.pltfoo : { a.o(.rela.plt) } /* *(.rela.plt) with lld */ .rela.dynfoo : { a.o(.rela.data) } /* *(.rela.dyn) with lld */ } % cat < a.s .globl foo foo: call bar .data .quad quz e % as a.s -o a.o % ld.bfd -T a.x a.o -shared -o a.so