aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-09-30 15:47:46 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-09-30 15:47:46 -0400
commit588d2862d90b65b7227975ecd3c8dfdaabbdefc6 (patch)
tree7ba99ae80d726532d951078165a1d5a825ee54e9 /src
parent845f22101b1efb2d8898d8ba7310cd78151a42d5 (diff)
downloadzig-588d2862d90b65b7227975ecd3c8dfdaabbdefc6.tar.gz
zig-588d2862d90b65b7227975ecd3c8dfdaabbdefc6.zip
workaround for invalid binary created on windows
when target native features are used. See #508
Diffstat (limited to 'src')
-rw-r--r--src/codegen.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 5498647758..3860dab0b6 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -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 = "";