mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
X86: Disable IsLegalToCallImmediateAddr for Win32
WinCOFF cannot form PC relative relocations to support absolute MCValues. We should reenable this once WinCOFF supports emission of IMAGE_REL_I386_REL32 relocations. This fixes PR19272. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205058 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8a21cb2433
commit
f3e8b0575d
@ -165,7 +165,10 @@ bool X86Subtarget::hasSinCos() const {
|
||||
/// IsLegalToCallImmediateAddr - Return true if the subtarget allows calls
|
||||
/// to immediate address.
|
||||
bool X86Subtarget::IsLegalToCallImmediateAddr(const TargetMachine &TM) const {
|
||||
if (In64BitMode)
|
||||
// FIXME: I386 PE/COFF supports PC relative calls using IMAGE_REL_I386_REL32
|
||||
// but WinCOFFObjectWriter::RecordRelocation cannot emit them. Once it does,
|
||||
// the following check for Win32 should be removed.
|
||||
if (In64BitMode || isTargetWin32())
|
||||
return false;
|
||||
return isTargetELF() || TM.getRelocationModel() == Reloc::Static;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
; RUN: llc < %s -mtriple=i386-apple-darwin -relocation-model=static | FileCheck -check-prefix X86STA %s
|
||||
; RUN: llc < %s -mtriple=i386-apple-darwin -relocation-model=pic | FileCheck -check-prefix X86PIC %s
|
||||
; RUN: llc < %s -mtriple=i386-pc-linux -relocation-model=dynamic-no-pic | FileCheck -check-prefix X86DYN %s
|
||||
; RUN: llc < %s -mtriple=i386-pc-win32 -relocation-model=static | FileCheck -check-prefix X86WINSTA %s
|
||||
|
||||
; Call to immediate is not safe on x86-64 unless we *know* that the
|
||||
; call will be within 32-bits pcrel from the dest immediate.
|
||||
@ -20,4 +21,5 @@ entry:
|
||||
; X86STA: {{call.*12345678}}
|
||||
; X86PIC-NOT: {{call.*12345678}}
|
||||
; X86DYN: {{call.*12345678}}
|
||||
; X86WINSTA: {{call.*[*]%eax}}
|
||||
; X64: {{call.*[*]%rax}}
|
||||
|
Loading…
Reference in New Issue
Block a user