diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-07-26 03:09:55 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-07-26 17:31:04 -0400 |
| commit | 69abc945e45af3f447f9ee07d426d1ec40cf3f15 (patch) | |
| tree | 457a9ee76f91135cf7a71192a09c317a63c05961 /src/Compilation.zig | |
| parent | 1274254c48ee105623c513dfc01451fee2912c5b (diff) | |
| download | zig-69abc945e45af3f447f9ee07d426d1ec40cf3f15.tar.gz zig-69abc945e45af3f447f9ee07d426d1ec40cf3f15.zip | |
aarch64: implement some safety checks
Closes #24553
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 4ed2e8c0ca..3796ed6acc 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1816,10 +1816,12 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil if (options.skip_linker_dependencies) break :s .none; const want = options.want_compiler_rt orelse is_exe_or_dyn_lib; if (!want) break :s .none; - if (have_zcu) { + if (have_zcu and target_util.canBuildLibCompilerRt(target, use_llvm, build_options.have_llvm and use_llvm)) { if (output_mode == .Obj) break :s .zcu; - if (target.ofmt == .coff and target_util.zigBackend(target, use_llvm) == .stage2_x86_64) - break :s if (is_exe_or_dyn_lib) .dyn_lib else .zcu; + if (switch (target_util.zigBackend(target, use_llvm)) { + else => false, + .stage2_aarch64, .stage2_x86_64 => target.ofmt == .coff, + }) break :s if (is_exe_or_dyn_lib) .dyn_lib else .zcu; } if (is_exe_or_dyn_lib) break :s .lib; break :s .obj; @@ -1854,7 +1856,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil const want_ubsan_rt = options.want_ubsan_rt orelse (can_build_ubsan_rt and any_sanitize_c == .full and is_exe_or_dyn_lib); if (!want_ubsan_rt) break :s .none; if (options.skip_linker_dependencies) break :s .none; - if (have_zcu) break :s .zcu; + if (have_zcu and target_util.canBuildLibUbsanRt(target, use_llvm, build_options.have_llvm and use_llvm)) break :s .zcu; if (is_exe_or_dyn_lib) break :s .lib; break :s .obj; }; |
