authorgravatar for hugegameartgd@gmail.comLinuxUserGD <hugegameartgd@gmail.com> 2023-08-16 21:37:04+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-26 14:18:01-07:00
logceaae42e90b1f4ba4aa59328e76913cdde3dedb9
treeef18b9854a2d1c85c9a8ece40c12e9966dad281f
parent1c726bcb321d03ac74d1bd646b690991ba356fd8

Add '--compress-debug-sections=zstd'


4 files changed, 8 insertions(+), 5 deletions(-)

lib/std/Build/Step/Compile.zig+2-1
......@@ -39,7 +39,7 @@ name_only_filename: ?[]const u8,
3939strip: ?bool,
4040unwind_tables: ?bool,
4141// keep in sync with src/link.zig:CompressDebugSections
42compress_debug_sections: enum { none, zlib } = .none,
42compress_debug_sections: enum { none, zlib, zstd } = .none,
4343lib_paths: ArrayList(LazyPath),
4444rpaths: ArrayList(LazyPath),
4545frameworks: StringHashMap(FrameworkLinkInfo),
......@@ -1628,6 +1628,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
16281628 switch (self.compress_debug_sections) {
16291629 .none => {},
16301630 .zlib => try zig_args.append("--compress-debug-sections=zlib"),
1631 .zstd => try zig_args.append("--compress-debug-sections=zstd"),
16311632 }
16321633
16331634 if (self.link_eh_frame_hdr) {
src/link.zig+1-1
......@@ -281,7 +281,7 @@ pub const Options = struct {
281281
282282pub const HashStyle = enum { sysv, gnu, both };
283283
284pub const CompressDebugSections = enum { none, zlib };
284pub const CompressDebugSections = enum { none, zlib, zstd };
285285
286286/// The filesystem layout of darwin SDK elements.
287287pub const DarwinSdkLayout = enum {
src/link/Elf.zig+1
......@@ -2230,6 +2230,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
22302230 switch (self.base.options.compress_debug_sections) {
22312231 .none => {},
22322232 .zlib => try argv.append("--compress-debug-sections=zlib"),
2233 .zstd => try argv.append("--compress-debug-sections=zstd"),
22332234 }
22342235
22352236 if (self.base.options.bind_global_refs_locally) {
src/main.zig+4-3
......@@ -539,6 +539,7 @@ const usage_build_generic =
539539 \\ --compress-debug-sections=[e] Debug section compression settings
540540 \\ none No compression
541541 \\ zlib Compression with deflate/inflate
542 \\ zstd Compression with zstandard
542543 \\ --gc-sections Force removal of functions and data that are unreachable by the entry point or exported symbols
543544 \\ --no-gc-sections Don't force removal of unreachable functions and data
544545 \\ --sort-section=[value] Sort wildcard section patterns by 'name' or 'alignment'
......@@ -1110,7 +1111,7 @@ fn buildOutputType(
11101111 } else if (mem.startsWith(u8, arg, "--compress-debug-sections=")) {
11111112 const param = arg["--compress-debug-sections=".len..];
11121113 linker_compress_debug_sections = std.meta.stringToEnum(link.CompressDebugSections, param) orelse {
1113 fatal("expected --compress-debug-sections=[none|zlib], found '{s}'", .{param});
1114 fatal("expected --compress-debug-sections=[none|zlib|zstd], found '{s}'", .{param});
11141115 };
11151116 } else if (mem.eql(u8, arg, "--compress-debug-sections")) {
11161117 linker_compress_debug_sections = link.CompressDebugSections.zlib;
......@@ -1986,7 +1987,7 @@ fn buildOutputType(
19861987 linker_compress_debug_sections = .zlib;
19871988 } else {
19881989 linker_compress_debug_sections = std.meta.stringToEnum(link.CompressDebugSections, it.only_arg) orelse {
1989 fatal("expected [none|zlib] after --compress-debug-sections, found '{s}'", .{it.only_arg});
1990 fatal("expected [none|zlib|zstd] after --compress-debug-sections, found '{s}'", .{it.only_arg});
19901991 };
19911992 }
19921993 },
......@@ -2139,7 +2140,7 @@ fn buildOutputType(
21392140 } else if (mem.eql(u8, arg, "--compress-debug-sections")) {
21402141 const arg1 = linker_args_it.nextOrFatal();
21412142 linker_compress_debug_sections = std.meta.stringToEnum(link.CompressDebugSections, arg1) orelse {
2142 fatal("expected [none|zlib] after --compress-debug-sections, found '{s}'", .{arg1});
2143 fatal("expected [none|zlib|zstd] after --compress-debug-sections, found '{s}'", .{arg1});
21432144 };
21442145 } else if (mem.startsWith(u8, arg, "-z")) {
21452146 var z_arg = arg[2..];