authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-29 15:37:34-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-29 15:37:34-07:00
logba7f40c4302fe88fddc92b5b44365f74e00800ff
tree68e384cc7c053d662fc3bcae0d4aa8d0369beaab
parentbdbedff910e18e18dc31db84a80607435e9b6ee0

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.

1 files changed, 5 insertions(+), 14 deletions(-)

src/link/Elf.zig+5-14
...@@ -1282,20 +1282,11 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {...@@ -1282,20 +1282,11 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
1282 const gc_sections = self.base.options.gc_sections orelse !is_obj;1282 const gc_sections = self.base.options.gc_sections orelse !is_obj;
1283 const stack_size = self.base.options.stack_size_override orelse 16777216;1283 const stack_size = self.base.options.stack_size_override orelse 16777216;
1284 const allow_shlib_undefined = self.base.options.allow_shlib_undefined orelse !self.base.options.is_native_os;1284 const allow_shlib_undefined = self.base.options.allow_shlib_undefined orelse !self.base.options.is_native_os;
1285 const compiler_rt_path: ?[]const u8 = if (self.base.options.include_compiler_rt) blk: {1285 const compiler_rt_path: ?[]const u8 = blk: {
1286 // TODO: remove when stage2 can build compiler_rt.zig1286 if (comp.compiler_rt_static_lib) |x| break :blk x.full_object_path;
1287 if (!self.base.options.use_llvm) break :blk null;1287 if (comp.compiler_rt_obj) |x| break :blk x.full_object_path;
12881288 break :blk null;
1289 // In the case of build-obj we include the compiler-rt symbols directly alongside1289 };
1290 // the symbols of the root source file, in the same compilation unit.
1291 if (is_obj) break :blk null;
1292
1293 if (is_exe_or_dyn_lib) {
1294 break :blk comp.compiler_rt_static_lib.?.full_object_path;
1295 } else {
1296 break :blk comp.compiler_rt_obj.?.full_object_path;
1297 }
1298 } else null;
12991290
1300 // Here we want to determine whether we can save time by not invoking LLD when the1291 // Here we want to determine whether we can save time by not invoking LLD when the
1301 // output is unchanged. None of the linker options or the object files that are being1292 // output is unchanged. None of the linker options or the object files that are being