diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-10-18 23:57:26 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-10-23 16:27:38 -0700 |
| commit | d1ecb742ec5cb80e29178fddefe6663bed40daa8 (patch) | |
| tree | 7460432fc857653400b4eb884c982f4120755242 /src/Compilation.zig | |
| parent | de0f7fcf526312088e4b373c6ed7436427080087 (diff) | |
| download | zig-d1ecb742ec5cb80e29178fddefe6663bed40daa8.tar.gz zig-d1ecb742ec5cb80e29178fddefe6663bed40daa8.zip | |
don't create unused musl crt objects
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 0b058b99a4..870d5faf8f 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1815,15 +1815,13 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil .{ .musl_crt_file = .crtn_o }, }); } - try comp.queueJobs(&[_]Job{ - .{ .musl_crt_file = .crt1_o }, - .{ .musl_crt_file = .scrt1_o }, - .{ .musl_crt_file = .rcrt1_o }, - switch (comp.config.link_mode) { - .static => .{ .musl_crt_file = .libc_a }, - .dynamic => .{ .musl_crt_file = .libc_so }, - }, - }); + if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| { + try comp.queueJobs(&.{.{ .musl_crt_file = f }}); + } + try comp.queueJobs(&.{.{ .musl_crt_file = switch (comp.config.link_mode) { + .static => .libc_a, + .dynamic => .libc_so, + } }}); } else if (target.isGnuLibC()) { if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable; |
