From f2d0d9820d9b20ddc61866d5fe2575cf80f4d9be Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 28 Oct 2019 14:37:32 -0400 Subject: [PATCH] synchronize the target features for compiling C code d91fc0fdd8f42dc8c38347e1a0ec87fd583c1d3d changed zig's behavior to disable the SSE feature when cross compiling for i386-freestanding. This commit does the same when compiling C Code. --- src/codegen.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index 6ee36a72ea..d01bcfbd77 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8469,12 +8469,7 @@ static void init(CodeGen *g) { // uses as base cpu. // TODO https://github.com/ziglang/zig/issues/2883 target_specific_cpu_args = "pentium4"; - if (g->zig_target->os == OsFreestanding) { - target_specific_features = "-sse"; - } - else { - target_specific_features = ""; - } + target_specific_features = (g->zig_target->os == OsFreestanding) ? "-sse": ""; } else { target_specific_cpu_args = ""; target_specific_features = ""; @@ -8779,6 +8774,11 @@ void add_cc_args(CodeGen *g, ZigList &args, const char *out_dep_pa args.append("-target-feature"); args.append("-Xclang"); args.append(riscv_default_features); + } else if (g->zig_target->os == OsFreestanding && g->zig_target->arch == ZigLLVM_x86) { + args.append("-Xclang"); + args.append("-target-feature"); + args.append("-Xclang"); + args.append("-sse"); } } if (g->zig_target->os == OsFreestanding) {