Skip to content

Commit ba92028

Browse files
authored
Merge pull request #7489 from hughbe/codemodel-64bit
Change the generated code model to Large on Windows 64 bit
2 parents b729f4c + 1f3ff2c commit ba92028

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/IRGen/IRGen.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,11 @@ swift::createTargetMachine(IRGenOptions &Opts, ASTContext &Ctx) {
499499

500500
// Create a target machine.
501501
auto cmodel = CodeModel::Default;
502-
if (Triple.isWindowsCygwinEnvironment())
502+
503+
// On Windows 64 bit, dlls are loaded above the max address for 32 bits.
504+
// This means that a default CodeModel causes generated code to segfault
505+
// when run.
506+
if (Triple.isArch64Bit() && Triple.isOSWindows())
503507
cmodel = CodeModel::Large;
504508

505509
llvm::TargetMachine *TargetMachine =

0 commit comments

Comments
 (0)