diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-11 14:18:56 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-11 14:18:56 -0700 |
| commit | 2b99182e25e045109b090a794bb06295b09a0eeb (patch) | |
| tree | 4cbb93210359b2b1f7e8359752807c8eb4dcf353 /src/main.zig | |
| parent | 1f410b500c8dbe33191a54a4ae02a6fb0febec46 (diff) | |
| download | zig-2b99182e25e045109b090a794bb06295b09a0eeb.tar.gz zig-2b99182e25e045109b090a794bb06295b09a0eeb.zip | |
stage2: cleanups to --compress-debug-sections
* make the setting in the linker backend be non-optional; by this time
all defaults are supposed to be resolved.
* integrate with `zig cc`
* change the CLI parsing to match C compiler parsing, allowing
`--compress-debug-sections` alone to choose a default encoding of
zlib.
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig index c23aa3111a..643cc3498b 100644 --- a/src/main.zig +++ b/src/main.zig @@ -443,8 +443,9 @@ const usage_build_generic = \\ -dynamic Force output to be dynamically linked \\ -static Force output to be statically linked \\ -Bsymbolic Bind global references locally - \\ --compress-debug-sections= Compress DWARF debug sections - \\ none|zlib + \\ --compress-debug-sections=[e] Debug section compression settings + \\ none No compression + \\ zlib Compression with deflate/inflate \\ --subsystem [subsystem] (Windows) /SUBSYSTEM:<subsystem> to the linker \\ --stack [size] Override default stack size \\ --image-base [addr] Set base address for executable image @@ -946,6 +947,8 @@ fn buildOutputType( linker_compress_debug_sections = std.meta.stringToEnum(link.CompressDebugSections, param) orelse { fatal("expected --compress-debug-sections=[none|zlib], found '{s}'", .{param}); }; + } else if (mem.eql(u8, arg, "--compress-debug-sections")) { + linker_compress_debug_sections = link.CompressDebugSections.zlib; } else if (mem.eql(u8, arg, "-pagezero_size")) { const next_arg = args_iter.next() orelse { fatal("expected parameter after {s}", .{arg}); @@ -1648,6 +1651,15 @@ fn buildOutputType( .weak_library => try system_libs.put(it.only_arg, .{ .weak = true }), .weak_framework => try frameworks.put(gpa, it.only_arg, .{ .weak = true }), .headerpad_max_install_names => headerpad_max_install_names = true, + .compress_debug_sections => { + if (it.only_arg.len == 0) { + linker_compress_debug_sections = .zlib; + } else { + linker_compress_debug_sections = std.meta.stringToEnum(link.CompressDebugSections, it.only_arg) orelse { + fatal("expected [none|zlib] after --compress-debug-sections, found '{s}'", .{it.only_arg}); + }; + } + }, } } // Parse linker args. @@ -4617,6 +4629,7 @@ pub const ClangArgIterator = struct { weak_library, weak_framework, headerpad_max_install_names, + compress_debug_sections, }; const Args = struct { |
