eu-strip --reloc-debug-sections-only on linux .debug objects

Mark Wielaard mark@klomp.org
Tue Dec 8 14:21:12 GMT 2020


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


More information about the Elfutils-devel mailing list