mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +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:
parent
8edd96e498
commit
d18817ded9
@ -2451,7 +2451,7 @@ const MCExpr *X86TargetLowering::
|
|||||||
getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI,
|
getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI,
|
||||||
MCContext &Ctx) const {
|
MCContext &Ctx) const {
|
||||||
// X86-64 uses RIP relative addressing based on the jump table label.
|
// 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);
|
return TargetLowering::getPICJumpTableRelocBaseExpr(MF, JTI, Ctx);
|
||||||
|
|
||||||
// Otherwise, the reference is relative to the PIC base.
|
// Otherwise, the reference is relative to the PIC base.
|
||||||
@ -19206,7 +19206,7 @@ unsigned X86TargetLowering::getGlobalWrapperKind(
|
|||||||
return X86ISD::Wrapper;
|
return X86ISD::Wrapper;
|
||||||
|
|
||||||
CodeModel::Model M = getTargetMachine().getCodeModel();
|
CodeModel::Model M = getTargetMachine().getCodeModel();
|
||||||
if (Subtarget.isPICStyleRIPRel() &&
|
if ((Subtarget.isPICStyleRIPRel() || Subtarget.is64Bit()) &&
|
||||||
(M == CodeModel::Small || M == CodeModel::Kernel))
|
(M == CodeModel::Small || M == CodeModel::Kernel))
|
||||||
return X86ISD::WrapperRIP;
|
return X86ISD::WrapperRIP;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user