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,...@@ -39,7 +39,7 @@ name_only_filename: ?[]const u8,
39strip: ?bool,39strip: ?bool,
40unwind_tables: ?bool,40unwind_tables: ?bool,
41// keep in sync with src/link.zig:CompressDebugSections41// keep in sync with src/link.zig:CompressDebugSections
42compress_debug_sections: enum { none, zlib } = .none,42compress_debug_sections: enum { none, zlib, zstd } = .none,
43lib_paths: ArrayList(LazyPath),43lib_paths: ArrayList(LazyPath),
44rpaths: ArrayList(LazyPath),44rpaths: ArrayList(LazyPath),
45frameworks: StringHashMap(FrameworkLinkInfo),45frameworks: StringHashMap(FrameworkLinkInfo),
...@@ -1628,6 +1628,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {...@@ -1628,6 +1628,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
1628 switch (self.compress_debug_sections) {1628 switch (self.compress_debug_sections) {
1629 .none => {},1629 .none => {},
1630 .zlib => try zig_args.append("--compress-debug-sections=zlib"),1630 .zlib => try zig_args.append("--compress-debug-sections=zlib"),
1631 .zstd => try zig_args.append("--compress-debug-sections=zstd"),
1631 }1632 }
16321633
1633 if (self.link_eh_frame_hdr) {1634 if (self.link_eh_frame_hdr) {
src/link.zig+1-1
...@@ -281,7 +281,7 @@ pub const Options = struct {...@@ -281,7 +281,7 @@ pub const Options = struct {
281281
282pub const HashStyle = enum { sysv, gnu, both };282pub const HashStyle = enum { sysv, gnu, both };
283283
284pub const CompressDebugSections = enum { none, zlib };284pub const CompressDebugSections = enum { none, zlib, zstd };
285285
286/// The filesystem layout of darwin SDK elements.286/// The filesystem layout of darwin SDK elements.
287pub const DarwinSdkLayout = enum {287pub const DarwinSdkLayout = enum {
src/link/Elf.zig+1
...@@ -2230,6 +2230,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v...@@ -2230,6 +2230,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
2230 switch (self.base.options.compress_debug_sections) {2230 switch (self.base.options.compress_debug_sections) {
2231 .none => {},2231 .none => {},
2232 .zlib => try argv.append("--compress-debug-sections=zlib"),2232 .zlib => try argv.append("--compress-debug-sections=zlib"),
2233 .zstd => try argv.append("--compress-debug-sections=zstd"),
2233 }2234 }
22342235
2235 if (self.base.options.bind_global_refs_locally) {2236 if (self.base.options.bind_global_refs_locally) {
src/main.zig+4-3
...@@ -539,6 +539,7 @@ const usage_build_generic =...@@ -539,6 +539,7 @@ const usage_build_generic =
539 \\ --compress-debug-sections=[e] Debug section compression settings539 \\ --compress-debug-sections=[e] Debug section compression settings
540 \\ none No compression540 \\ none No compression
541 \\ zlib Compression with deflate/inflate541 \\ zlib Compression with deflate/inflate
542 \\ zstd Compression with zstandard
542 \\ --gc-sections Force removal of functions and data that are unreachable by the entry point or exported symbols543 \\ --gc-sections Force removal of functions and data that are unreachable by the entry point or exported symbols
543 \\ --no-gc-sections Don't force removal of unreachable functions and data544 \\ --no-gc-sections Don't force removal of unreachable functions and data
544 \\ --sort-section=[value] Sort wildcard section patterns by 'name' or 'alignment'545 \\ --sort-section=[value] Sort wildcard section patterns by 'name' or 'alignment'
...@@ -1110,7 +1111,7 @@ fn buildOutputType(...@@ -1110,7 +1111,7 @@ fn buildOutputType(
1110 } else if (mem.startsWith(u8, arg, "--compress-debug-sections=")) {1111 } else if (mem.startsWith(u8, arg, "--compress-debug-sections=")) {
1111 const param = arg["--compress-debug-sections=".len..];1112 const param = arg["--compress-debug-sections=".len..];
1112 linker_compress_debug_sections = std.meta.stringToEnum(link.CompressDebugSections, param) orelse {1113 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});
1114 };1115 };
1115 } else if (mem.eql(u8, arg, "--compress-debug-sections")) {1116 } else if (mem.eql(u8, arg, "--compress-debug-sections")) {
1116 linker_compress_debug_sections = link.CompressDebugSections.zlib;1117 linker_compress_debug_sections = link.CompressDebugSections.zlib;
...@@ -1986,7 +1987,7 @@ fn buildOutputType(...@@ -1986,7 +1987,7 @@ fn buildOutputType(
1986 linker_compress_debug_sections = .zlib;1987 linker_compress_debug_sections = .zlib;
1987 } else {1988 } else {
1988 linker_compress_debug_sections = std.meta.stringToEnum(link.CompressDebugSections, it.only_arg) orelse {1989 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});
1990 };1991 };
1991 }1992 }
1992 },1993 },
...@@ -2139,7 +2140,7 @@ fn buildOutputType(...@@ -2139,7 +2140,7 @@ fn buildOutputType(
2139 } else if (mem.eql(u8, arg, "--compress-debug-sections")) {2140 } else if (mem.eql(u8, arg, "--compress-debug-sections")) {
2140 const arg1 = linker_args_it.nextOrFatal();2141 const arg1 = linker_args_it.nextOrFatal();
2141 linker_compress_debug_sections = std.meta.stringToEnum(link.CompressDebugSections, arg1) orelse {2142 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});
2143 };2144 };
2144 } else if (mem.startsWith(u8, arg, "-z")) {2145 } else if (mem.startsWith(u8, arg, "-z")) {
2145 var z_arg = arg[2..];2146 var z_arg = arg[2..];