This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Add eu-strip --reloc-debug-sections-only option


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]