diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-16 20:00:47 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-05-16 20:39:01 -0700 |
| commit | 728ce2d7c18e23ca6c36d86f4ee1ea4ce3ac81e2 (patch) | |
| tree | b84ffae450a01a7fa2cf22d87176fb633125b359 /src/Compilation.zig | |
| parent | df5085bde012773b974f58e8ee28ed90ff686468 (diff) | |
| download | zig-728ce2d7c18e23ca6c36d86f4ee1ea4ce3ac81e2.tar.gz zig-728ce2d7c18e23ca6c36d86f4ee1ea4ce3ac81e2.zip | |
tweaks to --build-id
* build.zig: the result of b.option() can be assigned directly in many
cases thanks to the return type being an optional
* std.Build: make the build system aware of the
std.Build.Step.Compile.BuildId type when used as an option.
- remove extraneous newlines in error logs
* simplify caching logic
* simplify hexstring parsing tests and use a doc test
* simplify hashing logic. don't use an optional when the `none` tag
already provides this meaning.
* CLI: fix incorrect linker arg parsing
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 5a547346a5..de09a78c77 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -798,6 +798,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { const unwind_tables = options.want_unwind_tables orelse (link_libunwind or target_util.needUnwindTables(options.target)); const link_eh_frame_hdr = options.link_eh_frame_hdr or unwind_tables; + const build_id = options.build_id orelse .none; // Make a decision on whether to use LLD or our own linker. const use_lld = options.use_lld orelse blk: { @@ -828,7 +829,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { options.output_mode == .Lib or options.linker_script != null or options.version_script != null or options.emit_implib != null or - options.build_id != null or + build_id != .none or options.symbol_wrap_set.count() > 0) { break :blk true; @@ -1514,7 +1515,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .skip_linker_dependencies = options.skip_linker_dependencies, .parent_compilation_link_libc = options.parent_compilation_link_libc, .each_lib_rpath = options.each_lib_rpath orelse options.is_native_os, - .build_id = options.build_id, + .build_id = build_id, .cache_mode = cache_mode, .disable_lld_caching = options.disable_lld_caching or cache_mode == .whole, .subsystem = options.subsystem, @@ -2269,9 +2270,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes man.hash.addListOfBytes(comp.bin_file.options.rpath_list); man.hash.addListOfBytes(comp.bin_file.options.symbol_wrap_set.keys()); man.hash.add(comp.bin_file.options.each_lib_rpath); - if (comp.bin_file.options.build_id) |build_id| { - build_id.hash(&man.hash.hasher); - } + man.hash.add(comp.bin_file.options.build_id); man.hash.add(comp.bin_file.options.skip_linker_dependencies); man.hash.add(comp.bin_file.options.z_nodelete); man.hash.add(comp.bin_file.options.z_notext); |
