add -fstrip=debug_info command line option #22591
Open
+79
−56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a third option for
-fstrip
,-fstrip=debug_info
. It also gives aliases to-fno-strip
and-fstrip
,-fstrip=none
and-fstrip=all
respectively.-fstrip=debug_info
is similar toobjcopy --strip-debug
, removing DWARF debug sections, but retaining the ELF symbol table.Note that this pull request does not currently update the zig build system to expose this functionality.
See also #18520 and #22077
Trying out all 3 strip options on a test case.
Test case:
Not stripping anything, equivalent to
-fno-strip
:Stripping debug info but leaving symbols in:
Stripping debug info and symbol table, equivalent to
-fstrip
:Combining with #22077 (teaching std.debug to read the Elf symbol table)
This work is licensed on the same terms as the Zig project.
Copyright © 2025 TigerBeetle, Inc.
This code was written under contract for TigerBeetle. As a work made for hire, authorship and copyright goes to TigerBeetle.
Author certificate