[PATCH] D71721: [AArch64] [Windows] Use COFF stubs for calls to extern_weak functions

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 11:22:45 PST 2019


mstorsjo created this revision.
mstorsjo added reviewers: rnk, smeenai, paquette.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71721

Files:
  llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
  llvm/lib/Target/AArch64/AArch64FastISel.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call-weak.ll
  llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll
  llvm/test/CodeGen/AArch64/windows-extern-weak.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71721.234756.patch
Type: text/x-patch
Size: 6279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191219/a49f53f9/attachment.bin>


More information about the llvm-commits mailing list