Skip to content

Commit 8ab7956

Browse files
committed
IRGen: do not use the Large Code Model on Win64
The large code model is not necessary. Large Address Aware should be sufficient for dealing with the higher address ranges. Using the large code model breaks the DLL storage semantics on Windows. With this we are able to build most of the standard library for all variants of Windows. Addresses SR-6150!
1 parent 88c5441 commit 8ab7956

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

lib/IRGen/IRGen.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -544,17 +544,9 @@ swift::createTargetMachine(IRGenOptions &Opts, ASTContext &Ctx) {
544544
}
545545

546546
// Create a target machine.
547-
auto cmodel = CodeModel::Default;
548-
549-
// On Windows 64 bit, dlls are loaded above the max address for 32 bits.
550-
// This means that a default CodeModel causes generated code to segfault
551-
// when run.
552-
if (Triple.isArch64Bit() && Triple.isOSWindows())
553-
cmodel = CodeModel::Large;
554-
555547
llvm::TargetMachine *TargetMachine =
556548
Target->createTargetMachine(Triple.str(), CPU, targetFeatures, TargetOpts,
557-
Reloc::PIC_, cmodel, OptLevel);
549+
Reloc::PIC_, CodeModel::Default, OptLevel);
558550
if (!TargetMachine) {
559551
Ctx.Diags.diagnose(SourceLoc(), diag::no_llvm_target,
560552
Triple.str(), "no LLVM target machine");

0 commit comments

Comments
 (0)