Skip to content

Commit

Permalink
Set code model to Large for PowerPC64 (aka ppc64le)
Browse files Browse the repository at this point in the history
This is needed because TOC and text sections can be more than 2GB
apart. LLVM SectionMemoryManager is not aware of the design limits of
ppc64le while allocating memory for JIT'ed sections. DSO limit was set
to 2GB by design. While running CMSSW ROOT/Cling puts TOC and .text.func
~2.7GB apart in VA space. Usually was triggered by TFormula in CMSSW.

IBM has modified global entry function prologue. TOC is now stored in
64-bit value before global entry to allow addressing beyond 2GB.
This was merged to Clang months ago, but is only applicable to large
code model.

Later IBM propagated this further:

- binutils patches are here:
https://sourceware.org/ml/binutils/2015-11/msg00232.html
https://sourceware.org/ml/binutils/2015-11/msg00233.html
and will be available with binutils 2.26

- GCC patch is here:
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00355.html
and will be available with GCC 6.0.

- LLVM patch is here:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160111/324454.html
and will be available with LLVM 3.8.

- Kernel patches (module loader etc.) are here:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=a61674bdfc7c2bf909c4010699607b62b69b7bec
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2e50c4bef77511b42cc226865d6bc568fa7f8769
and will be available with Linux 4.5.

Signed-off-by: David Abdurachmanov <[email protected]>
  • Loading branch information
David Abdurachmanov authored and Axel-Naumann committed Nov 7, 2016
1 parent 46cf799 commit 7be783b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ std::unique_ptr<TargetMachine>
std::string FeaturesStr;

TargetOptions Options = TargetOptions();
// We have to use large code model for PowerPC64 because TOC and text sections
// can be more than 2GB apart.
#if defined(__powerpc64__) || defined(__PPC64__)
CodeModel::Model CMModel = CodeModel::Large;
#else
CodeModel::Model CMModel = CodeModel::JITDefault;
#endif
CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
switch (CGOpt.OptimizationLevel) {
case 0: OptLevel = CodeGenOpt::None; break;
Expand Down

0 comments on commit 7be783b

Please sign in to comment.