diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-07-27 17:08:37 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-27 17:08:37 -0700 |
| commit | dc88864c9742029c2980fc16cd2c9e6f04ff3568 (patch) | |
| tree | 2569f14d189ef238ca7a281774e09ba49374113b /src/link | |
| parent | 66e5920dc3411daa4f0c84a8f4c733c1263e8523 (diff) | |
| download | zig-dc88864c9742029c2980fc16cd2c9e6f04ff3568.tar.gz zig-dc88864c9742029c2980fc16cd2c9e6f04ff3568.zip | |
stage2: implement `@boolToInt`
This is the first commit in which some behavior tests are passing for
both stage1 and stage2.
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/Coff.zig | 7 | ||||
| -rw-r--r-- | src/link/Elf.zig | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 0c9e513742..4f5df73f8d 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -885,7 +885,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { // Both stage1 and stage2 LLVM backend put the object file in the cache directory. if (self.base.options.use_llvm) { // Stage2 has to call flushModule since that outputs the LLVM object file. - if (!build_options.is_stage1) try self.flushModule(comp); + if (!build_options.is_stage1 or !self.base.options.use_stage1) try self.flushModule(comp); const obj_basename = try std.zig.binNameAlloc(arena, .{ .root_name = self.base.options.root_name, @@ -1269,7 +1269,10 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { // TODO: remove when stage2 can build compiler_rt.zig, c.zig and ssp.zig // compiler-rt, libc and libssp - if (is_exe_or_dyn_lib and !self.base.options.skip_linker_dependencies and build_options.is_stage1) { + if (is_exe_or_dyn_lib and + !self.base.options.skip_linker_dependencies and + build_options.is_stage1 and self.base.options.use_stage1) + { if (!self.base.options.link_libc) { try argv.append(comp.libc_static_lib.?.full_object_path); } diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 502575f3c8..9ddebd3453 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1257,7 +1257,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { // Both stage1 and stage2 LLVM backend put the object file in the cache directory. if (self.base.options.use_llvm) { // Stage2 has to call flushModule since that outputs the LLVM object file. - if (!build_options.is_stage1) try self.flushModule(comp); + if (!build_options.is_stage1 or !self.base.options.use_stage1) try self.flushModule(comp); const obj_basename = try std.zig.binNameAlloc(arena, .{ .root_name = self.base.options.root_name, @@ -1287,7 +1287,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { const allow_shlib_undefined = self.base.options.allow_shlib_undefined orelse !self.base.options.is_native_os; const compiler_rt_path: ?[]const u8 = if (self.base.options.include_compiler_rt) blk: { // TODO: remove when stage2 can build compiler_rt.zig - if (!build_options.is_stage1) break :blk null; + if (!build_options.is_stage1 or !self.base.options.use_stage1) break :blk null; // In the case of build-obj we include the compiler-rt symbols directly alongside // the symbols of the root source file, in the same compilation unit. @@ -1605,7 +1605,8 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { if (is_exe_or_dyn_lib and !self.base.options.skip_linker_dependencies and !self.base.options.link_libc and - build_options.is_stage1) + build_options.is_stage1 and + self.base.options.use_stage1) { try argv.append(comp.libc_static_lib.?.full_object_path); } |
