From patchwork Thu Jun 9 15:52:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12875768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C8C0C43334 for ; Thu, 9 Jun 2022 15:53:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.345610.571280 (Exim 4.92) (envelope-from ) id 1nzKSq-0000xy-4j; Thu, 09 Jun 2022 15:52:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 345610.571280; Thu, 09 Jun 2022 15:52:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzKSq-0000xr-26; Thu, 09 Jun 2022 15:52:52 +0000 Received: by outflank-mailman (input) for mailman id 345610; Thu, 09 Jun 2022 15:52:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nzKSo-0000xE-Kq for xen-devel@lists.xenproject.org; Thu, 09 Jun 2022 15:52:50 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on062d.outbound.protection.outlook.com [2a01:111:f400:fe06::62d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3690995b-e80c-11ec-8b38-e96605d6a9a5; Thu, 09 Jun 2022 17:52:49 +0200 (CEST) Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AS8PR04MB8545.eurprd04.prod.outlook.com (2603:10a6:20b:420::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.13; Thu, 9 Jun 2022 15:52:47 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b%7]) with mapi id 15.20.5332.013; Thu, 9 Jun 2022 15:52:47 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3690995b-e80c-11ec-8b38-e96605d6a9a5 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jzpsjknwbU40iC/+l8GagzCTs0OXrg/jVbCkp2LMq6fM5NJ/mhcKheii8WBweNuRh3ccr6qfsf3M1LR5CEP99x95Wriy/PsStWqo5vEH7imrMeiSKz+sWIQEfbky49BFoA6gFYXcJ++e4gvQ5+Ct2SF1lJ8Gr6OyeS7O6Ra9T7R2m0StS3on9+gNkcdY0Rqlrd23HOVV895IpOczYke1MY392bFi7FCxGp+CYTwTEjJXORNXfwIkA0LO9E87xnew0Rwx2yC1QTPSvYDFzRj2fGGkgSfyL4p9iG5gEpxKrBTSWMt3VmJY0Pjkq5bVmvmk3LWfoAjhGfNJfU3SLSHIrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W0KfPugo3KQU69jKeUIwn3lcDuM0nZSDmJTaW1CYFB4=; b=iRKpcjbG2JA2IXIdgXHnHb5m/nKCaNfKSxdRALS4FfPO2QyRhVQmqWiF/MPOTbFQQsTNHSydCsB8hUs+xLDWk7w2l9DaKQHZ6C5iC73r/CK40r3xm7T806Gk4dG/9CoF9Ohe75Bbs/88fmV5HJTDRUKOAumCTpreRTjqI3T9Pvpi4r/C7cGz4QjMkwHQ4OEwN9Bp6RJrW/YzEcuzy9tfrKUiTTl8mg82KFJBX+hqYvziUjKbG6vmAZyoUBsiHS63Wsi0Z4rPdb68D4ykGHK0RlSXpo3MBwCwu0fJx3ANnQoZHdKwwYr6e+75Y+bfRCODO9P6TfWc8h7sB+VeRpDtwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W0KfPugo3KQU69jKeUIwn3lcDuM0nZSDmJTaW1CYFB4=; b=z/5J8jlgVTLTrwN31eyScP09K+y5f/Ls56zYnlLYTGVpH4l4DupMCCbt5njMdDQDbwHt1AGPSt08H59ZYnbxG33bHaC6fFDvMMDFjyavTtFnnps1w+D6OZ1MCNlYs5Npq5In1t8fTWyOH4886/UOddFQDLnerRSTrbXafle+u91vwfw63cU9+SomY1RhefP32pGIlBeazz2gA73+z0XtLTafvKOA2yUYZu38b3b6NCFhUmWXTBUQK/CHfVDcf3oQ0gZovSc765BKxosPFS8Eczi8yT6fYLb9N8kIkYV80Am4c8IxVJtAruTpSFBnjq418EFvBL7gygcgViG1GxJyIg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: <79ebbde2-4be8-d393-476d-25326a2aa327@suse.com> Date: Thu, 9 Jun 2022 17:52:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 From: Jan Beulich Subject: [PATCH] EFI: strip xen.efi when putting it on the EFI partition To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu Content-Language: en-US X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a5cad77-d870-43cd-d60f-08da4a301985 X-MS-TrafficTypeDiagnostic: AS8PR04MB8545:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /pn6PVK6v8f0202XpUKlM7IKVvYaaQZaSX2TAj+r6T9JfFDTp/02fgCCZMnIsAsZHJe5kP9lGzOamkhxuk3ffFTjYrhMLmvRML8nVDhoMfs/5rRqgL8UtK4UKhZQOAseh6eSlIbdeeDYHTQ2F9rGQeATXzr6ze+JYuXBtWM8fTywHutH6vhVgIaxhSN5xKABkm5dVm1ucNhLFsikRoJTpLJBnt9BVrkcXSF4SPg5nRmeISXbcEX1rEeCLjCTnPy7dr1qElGA9fS0P/iTyp3umhyJA7+1pEd0cAhIE84o0m6ctoOQEatWPtwX3lPsW4ISJbFU36IQgtqrXIYqrTorRhwXPK/0uaNUCRlpj2kr9GY1b652Ts9SDfkpYrVQrw8nTUXTJZaziGyBdKW8wwkb2Oz+vKFN096czlASddKsEI3tg991O9mhDOv3jAQzwHw8003os8SPXOgegweegajWQU2aHyJJmLEnBUPR9H4NgrDW8w0kTIwbn/0a+MIEXNnuvfeq6Uy8EMQ9Y1Rd8wh9hhKcqcCLiSF/COleYhpR8yVYb4TTpCVpZ/xt8E1QAuLkOjjo5cEnnmTEOMLvT81ENdiBtJYsBjUGU9j3s2/5v+a9UnQIKNWhsLA+CDe96N+FPyccRS+w/9zYpTkop2j2ANZYkSRr7c+fzOxyDWd6gs3FBoH4rEyhGp76TG8rKBjBel2zcsOe0MHz+xTPiO2xA/7cPHBVHGNL+J+4D31rL5lqv4wMqy9w+jWBbj83RhAP X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6560.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(54906003)(6916009)(66556008)(4326008)(8676002)(31686004)(66476007)(316002)(2906002)(66946007)(5660300002)(6506007)(6486002)(31696002)(26005)(6512007)(36756003)(2616005)(38100700002)(186003)(8936002)(86362001)(83380400001)(508600001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?MyAkmAd9VAkhzesThXh8WJwoUJXy?= =?utf-8?q?8yjjr8/gpwoz1KcxbjVx6GmZ+icnqU8ORsS8Vvg6KEy5XeEE3kMNCa09vt/3pZnqB?= =?utf-8?q?bN41GCfy39ALocNtYBPO1G9cEYlMEkwk1MgYhjQmJKT7WoYK92KseMml2Tc1ZAYIf?= =?utf-8?q?SHbJ/f+IsgkPkDp4P5lR4Ig7SsQSaFXuCLUQ1FeP94L2uXOmIVIsN8mRY4mkxvXOW?= =?utf-8?q?brMVY2W98LPb/GHzxrC3oxreU97Z2f5nhaQm3qgFuz7gdPFVNpDVFF0/2YJPTnLuZ?= =?utf-8?q?0fuF3EJebdof945Bxp3HmmPIjrAmrrgdbK07S96qey7lVFasn/as6ZNwzuCpEN409?= =?utf-8?q?Q1owJAxO85N/EIbu33R2qqtBpQOo+e8nNuMR7rvvYs+p24SgCfDf6nn/EtAPrz3rw?= =?utf-8?q?2nhTMUXL67T+Ca/HDUVx6Hg8Z5uQoWfGDvP2hG8Qrf/3xY8AG41sQTcbk5R3cyERI?= =?utf-8?q?JzsHxtyp8CUm6/d/bwbHtXb8lCpk61GhaAENM9TrLX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xo7NyqyWqKKEo9mfj?= =?utf-8?q?Da9A2PGMbimhQUFxq4nsPaWZ+MHFA2sIqmwQbOhPy0PSXAGnAKiVVDljgGo4jfQOv?= =?utf-8?q?dDFHml3yR+z+fvjVpkm+113eUicoRXOuUcXpSKgQgrGQtTohao90X+Vnk1mDKj5oB?= =?utf-8?q?Z/PnpKlMtOcusmG8/lYkI5RQyQ3Exwi7yQz4F2h4vQ+0pD1gE5NOD5p6W11S818J8?= =?utf-8?q?qyKP48t0YaQX47MV+nCSs6dB/RbVYvSMYgx3j4UQgCP/8R69+vKqwzpDqLsfSbVHv?= =?utf-8?q?zg/RjqBST9Jot4wjMlBU5s2sZmVfRaww=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a5cad77-d870-43cd-d60f-08da4a301985 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 15:52:47.4683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ee477lgsmE3EHTMqg5K2/ymklB01xSawyFrRvYQLLkd5RVKzy5O5AdjwDQ3IVL2Y7sid6UfPNexQoX2xeHUSAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8545 With debug info retained, xen.efi can be quite large. Unlike for xen.gz there's no intermediate step (mkelf32 there) involved which would strip debug info kind of as a side effect. While the installing of xen.efi on the EFI partition is an optional step (intended to be a courtesy to the developer), adjust it also for the purpose of documenting what distros would be expected to do during boot loader configuration (which is what would normally put xen.efi into the EFI partition). Model the control over stripping after Linux'es module installation, except that the stripped executable is constructed in the build area instead of in the destination location. This is to conserve on space used there - EFI partitions tend to be only a few hundred Mb in size. Signed-off-by: Jan Beulich Tested-by: Henry Wang Tested-by: Wei Chen # arm --- GNU strip 2.38 appears to have issues when acting on a PE binary: - file name symbols are also stripped; while there is a separate --keep-file-symbols option (which I would have thought to be on by default anyway), its use so far makes no difference, - the string table grows in size, when one would expect it to retain its size (or shrink), - linker version is changed in and timestamp zapped from the header. Older GNU strip (observed with 2.35.1) doesn't work at all ("Data Directory size (1c) exceeds space left in section (8)"). Future GNU strip is going to honor --keep-file-symbols (and will also have the other issues fixed). Question is whether we should use that option (for the symbol table as a whole to make sense), or whether instead we should (by default) strip the symbol table as well. --- a/xen/Makefile +++ b/xen/Makefile @@ -465,6 +465,22 @@ endif .PHONY: _build _build: $(TARGET)$(CONFIG_XEN_INSTALL_SUFFIX) +# Strip +# +# INSTALL_EFI_STRIP, if defined, will cause xen.efi to be stripped before it +# is installed. If INSTALL_EFI_STRIP is '1', then the default option +# --strip-debug will be used. Otherwise, INSTALL_EFI_STRIP value will be used +# as the option(s) to the strip command. +ifdef INSTALL_EFI_STRIP + +ifeq ($(INSTALL_EFI_STRIP),1) +efi-strip-opt := --strip-debug +else +efi-strip-opt := $(INSTALL_EFI_STRIP) +endif + +endif + .PHONY: _install _install: D=$(DESTDIR) _install: T=$(notdir $(TARGET)) @@ -489,6 +505,9 @@ _install: $(TARGET)$(CONFIG_XEN_INSTALL_ ln -sf $(T)-$(XEN_FULLVERSION).efi $(D)$(EFI_DIR)/$(T)-$(XEN_VERSION).efi; \ ln -sf $(T)-$(XEN_FULLVERSION).efi $(D)$(EFI_DIR)/$(T).efi; \ if [ -n '$(EFI_MOUNTPOINT)' -a -n '$(EFI_VENDOR)' ]; then \ + $(if $(efi-strip-opt), \ + $(STRIP) $(efi-strip-opt) -p -o $(TARGET).efi.stripped $(TARGET).efi && \ + $(INSTALL_DATA) $(TARGET).efi.stripped $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi ||) \ $(INSTALL_DATA) $(TARGET).efi $(D)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(T)-$(XEN_FULLVERSION).efi; \ elif [ "$(D)" = "$(patsubst $(shell cd $(XEN_ROOT) && pwd)/%,%,$(D))" ]; then \ echo 'EFI installation only partially done (EFI_VENDOR not set)' >&2; \