This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] [Windows] Use COFF stubs for calls to extern_weak functions
ClosedPublic

Authored by mstorsjo on Dec 19 2019, 11:16 AM.

Details

Summary

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.

Diff Detail

Event Timeline

mstorsjo created this revision.Dec 19 2019, 11:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2019, 11:16 AM
This revision is now accepted and ready to land.Dec 19 2019, 11:28 AM
rnk accepted this revision.Dec 22 2019, 7:31 PM

lgtm

This revision was automatically updated to reflect the committed changes.