On Fri, Jul 31, 2020 at 7:11 AM Nick Desaulniers <ndesaulni...@google.com> wrote: > > On Thu, Jul 30, 2020 at 1:27 AM Pingfan Liu <kernelf...@gmail.com> 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 <kernelf...@gmail.com> > > Cc: Thomas Gleixner <t...@linutronix.de> > > Cc: Ingo Molnar <mi...@redhat.com> > > Cc: Borislav Petkov <b...@alien8.de> > > Cc: "H. Peter Anvin" <h...@zytor.com> > > Cc: Hans de Goede <hdego...@redhat.com> > > Cc: Nick Desaulniers <ndesaulni...@google.com> > > Cc: Arvind Sankar <nived...@alum.mit.edu> > > Cc: Steve Wahl <steve.w...@hpe.com> > > Cc: linux-kernel@vger.kernel.org > > To: x...@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. What about: diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 088bd76..7e1ad9e 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -32,7 +32,7 @@ KCOV_INSTRUMENT := n # make up the standalone purgatory.ro
PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel -PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss +PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss -g0 PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING PURGATORY_CFLAGS += $(call cc-option,-fno-stack-protector) Thanks, Pingfan