1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-21 18:22:53 +01:00

X86: Fix/workaround Small Code Model for JIT

Force RIP-relative jump tables and global values
These things were causing crashes due to use of absolute addressing
This commit is contained in:
Nekotekina 2018-05-12 13:46:20 +03:00
parent 8edd96e498
commit d18817ded9

View File

@ -2451,7 +2451,7 @@ const MCExpr *X86TargetLowering::
getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI,
MCContext &Ctx) const {
// X86-64 uses RIP relative addressing based on the jump table label.
if (Subtarget.isPICStyleRIPRel())
if (Subtarget.isPICStyleRIPRel() || Subtarget.is64Bit())
return TargetLowering::getPICJumpTableRelocBaseExpr(MF, JTI, Ctx);
// Otherwise, the reference is relative to the PIC base.
@ -19206,7 +19206,7 @@ unsigned X86TargetLowering::getGlobalWrapperKind(
return X86ISD::Wrapper;
CodeModel::Model M = getTargetMachine().getCodeModel();
if (Subtarget.isPICStyleRIPRel() &&
if ((Subtarget.isPICStyleRIPRel() || Subtarget.is64Bit()) &&
(M == CodeModel::Small || M == CodeModel::Kernel))
return X86ISD::WrapperRIP;