* eu-strip --reloc-debug-sections-only on linux .debug objects @ 2020-12-07 15:59 Vitaly Chikunov 2020-12-08 14:21 ` Mark Wielaard 0 siblings, 1 reply; 3+ messages in thread From: Vitaly Chikunov @ 2020-12-07 15:59 UTC (permalink / raw) To: elfutils-devel Hi, Is it safe to run `eu-strip --reloc-debug-sections-only` on Linux kernel .debug files, such as vmlinux.debug and .ko.debug modules? It's really reduces size significantly. Description for .ko in PR#24344 looks good (that it strips linking information that does not needed for the kernel, but effect for vmlinux.debug in unstated), but, I want to be extra sure it's safe to add to our (ALT Linux) packaging system for -debuginfo rpms. Thanks, ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: eu-strip --reloc-debug-sections-only on linux .debug objects 2020-12-07 15:59 eu-strip --reloc-debug-sections-only on linux .debug objects Vitaly Chikunov @ 2020-12-08 14:21 ` Mark Wielaard 2020-12-08 23:22 ` Vitaly Chikunov 0 siblings, 1 reply; 3+ messages in thread From: Mark Wielaard @ 2020-12-08 14:21 UTC (permalink / raw) To: Vitaly Chikunov, elfutils-devel Hi Vitaly, On Mon, 2020-12-07 at 18:59 +0300, Vitaly Chikunov wrote: > Is it safe to run `eu-strip --reloc-debug-sections-only` on Linux > kernel > .debug files, such as vmlinux.debug and .ko.debug modules? Yes, it was designed to be used on linux .ko.debug modules. vmlinux.debug itself is a special case though. It does contain relocation between debug sections, but those are not supposed to be applied and eu-strip --reloc-debug-sections will normally ignore them because vmlinux is ET_EXEC. See also this recent discussion: https://gcc.gnu.org/pipermail/gcc/2020-December/234392.html > It's really reduces size significantly. Description for .ko in > PR#24344 looks good (that it strips linking information that does not > needed for the kernel, but effect for vmlinux.debug in unstated), vmlinux itself needs to be handled slightly differently, see the thread above. But I don't fully understand the effect of --emit-relocs -- discard-none ld options that the x86_64 kernel uses (it might be different for other arches). > but, I > want to be extra sure it's safe to add to our (ALT Linux) packaging > system for -debuginfo rpms. Upstream rpm comes with find-debuginfo.sh which takes an -r option. The -r flag says to use eu-strip --reloc-debug-sections. Which the fedora kernel.spec uses. Cheers, Mark ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: eu-strip --reloc-debug-sections-only on linux .debug objects 2020-12-08 14:21 ` Mark Wielaard @ 2020-12-08 23:22 ` Vitaly Chikunov 0 siblings, 0 replies; 3+ messages in thread From: Vitaly Chikunov @ 2020-12-08 23:22 UTC (permalink / raw) To: Mark Wielaard; +Cc: elfutils-devel Mark, On Tue, Dec 08, 2020 at 03:21:12PM +0100, Mark Wielaard wrote: > Hi Vitaly, > > On Mon, 2020-12-07 at 18:59 +0300, Vitaly Chikunov wrote: > > Is it safe to run `eu-strip --reloc-debug-sections-only` on Linux > > kernel > > .debug files, such as vmlinux.debug and .ko.debug modules? > > Yes, it was designed to be used on linux .ko.debug modules. Thanks! > vmlinux.debug itself is a special case though. It does contain > relocation between debug sections, but those are not supposed to be > applied and eu-strip --reloc-debug-sections will normally ignore them > because vmlinux is ET_EXEC. See also this recent discussion: > https://gcc.gnu.org/pipermail/gcc/2020-December/234392.html Yes, if kernel is compiled without CONFIG_X86_NEED_RELOCS `eu-strip --reloc-debug-sections-only` does noting to vmlinux.debug, but if it's compiled with `CONFIG_X86_NEED_RELOCS=y` then `eu-strip --reloc-debug-sections-only` actually reduces vmlinux.debug size (almost twice in my experiments). So, I wonder if we don't touch vmlinux binary would eu-strip --reloc-debug-sections for vmlinux.debug break something somehow in subtle way or it's safe. > > It's really reduces size significantly. Description for .ko in > > PR#24344 looks good (that it strips linking information that does not > > needed for the kernel, but effect for vmlinux.debug in unstated), > > vmlinux itself needs to be handled slightly differently, see the thread > above. But I don't fully understand the effect of --emit-relocs -- > discard-none ld options that the x86_64 kernel uses (it might be > different for other arches). `--emit-relocs --discard-none` pair is only used for x86_64 when CONFIG_X86_NEED_RELOCS is enabled, which is used for KASLR or kdump kernels (AFAIK). So, question is what will happen if we don't touch vmlinux, but strip trivial relocs for vmlinux.debug. Or better just not strip like this (yet). > > but, I > > want to be extra sure it's safe to add to our (ALT Linux) packaging > > system for -debuginfo rpms. > > Upstream rpm comes with find-debuginfo.sh which takes an -r option. > The -r flag says to use eu-strip --reloc-debug-sections. Which the > fedora kernel.spec uses. I will implement this then. Thanks, > > Cheers, > > Mark ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-08 23:22 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-12-07 15:59 eu-strip --reloc-debug-sections-only on linux .debug objects Vitaly Chikunov 2020-12-08 14:21 ` Mark Wielaard 2020-12-08 23:22 ` Vitaly Chikunov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).