From 3efdd7b2ad6cce5985d761240636b3d5eb3b4c84 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 29 Sep 2020 01:28:48 -0700 Subject: [PATCH] don't try to build musl crti.o crtn.o when it's not needed such as on RISC-V --- BRANCH_TODO | 2 +- src/Compilation.zig | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/BRANCH_TODO b/BRANCH_TODO index f2adbb51d8..c6b3c8d8b3 100644 --- a/BRANCH_TODO +++ b/BRANCH_TODO @@ -1,3 +1,3 @@ - * building risc-v musl regression + * wasi behavior tests failing * go ahead and use allocSentinel now that the stage1 bug is fixed * audit the base cache hash diff --git a/src/Compilation.zig b/src/Compilation.zig index 1cd0d6c099..c3cda196de 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -855,9 +855,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { try comp.addBuildingGLibCJobs(); } if (comp.wantBuildMuslFromSource()) { - try comp.work_queue.write(&[_]Job{ - .{ .musl_crt_file = .crti_o }, - .{ .musl_crt_file = .crtn_o }, + try comp.work_queue.ensureUnusedCapacity(5); + if (target_util.libc_needs_crti_crtn(comp.getTarget())) { + comp.work_queue.writeAssumeCapacity(&[_]Job{ + .{ .musl_crt_file = .crti_o }, + .{ .musl_crt_file = .crtn_o }, + }); + } + comp.work_queue.writeAssumeCapacity(&[_]Job{ .{ .musl_crt_file = .crt1_o }, .{ .musl_crt_file = .scrt1_o }, .{ .musl_crt_file = .libc_a },