diff options
author | Martin Storsjö <martin@martin.st> | 2019-12-19 14:00:44 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2019-12-23 12:13:49 +0200 |
commit | 5a751e747dbf2c267e944aa961e21de7a815e7eb (patch) | |
tree | 70b2949c61174ec9ca34e943a5cbd319dafd3346 /llvm/lib/Target/AArch64/AArch64Subtarget.cpp | |
parent | b774aa1011a031b225624277178382bb2db7e26a (diff) | |
download | bcm5719-llvm-5a751e747dbf2c267e944aa961e21de7a815e7eb.tar.gz bcm5719-llvm-5a751e747dbf2c267e944aa961e21de7a815e7eb.zip |
[AArch64] [Windows] Use COFF stubs for calls to extern_weak functions
As the extern_weak target might be missing, resolving to the absolute
address zero, we can't use the normal direct PC-relative branch
instructions (as that would result in relocations out of range).
Improve the classifyGlobalFunctionReference method to set
MO_DLLIMPORT/MO_COFFSTUB, and simplify the existing code in
AArch64TargetLowering::LowerCall to use the return value from
classifyGlobalFunctionReference for these cases.
Add code in both AArch64FastISel and GlobalISel/IRTranslator to
bail out for function calls to extern weak functions on windows,
to let SelectionDAG handle them.
This matches what was done for X86 in 6bf108d77a3c.
Differential Revision: https://reviews.llvm.org/D71721
Diffstat (limited to 'llvm/lib/Target/AArch64/AArch64Subtarget.cpp')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64Subtarget.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp index 8e131b0caa6..931f0c0ffb8 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp @@ -251,6 +251,10 @@ unsigned AArch64Subtarget::classifyGlobalFunctionReference( !TM.shouldAssumeDSOLocal(*GV->getParent(), GV)) return AArch64II::MO_GOT; + // Use ClassifyGlobalReference for setting MO_DLLIMPORT/MO_COFFSTUB. + if (getTargetTriple().isOSWindows()) + return ClassifyGlobalReference(GV, TM); + return AArch64II::MO_NO_FLAG; } |