Skip to content

Commit f2d0d98

Browse files
committed
synchronize the target features for compiling C code
d91fc0f changed zig's behavior to disable the SSE feature when cross compiling for i386-freestanding. This commit does the same when compiling C Code.
1 parent 6fdeaac commit f2d0d98

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/codegen.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8469,12 +8469,7 @@ static void init(CodeGen *g) {
84698469
// uses as base cpu.
84708470
// TODO https://github.com/ziglang/zig/issues/2883
84718471
target_specific_cpu_args = "pentium4";
8472-
if (g->zig_target->os == OsFreestanding) {
8473-
target_specific_features = "-sse";
8474-
}
8475-
else {
8476-
target_specific_features = "";
8477-
}
8472+
target_specific_features = (g->zig_target->os == OsFreestanding) ? "-sse": "";
84788473
} else {
84798474
target_specific_cpu_args = "";
84808475
target_specific_features = "";
@@ -8779,6 +8774,11 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa
87798774
args.append("-target-feature");
87808775
args.append("-Xclang");
87818776
args.append(riscv_default_features);
8777+
} else if (g->zig_target->os == OsFreestanding && g->zig_target->arch == ZigLLVM_x86) {
8778+
args.append("-Xclang");
8779+
args.append("-target-feature");
8780+
args.append("-Xclang");
8781+
args.append("-sse");
87828782
}
87838783
}
87848784
if (g->zig_target->os == OsFreestanding) {

0 commit comments

Comments
 (0)