From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87214 invoked by alias); 26 Oct 2018 21:51:02 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 87189 invoked by uid 89); 26 Oct 2018 21:51:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.1 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=distributions, Hx-languages-length:1766, H*F:U*mark X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Oct 2018 21:51:00 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 9F39E315EC15 for ; Fri, 26 Oct 2018 23:50:57 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 48FFA46765F7; Fri, 26 Oct 2018 23:50:57 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Subject: Add eu-strip --reloc-debug-sections-only option Date: Fri, 26 Oct 2018 21:51:00 -0000 Message-Id: <1540590644-22290-1-git-send-email-mark@klomp.org> X-Mailer: git-send-email 1.8.3.1 X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2018-q4/txt/msg00081.txt.bz2 Hi, eu-strip already supports --reloc-debug-sections to resolve all relocations between .debug_ sections while creating a separate .debug file with -f. It is sometimes useful to do the same without doing any other stripping. --reloc-debug-sections-only Similar to --reloc-debug-sections, but resolve all trivial relocations between debug sections in place. No other stripping is performed (operation is not reversable, incompatible with -f, -g, --remove-comment and --remove-section) For example to ease debugging, tracing and profiling some distributions ship an uncompressed vmlinux ELF file which includes DWARF debuginfo. Since the vmlinux ELF kernel is relocatable, the relocations between the .debug sections are also still left in. On Fedora this file is 662M. eu-strip --reloc-debug-sections-only will remove more than 250MB of (unneeded) relocations between the .debug sections. To reuse as much code as possible this patch series first refactors some of the code. It also makes it so that the type of ELF file doesn't matter for doing relocations (normally it only makes sense for ET_REL files, but the vmlinux ELF image is an ET_EXEC with SHT_RELA sections). It also adds a new testcase to run-strip-reloc.sh to make sure that the result of creating a separate debug file using --reloc-debug-sections is identical to creating a separate debug file and then running eu-strip with --reloc-debug-sections-only. [PATCH 1/4] strip: Always copy over any phdrs if there are any [PATCH 2/4] strip: Split out debug section relocation into separate helper [PATCH 3/4] strip: Extract code to update shdrstrndx into new common function [PATCH 4/4] strip: Add --reloc-debug-sections-only option Cheers, Mark