dwz(1)
๐ dwz(1) โ the DWARF optimization and duplicate removal tool ๐
okay bestie, so you know that manual page thing? this is the dwz one, from the General Commands Manual, and honestly? it's giving main character energy. let's get into it ๐ซถ
โจ NAME โจ
dwz โ DWARF optimization and duplicate removal tool. that's it, that's the whole vibe ๐ธ
โจ SYNOPSIS โจ
dwz [OPTION...] [FILES]
โจ DESCRIPTION โจ
so dwz is a program that attempts to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. how? two ways, bestie:
- it replaces DWARF information representation with an equivalent smaller representation where possible
- and it reduces the amount of duplication using techniques from DWARF standard appendix E โ creating
DW_TAG_partial_unitcompilation units (CUs) for duplicated information, and usingDW_TAG_imported_unitto import it into each CU that needs it.
literally iconic.
the tool handles DWARF 32-bit format debugging sections of versions 2, 3, 4, most of version 5, and GNU extensions on top of those. it is strongly recommended to use at least DWARF 3, but using DWARF 4 or higher will work much better. so like... do that ๐
while most of DWARF 5 is supported, dwz doesn't yet generate spec compliant DWARF Supplementary Object Files (DWARF 5, section 7.3.6) unless the --dwarf-5 option is used. instead of a .debug_sup section it will generate by default a .gnu_debugaltlink section. and it will use the DW_FORM_GNU_strp_alt and DW_FORM_GNU_reg_alt, instead of DW_FORM_strp_sup and DW_FORM_ref_sup, to keep compatibility with existing DWARF consumers.
DWARF 4 .debug_types are supported, but DWARF 5 DW_UT_type units are not. likewise .gdb_index is supported, but the DWARF 5 .debug_names is not. also some forms and sections that are only emitted by GCC when generating Split DWARF โ DW_FORM_strx and .debug_str_offsets, DW_FORM_addrx and .debug_addr, DW_FORM_rnglistx and DW_FORM_loclistsx โ are not supported yet. sad but true ๐ญ
compressed debug sections are supported on input: both the gABI SHF_COMPRESSED scheme (with ELFCOMPRESS_ZLIB or ELFCOMPRESS_ZSTD) and the legacy GNU .zdebug_* scheme. each section is re-emitted in the same scheme it was read in; uncompressed inputs stay uncompressed. in multifile mode the shared object created by -m is always written uncompressed. noted ๐
okay and now the two main modes of operation:
- without the
-moption, it attempts to optimize DWARF debugging information in each given object (executable or shared library) individually - with the
-moption, it afterwards attempts to optimize even more by moving DWARF debugging information entries (DIEs), strings and macro descriptions duplicated in more than one object into a newly created ELFET_RELobject whose filename is given as the-moption argument. the debug sections in the executables and shared libraries specified on the command line are then modified again, referring to the entities in the newly created object.
periodt. ๐
โจ OPTIONS โจ
-m FILE,--multifile FILEโ multifile mode ๐ฆ after processing all named executables and shared libraries, attempt to create ELF object FILE and put debugging information duplicated in more than one object there, afterwards optimizing each named executable or shared library even further if possible.-h,--hardlinkโ look for executables or shared libraries hardlinked together. instead of rewriting them individually, rewrite just one of them and hardlink the rest to the first one again. efficient queen ๐-M NAME,--multifile-name NAMEโ specify the name of the common file that should be put into the.gnu_debugaltlinksection alongside with its build ID. by defaultdwzputs there the argument of the-moption.-r,--relativeโ specify that the name of the common file to be put into the.gnu_debugaltlinksection is supposed to be a relative path, from the directory containing the executable or shared library to the file named in the argument of the-moption. either-Mor-rcan be specified, but not both ๐ซ-p N,--multifile-pointer-size <N|auto|native>โ specify the pointer size of the multifile, in bytes. ifauto, use the pointer size of the files, provided they match. ifnative, use native pointer size, as specified in the help message.-p <l|b|auto>,--multifile-endian <l|b|auto|native>โ specify the endianity of the multifile. ifauto, use the endianity of the files, provided they match. ifnative, use native endianity, as specified in the help message.-q,--quietโ silence up some of the most common messages. shhh ๐คซ-o FILE,--output FILEโ this option instructsdwznot to overwrite the specified file, but instead store the new content into FILE. nothing is written ifdwzexits with non-zero exit code. can be used only with a single executable or shared library (if there are no arguments at all,a.outis assumed).-l <COUNT|none>,--low-mem-die-limit <COUNT|none>โ handle executables or shared libraries containing more than COUNT debugging information entries in their.debug_infosection using a slower and more memory-usage-friendly mode, and don't attempt to optimize that object in multifile mode. the default is 10 million DIEs. there is a risk that for very large amounts of debugging information in a single shared library or executable there might not be enough memory (especially when thedwztool is a 32-bit binary, it might run out of available virtual address space even sooner). specifyingnoneas the argument disables the limit.-L <COUNT|none>,--max-die-limit <COUNT|none>โ don't attempt to optimize executables or shared libraries containing more than COUNT DIEs at all. the default is 50 million DIEs. specifyingnoneas the argument disables the limit.-5,--dwarf-5โ emit standard DWARF 5 Supplementary Object Files with.debug_supand corresponding forms, instead of the GNU extension.gnu_debugaltlinkand corresponding forms. glow up โจ-j <N>,--jobs <N>โ process N files in parallel. the default isprocessors / 2. disabled when multifile is used.--odr/--no-odrโ Experimental. enable/disable One-Definition-Rule optimization for C++ compilation units. this optimization causesstruct/union/classDIEs with the same name to be considered equal. this has the effect that DIEs referring to distinct DIEs representing the same type (like f.i. pointer type DIEs) are considered equal, and may be deduplicated. the status of this optimization is experimental. it's disabled in low-mem mode. disabled by default.--odr-mode=<basic|link>โ set the One-Definition-Rule optimization aggressiveness:basicorlink. when using thelinksetting, the optimization will attempt to replace declarations of astruct/union/classwith a corresponding definition. when using thebasicsetting, that part of the optimization is disabled. in normal operation, thelinksetting should be used. thebasicsetting is provided only as a fallback in case of problems with thelinksetting. set tolinkby default.--import-optimize/--no-import-optimizeโ enable/disable optimization that reduces the number ofDW_TAG_imported_unitDIEs generated to import the partial units created bydwz. disabling the optimization can be used to work around problems in the optimization, or to make it easier to observe which CU imports which PU. enabled by default.-?,--helpโ print short help and exit.-v,--versionโ print version number and short licensing notice and exit.
โจ ARGUMENTS โจ
command-line arguments should be the executables, shared libraries or their stripped to file separate debug information objects. i.e. just hand over the files, bestie ๐
โจ EXAMPLES โจ
okay this first one is the moment:
$ dwz -m .dwz/foobar-1.2.debug -rh \
bin/foo.debug bin/foo2.debug foo/lib/libbar.so.debug
this will attempt to optimize debugging information in bin/foo.debug, bin/foo2.debug and lib/libbar.so.debug (by modifying the files in place) and when beneficial also will create .dwz/foobar-1.2.debug file. the .gnu_debugaltlink section in the first two files will refer to ../.dwz/foobar-1.2.debug and in the last file to ../../.dwz/foobar-1.2.debug. if e.g. bin/foo.debug and bin/foo2.debug were hardlinked together initially, they will be hardlinked again and for multifile optimizations considered just as a single file rather than two. iconic behaviour, fr fr ๐
$ dwz -o foo.dwz foo
will not modify foo but instead store the ELF object with optimized debugging information, if successful, into the foo.dwz file it creates.
$ dwz *.debug foo/*.debug
will attempt to optimize debugging information in *.debug and foo/*.debug files, optimizing each file individually in place.
$ dwz
is equivalent to the dwz a.out command. no thoughts, just defaults ๐ง
โจ SEE ALSO โจ
http://dwarfstd.org/doc/DWARF4.pdf , http://dwarfstd.org/doc/DWARF5.pdf , gdb(1).
โจ AUTHORS โจ
Jakub Jelinek <jakub@redhat.com>, Tom de Vries <tdevries@suse.de>, Mark Wielaard <mark@klomp.org>. legends, all three of them ๐
โจ BUGS โจ
use the Bugzilla link of the project web page or our mailing list. https://sourceware.org/dwz/, <dwz@sourceware.org>.
found a bug? don't be shy, tell them ๐ฉท
okay that's the whole page bestie, we ate and left no crumbs ๐ ๐โญ
this was dwz(1) from the General Commands Manual โ dated 20 May 2026 โ brought to you with love, mwah ๐๐ฆ๐ธ
๐ฆ where this page comes from
- nixpkgs unstable: dwz 0.17
- ubuntu stonking: dwz 0.17-1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms