Skip to content

Commit

Permalink
workaround for invalid binary created on windows
Browse files Browse the repository at this point in the history
when target native features are used.

See #508
  • Loading branch information
andrewrk committed Sep 30, 2017
1 parent 845f221 commit 588d286
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4959,8 +4959,16 @@ static void init(CodeGen *g) {
const char *target_specific_cpu_args;
const char *target_specific_features;
if (g->is_native_target) {
target_specific_cpu_args = ZigLLVMGetHostCPUName();
target_specific_features = ZigLLVMGetNativeFeatures();
// LLVM creates invalid binaries on Windows sometimes.
// See https://github.com/zig-lang/zig/issues/508
// As a workaround we do not use target native features on Windows.
if (g->zig_target.os == ZigLLVM_Win32) {
target_specific_cpu_args = "";
target_specific_features = "";
} else {
target_specific_cpu_args = ZigLLVMGetHostCPUName();
target_specific_features = ZigLLVMGetNativeFeatures();
}
} else {
target_specific_cpu_args = "";
target_specific_features = "";
Expand Down

0 comments on commit 588d286

Please sign in to comment.