Skip to content

Commit

Permalink
Fix Win32-specific breakage in top-of-tree LLVM (#6581)
Browse files Browse the repository at this point in the history
(Second attempt at this; first version was landed and rolled back because the LLVM change was rolled back)
  • Loading branch information
steven-johnson authored Jan 25, 2022
1 parent 5f0da26 commit 2008f7c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/LLVM_Runtime_Linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,21 @@ llvm::DataLayout get_data_layout_for_target(Target target) {
return llvm::DataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:128-n8:16:32-S128");
} else if (target.os == Target::IOS) {
return llvm::DataLayout("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:128-n8:16:32-S128");
} else if (target.os == Target::Windows && !target.has_feature(Target::JIT)) {
return llvm::DataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32");
} else if (target.os == Target::Windows) {
return llvm::DataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32");
#if LLVM_VERSION >= 140
// For 32-bit MSVC targets, alignment of f80 values is 16 bytes (see https://reviews.llvm.org/D115942)
if (!target.has_feature(Target::JIT)) {
return llvm::DataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-a:0:32-S32");
} else {
return llvm::DataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-a:0:32-S32");
}
#else
if (!target.has_feature(Target::JIT)) {
return llvm::DataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32");
} else {
return llvm::DataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32");
}
#endif
} else {
// Linux/Android
return llvm::DataLayout("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128");
Expand Down

0 comments on commit 2008f7c

Please sign in to comment.