mirror of
https://github.com/ziglang/zig.git
synced 2024-11-14 16:13:24 +00:00
glibc: Don't build CRT objects that won't be used.
This commit is contained in:
parent
4c70aea460
commit
3a2647b7d3
@ -1795,8 +1795,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
|
||||
.{ .glibc_crt_file = .crtn_o },
|
||||
});
|
||||
}
|
||||
if (!is_dyn_lib) {
|
||||
try comp.queueJob(.{ .glibc_crt_file = .scrt1_o });
|
||||
if (glibc.needsCrt0(comp.config.output_mode)) |f| {
|
||||
try comp.queueJobs(&.{.{ .glibc_crt_file = f }});
|
||||
}
|
||||
try comp.queueJobs(&[_]Job{
|
||||
.{ .glibc_shared_objects = {} },
|
||||
|
@ -1357,3 +1357,10 @@ pub fn needsCrtiCrtn(target: std.Target) bool {
|
||||
else => true,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn needsCrt0(output_mode: std.builtin.OutputMode) ?CrtFile {
|
||||
return switch (output_mode) {
|
||||
.Obj, .Lib => null,
|
||||
.Exe => .scrt1_o,
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user