From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id 7C4C03857003 for ; Tue, 8 Dec 2020 23:22:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7C4C03857003 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vt@altlinux.org Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id E2E7072C8B5; Wed, 9 Dec 2020 02:22:33 +0300 (MSK) Received: from altlinux.org (sole.flsd.net [185.75.180.6]) by imap.altlinux.org (Postfix) with ESMTPSA id AA5514A4709; Wed, 9 Dec 2020 02:22:33 +0300 (MSK) Date: Wed, 9 Dec 2020 02:22:33 +0300 From: Vitaly Chikunov To: Mark Wielaard Cc: elfutils-devel@sourceware.org Subject: Re: eu-strip --reloc-debug-sections-only on linux .debug objects Message-ID: <20201208232233.i6go7jxdb3aj7pkx@altlinux.org> References: <20201207155903.mnqlqqomlpj3sqme@altlinux.org> <2f554a3da80b1d8afe6cafbaba6f04f2f133e558.camel@klomp.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <2f554a3da80b1d8afe6cafbaba6f04f2f133e558.camel@klomp.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2020 23:22:36 -0000 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