This is an archive of the discontinued LLVM Phabricator instance.

Don't assume a null GV is local for ELF and MachO
ClosedPublic

Authored by espindola on Jan 17 2018, 6:53 PM.

Details

Summary

This is already a simplification, and should help with avoiding a plt reference when calling an intrinsic with -fno-plt.

With this change we return false for null GVs, so caller only needs to check the new metadata to decide if it should use foo@plt or *foo@got.

Diff Detail

Event Timeline

espindola created this revision.Jan 17 2018, 6:53 PM
davide accepted this revision.Jan 17 2018, 10:49 PM
davide added a subscriber: davide.

LGTM (I also tested this on Mac). Haven't checked on ELF.

This revision is now accepted and ready to land.Jan 17 2018, 10:49 PM
rnk added inline comments.Jan 18 2018, 2:15 PM
llvm/lib/Target/TargetMachine.cpp
140

Do we ever synthesize references to globals? Those will need a GOT reference if the global turns out to be non-local.

davide closed this revision.Jan 23 2018, 6:22 PM