| author | |
| committer | |
| log | fd9b55a6405f908237285ee8280648ad368fccfc |
| tree | e3ca2fea54f5bad1c984c7c56004eb6c4ef17ef1 |
| parent | c1f3aca6027baaae781503af579767d208f8f172 |
Now that #11863 is landed, let's expose it to the zig programs that
build stuff via `build.zig`. "Benchmarks" with [turbonss](https://git.sr.ht/~motiejus/turbonss):
Built with:
$ zig build -Dtarget=x86_64-linux-gnu.2.19 -Dcpu=x86_64_v3 -Drelease-small=true
*Debug, uncompressed*
174K turbonss-analyze
161K turbonss-getent
1.2M turbonss-unix2db
448K libnss_turbo.so.2.0.0
*Debug, compressed*
78K turbonss-analyze
86K turbonss-getent
572K turbonss-unix2db
190K libnss_turbo.so.2.0.0
*Stripped, for completeness*
17K turbonss-analyze
20K turbonss-getent
197K turbonss-unix2db
26K libnss_turbo.so.2.0.01 files changed, 8 insertions(+), 0 deletions(-)
lib/std/build.zig+8| ... | ... | @@ -1474,6 +1474,8 @@ pub const LibExeObjStep = struct { |
| 1474 | 1474 | major_only_filename: ?[]const u8, |
| 1475 | 1475 | name_only_filename: ?[]const u8, |
| 1476 | 1476 | strip: bool, |
| 1477 | // keep in sync with src/link.zig:CompressDebugSections | |
| 1478 | compress_debug_sections: enum { none, zlib } = .none, | |
| 1477 | 1479 | lib_paths: ArrayList([]const u8), |
| 1478 | 1480 | rpaths: ArrayList([]const u8), |
| 1479 | 1481 | framework_dirs: ArrayList([]const u8), |
| ... | ... | @@ -2688,6 +2690,12 @@ pub const LibExeObjStep = struct { |
| 2688 | 2690 | if (self.strip) { |
| 2689 | 2691 | try zig_args.append("--strip"); |
| 2690 | 2692 | } |
| 2693 | ||
| 2694 | switch (self.compress_debug_sections) { | |
| 2695 | .none => {}, | |
| 2696 | .zlib => try zig_args.append("--compress-debug-sections=zlib"), | |
| 2697 | } | |
| 2698 | ||
| 2691 | 2699 | if (self.link_eh_frame_hdr) { |
| 2692 | 2700 | try zig_args.append("--eh-frame-hdr"); |
| 2693 | 2701 | } |