Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2298279ybg; Thu, 30 Jul 2020 16:15:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeRJgTvdt8fP710pAplmYKolmAxrnMXwvC3f8EeDAIUM8Axk4ap0yY/x0g/Mt50XHTb+4b X-Received: by 2002:a17:906:26c3:: with SMTP id u3mr1329133ejc.483.1596150933974; Thu, 30 Jul 2020 16:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596150933; cv=none; d=google.com; s=arc-20160816; b=ngiwMfjsq1fx3WRRv0Cj/mZl7W1rTztM0y6bQKtoWF+FaFgCAE6z5ktIzZN3cPD2zf AKH8ULbNwu6erymw8LwLMJGYvMwX/whvcdYkJvBmtxufuUrRItnLkUMWsO/4jn/nB2Kl dGZ3G7sKYCMtTgTcBKEhRzdE/3me6gS3/ApoY+OujBgg91BvIP5AVBUDCo3CuVx8694r 7gB0rKp+9d3I4k7rSAHwt5xegXGVGfgHAbpKQovCc/ZSWZZdujgZVWOBq2iT8gu8274M nqwPW3COHpGWiAgqkRkyc6vwvD9Wis4GzC+k8yW8/sIkEclnW9t9IFwFf/DtTAlc4BTx mfdQ== 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=6t51k6uSisSjBlEUy+Di3TVdJhxEYeHUBTv0q9IOTFI=; b=lY/98Knz7SLJSubuHLfUcKLlbDsQksWD9MBEe496QFO9kG2GUBWqBvHvLB2arY8U++ DR+yedSZ+xyrL1ZL0vTU1WfWnfBhAV9S1yEqsNYwFelPuzioWULKSJX1pS9FU423UvKw IqcYLnHmUFwaecElSAYDVN1yakIL2q9Peth9wpb9RFI5WUtoFSPPiuuZKNgAVSZO7Qrn JRTa5HRDhfrVSiHaKxKE+uVORqTk7mOeWpKo+g14RApq1YYLD+WhZdmKbAEML3Tma7Y1 iKylIEoKSmfj7zdNHdt0u16TtHeNRgiVm6iuC3AhNUFFE4IEDbGoIndEVE9DZkBUEhhO cSdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uqeC961W; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h27si4333362ejd.184.2020.07.30.16.15.08; Thu, 30 Jul 2020 16:15:33 -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=@google.com header.s=20161025 header.b=uqeC961W; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730694AbgG3XLa (ORCPT + 99 others); Thu, 30 Jul 2020 19:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728588AbgG3XL3 (ORCPT ); Thu, 30 Jul 2020 19:11:29 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F95AC061574 for ; Thu, 30 Jul 2020 16:11:29 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id r4so4980610pls.2 for ; Thu, 30 Jul 2020 16:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6t51k6uSisSjBlEUy+Di3TVdJhxEYeHUBTv0q9IOTFI=; b=uqeC961W2dYdHubhyaW7T4dKd9uxNBe1lhPt5U3EsINvDx4it+Cu3Iea6tTpnrwyS/ ZdRcekgTxtobE2OEf2fpfFai2VTWD3vPo1oi7g/8BagUpImM9lF8Y/5swNjtjWnsoSJK n1NNQdxWNyxc4cJz2CztbBCWCMrmDoMBc7g6dUUDdnaZX1rSaR6Jd7ACeLFsMd0Wf4Q7 yMQYxbUN1dlH1zoTKPwbUlBv+xI/+Ssp+dWB3tldxxNrCClcTxjT9lVnqI9T5wwYDf7B odvfVTDGxA1eG/X1/0+DlZWyH+8ypkOTD9uhp7/k57Pcq6h80BPp66sn/PcghWmj+9dT jQSA== 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:from:date :message-id:subject:to:cc; bh=6t51k6uSisSjBlEUy+Di3TVdJhxEYeHUBTv0q9IOTFI=; b=rFl2E0F1vztduvEJf4CSMjeZdqbyNKpviA81EdKPPFYAG/6s4VN+Gkb/nqES+NsVbd Y98rsUSa1iIPDXFj3i2qBIexuTCcVzLwNvO3wLA7R1Mfa/T5ezLjsWP2yIJRLt5UosZY jHxm7muXUlvW6euDyIYY9RKDve6aRk+oMeyWSTLXg69zLodvkO/A6bYa0y+BuY1w/Exa 3/tBOod4TzVkH52NNcI8Xp0ocwtG2KrcOJJ81SvbudOyeow6/EZ2ZNBp6vqf5NmQzKiX IDhTe21/omGavfInKuQzxPVRhXN/DqOVckEF5XuQyVCVMq37ExTVPlzLpCJKFijr5a0y zTlQ== X-Gm-Message-State: AOAM530xwfR9Qij+JNVRRwCkiKSg35c0GRvoQrrnRsAp7+5OEm5z+UYz 2hK5An85W7oRGfKsBRqNDfRMBvZsEqMR1TVKN377Mg== X-Received: by 2002:a17:90b:1103:: with SMTP id gi3mr1390615pjb.32.1596150688580; Thu, 30 Jul 2020 16:11:28 -0700 (PDT) MIME-Version: 1.0 References: <1596097609-14118-1-git-send-email-kernelfans@gmail.com> In-Reply-To: <1596097609-14118-1-git-send-email-kernelfans@gmail.com> From: Nick Desaulniers Date: Thu, 30 Jul 2020 16:11:17 -0700 Message-ID: Subject: Re: [PATCH] x86/purgatory: strip debug info To: Pingfan Liu Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Hans de Goede , Arvind Sankar , Steve Wahl , LKML 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 Thu, Jul 30, 2020 at 1:27 AM Pingfan Liu wrote: > > It is useless to keep debug info in purgatory. And discarding them saves > about 200K space. > > Original: > 259080 kexec-purgatory.o > Stripped: > 29152 kexec-purgatory.o > > Signed-off-by: Pingfan Liu > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: "H. Peter Anvin" > Cc: Hans de Goede > Cc: Nick Desaulniers > Cc: Arvind Sankar > Cc: Steve Wahl > Cc: linux-kernel@vger.kernel.org > To: x86@kernel.org I don't see any code in arch/x86/purgatory/ arch/x86/include/asm/purgatory.h include/linux/purgatory.h include/uapi/linux/kexec.h kernel/kexec* include/linux/kexec.h include/linux/crash_dump.h kernel/crash_dump.c arch/x86/kernel/crash* https://github.com/horms/kexec-tools/tree/master/kexec/arch/x86_64 that mentions any kind of debug info section. I'm not sure what you'd do with the debug info anyway for this binary. So I suspect this information should ok to discard. This works, but it might be faster to build to not generate the compile info in the first place via compile flag `-g0`, which could be added `ifdef CONFIG_DEBUG_INFO` or even just unconditionally. That way we're not doing additional work to generate debug info, then additional work to throw it away. > --- > arch/x86/purgatory/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile > index 088bd76..4340ae6 100644 > --- a/arch/x86/purgatory/Makefile > +++ b/arch/x86/purgatory/Makefile > @@ -16,7 +16,7 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS > > # When linking purgatory.ro with -r unresolved symbols are not checked, > # also link a purgatory.chk binary without -r to check for unresolved symbols. > -PURGATORY_LDFLAGS := -e purgatory_start -nostdlib -z nodefaultlib > +PURGATORY_LDFLAGS := -e purgatory_start -nostdlib -z nodefaultlib -S > LDFLAGS_purgatory.ro := -r $(PURGATORY_LDFLAGS) > LDFLAGS_purgatory.chk := $(PURGATORY_LDFLAGS) > targets += purgatory.ro purgatory.chk > -- > 2.7.5 > -- Thanks, ~Nick Desaulniers