@@ -749,6 +749,7 @@ pub const InitOptions = struct {
749749 version : ? std.builtin.Version = null ,
750750 libc_installation : ? * const LibCInstallation = null ,
751751 machine_code_model : std.builtin.CodeModel = .default ,
752+ target_abi : std.Target.TargetAbi ,
752753 clang_preprocessor_mode : ClangPreprocessorMode = .no ,
753754 /// This is for stage1 and should be deleted upon completion of self-hosting.
754755 color : @import ("main.zig" ).Color = .auto ,
@@ -1146,6 +1147,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
11461147 cache .hash .add (options .target .os .getVersionRange ());
11471148 cache .hash .add (options .is_native_os );
11481149 cache .hash .add (options .target .abi );
1150+ cache .hash .addBytes (options .target_abi .string () orelse "." );
11491151 cache .hash .add (ofmt );
11501152 cache .hash .add (pic );
11511153 cache .hash .add (pie );
@@ -1427,6 +1429,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
14271429 .single_threaded = single_threaded ,
14281430 .verbose_link = options .verbose_link ,
14291431 .machine_code_model = options .machine_code_model ,
1432+ .target_abi = options .target_abi ,
14301433 .dll_export_fns = dll_export_fns ,
14311434 .error_return_tracing = error_return_tracing ,
14321435 .llvm_cpu_features = llvm_cpu_features ,
@@ -3267,7 +3270,7 @@ pub fn addCCArgs(
32673270 try argv .append ("-mthumb" );
32683271 }
32693272
3270- if (std . Target . TargetAbi . default ( target . cpu ) .string ()) | mabi | {
3273+ if (comp . bin_file . options . target_abi .string ()) | mabi | {
32713274 try argv .append (try std .fmt .allocPrint (arena , "-mabi={s}" , .{mabi }));
32723275 }
32733276
@@ -3404,7 +3407,7 @@ pub fn addCCArgs(
34043407 },
34053408 }
34063409
3407- if (std . Target . TargetAbi . default ( target . cpu ) .string ()) | mabi | {
3410+ if (comp . bin_file . options . target_abi .string ()) | mabi | {
34083411 try argv .append (try std .fmt .allocPrint (arena , "-mabi={s}" , .{mabi }));
34093412 }
34103413
@@ -4136,6 +4139,7 @@ fn buildOutputFromZig(
41364139 .strip = comp .compilerRtStrip (),
41374140 .is_native_os = comp .bin_file .options .is_native_os ,
41384141 .is_native_abi = comp .bin_file .options .is_native_abi ,
4142+ .target_abi = comp .bin_file .options .target_abi ,
41394143 .self_exe_path = comp .self_exe_path ,
41404144 .verbose_cc = comp .verbose_cc ,
41414145 .verbose_link = comp .bin_file .options .verbose_link ,
@@ -4323,6 +4327,7 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node
43234327 .is_native_cpu = false , // Only true when bootstrapping the compiler.
43244328 .llvm_cpu_name = if (target .cpu .model .llvm_name ) | s | s .ptr else null ,
43254329 .llvm_cpu_features = comp .bin_file .options .llvm_cpu_features .? ,
4330+ .llvm_target_abi = if (comp .bin_file .options .target_abi .string ()) | s | s .ptr else null ,
43264331 };
43274332
43284333 comp .stage1_cache_manifest = & man ;
@@ -4572,6 +4577,7 @@ pub fn build_crt_file(
45724577 .strip = comp .compilerRtStrip (),
45734578 .is_native_os = comp .bin_file .options .is_native_os ,
45744579 .is_native_abi = comp .bin_file .options .is_native_abi ,
4580+ .target_abi = comp .bin_file .options .target_abi ,
45754581 .self_exe_path = comp .self_exe_path ,
45764582 .c_source_files = c_source_files ,
45774583 .verbose_cc = comp .verbose_cc ,
0 commit comments