Skip to content

Commit

Permalink
avoid unnecessarily building Scrt1.o when cross-compiling glibc
Browse files Browse the repository at this point in the history
which, in this branch causes a miscompilation because it would get sent
to the linker.
  • Loading branch information
andrewrk committed Oct 23, 2024
1 parent 5e11790 commit 4bdc2d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1795,10 +1795,12 @@ 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 });
}
try comp.queueJobs(&[_]Job{
.{ .glibc_crt_file = .scrt1_o },
.{ .glibc_crt_file = .libc_nonshared_a },
.{ .glibc_shared_objects = {} },
.{ .glibc_crt_file = .libc_nonshared_a },
});
} else if (target.isWasm() and target.os.tag == .wasi) {
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
Expand Down

0 comments on commit 4bdc2d3

Please sign in to comment.