zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit f2d0d9820d9b20ddc61866d5fe2575cf80f4d9be (tree)
parent 6fdeaac338f3a4a1f3455653ce29bf6ce4bbe335
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Mon, 28 Oct 2019 14:37:32 -0400

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.

Diffstat:
Msrc/codegen.cpp | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 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<const char *> &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) {