authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-09-30 15:47:46-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-09-30 15:47:46-04:00
log588d2862d90b65b7227975ecd3c8dfdaabbdefc6
tree7ba99ae80d726532d951078165a1d5a825ee54e9
parent845f22101b1efb2d8898d8ba7310cd78151a42d5

workaround for invalid binary created on windows

when target native features are used. See #508

1 files changed, 10 insertions(+), 2 deletions(-)

src/codegen.cpp+10-2
......@@ -4959,8 +4959,16 @@ static void init(CodeGen *g) {
49594959 const char *target_specific_cpu_args;
49604960 const char *target_specific_features;
49614961 if (g->is_native_target) {
4962 target_specific_cpu_args = ZigLLVMGetHostCPUName();
4963 target_specific_features = ZigLLVMGetNativeFeatures();
4962 // LLVM creates invalid binaries on Windows sometimes.
4963 // See https://github.com/zig-lang/zig/issues/508
4964 // As a workaround we do not use target native features on Windows.
4965 if (g->zig_target.os == ZigLLVM_Win32) {
4966 target_specific_cpu_args = "";
4967 target_specific_features = "";
4968 } else {
4969 target_specific_cpu_args = ZigLLVMGetHostCPUName();
4970 target_specific_features = ZigLLVMGetNativeFeatures();
4971 }
49644972 } else {
49654973 target_specific_cpu_args = "";
49664974 target_specific_features = "";