commit ba7f40c4302fe88fddc92b5b44365f74e00800ff (tree) parent bdbedff910e18e18dc31db84a80607435e9b6ee0 Author: Andrew Kelley <andrew@ziglang.org> Date: Wed, 29 Sep 2021 15:37:34 -0700 stage2: fix ELF linking to include compiler_rt There was duplicated logic for whether to include compiler_rt in the linker line both in the frontend and in the linker backends. Now the logic is only in the frontend; the linker puts it on the linker line if the frontend provides it. Fixes the CI failures. Diffstat:
| M | src/link/Elf.zig | | | 19 | +++++-------------- |
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/src/link/Elf.zig b/src/link/Elf.zig @@ -1282,20 +1282,11 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { const gc_sections = self.base.options.gc_sections orelse !is_obj; const stack_size = self.base.options.stack_size_override orelse 16777216; 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 (!self.base.options.use_llvm) 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. - if (is_obj) break :blk null; - - if (is_exe_or_dyn_lib) { - break :blk comp.compiler_rt_static_lib.?.full_object_path; - } else { - break :blk comp.compiler_rt_obj.?.full_object_path; - } - } else null; + const compiler_rt_path: ?[]const u8 = blk: { + if (comp.compiler_rt_static_lib) |x| break :blk x.full_object_path; + if (comp.compiler_rt_obj) |x| break :blk x.full_object_path; + break :blk null; + }; // Here we want to determine whether we can save time by not invoking LLD when the // output is unchanged. None of the linker options or the object files that are being