Skip to content

Commit

Permalink
Revert "Default to the medium code model in x86 linux (#53391)"
Browse files Browse the repository at this point in the history
This reverts commit 7536f35.
  • Loading branch information
KristofferC committed Apr 16, 2024
1 parent b05a4f2 commit 5cf5146
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "platform.h"

// target support
#include "llvm/Support/CodeGen.h"
#include <llvm/ADT/Triple.h>
#include <llvm/ADT/Statistic.h>
#include <llvm/Analysis/TargetLibraryInfo.h>
Expand Down Expand Up @@ -1505,11 +1504,10 @@ void jl_dump_native_impl(void *native_code,
if (TheTriple.isOSLinux() || TheTriple.isOSFreeBSD()) {
RelocModel = Reloc::PIC_;
}

CodeModel::Model CMModel = CodeModel::Small;
if (TheTriple.isPPC() || (TheTriple.isX86() && TheTriple.isArch64Bit() && TheTriple.isOSLinux())) {
// On PPC the small model is limited to 16bit offsets. For very large images the small code model
CMModel = CodeModel::Medium; // isn't good enough on x86 so use Medium, it has no cost because only the image goes in .ldata
if (TheTriple.isPPC()) {
// On PPC the small model is limited to 16bit offsets
CMModel = CodeModel::Medium;
}
std::unique_ptr<TargetMachine> SourceTM(
jl_ExecutionEngine->getTarget().createTargetMachine(
Expand Down Expand Up @@ -1549,12 +1547,6 @@ void jl_dump_native_impl(void *native_code,
GlobalVariable::ExternalLinkage,
data, "jl_system_image_data");
sysdata->setAlignment(Align(64));
#if JL_LLVM_VERSION >= 180000
sysdata->setCodeModel(CodeModel::Large);
#else
if (TheTriple.isX86() && TheTriple.isArch64Bit() && TheTriple.isOSLinux())
sysdata->setSection(".ldata");
#endif
addComdat(sysdata, TheTriple);
Constant *len = ConstantInt::get(sysimgM.getDataLayout().getIntPtrType(Context), z->size);
addComdat(new GlobalVariable(sysimgM, len->getType(), true,
Expand Down

0 comments on commit 5cf5146

Please sign in to comment.