diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-01-26 14:59:15 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-01-26 15:01:59 -0700 |
| commit | 40c9ce2caf8f024a249b3524813eb495cf1341b3 (patch) | |
| tree | 84dd4cfca306b33956746650155dd14d4e4fafac /src/Compilation.zig | |
| parent | 35503b3d3fe1bfce19f1ea3e78a75ce87b0ed646 (diff) | |
| download | zig-40c9ce2caf8f024a249b3524813eb495cf1341b3.tar.gz zig-40c9ce2caf8f024a249b3524813eb495cf1341b3.zip | |
zig cc: add --hash-style linker parameter
This is only relevant for ELF files.
I also fixed a bug where passing a zig source file to `zig cc` would
incorrectly punt to clang because it thought there were no positional
arguments.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index dec98ed781..b804227bb9 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -791,6 +791,7 @@ pub const InitOptions = struct { /// infinite recursion. skip_linker_dependencies: bool = false, parent_compilation_link_libc: bool = false, + hash_style: link.HashStyle = .both, entry: ?[]const u8 = null, stack_size_override: ?u64 = null, image_base_override: ?u64 = null, @@ -1610,6 +1611,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .is_test = options.is_test, .wasi_exec_model = wasi_exec_model, .use_stage1 = use_stage1, + .hash_style = options.hash_style, .enable_link_snapshots = options.enable_link_snapshots, .native_darwin_sdk = options.native_darwin_sdk, .install_name = options.install_name, @@ -2227,7 +2229,7 @@ fn prepareWholeEmitSubPath(arena: Allocator, opt_emit: ?EmitLoc) error{OutOfMemo /// to remind the programmer to update multiple related pieces of code that /// are in different locations. Bump this number when adding or deleting /// anything from the link cache manifest. -pub const link_hash_implementation_version = 1; +pub const link_hash_implementation_version = 2; fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifest) !void { const gpa = comp.gpa; @@ -2237,7 +2239,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes defer arena_allocator.deinit(); const arena = arena_allocator.allocator(); - comptime assert(link_hash_implementation_version == 1); + comptime assert(link_hash_implementation_version == 2); if (comp.bin_file.options.module) |mod| { const main_zig_file = try mod.main_pkg.root_src_directory.join(arena, &[_][]const u8{ @@ -2308,6 +2310,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes man.hash.add(comp.bin_file.options.z_noexecstack); man.hash.add(comp.bin_file.options.z_now); man.hash.add(comp.bin_file.options.z_relro); + man.hash.add(comp.bin_file.options.hash_style); man.hash.add(comp.bin_file.options.include_compiler_rt); if (comp.bin_file.options.link_libc) { man.hash.add(comp.bin_file.options.libc_installation != null); |
