This is an archive of the discontinued LLVM Phabricator instance.

[x86] Implement a tagged-globals backend feature.
ClosedPublic

Authored by morehouse on Oct 7 2021, 12:32 PM.

Details

Summary

The feature tells the backend to allow tags in the upper bits of global
variable addresses. These tags will be ignored by upcoming CPUs with
the Intel LAM feature but may be used in instrumentation passes (e.g.,
HWASan).

This patch implements the feature by using @GOTPCREL relocations instead
of direct references to the locally defined global. Thus the full
tagged address can be loaded by a single instruction:

movq global@GOTPCREL(%rip), %rax

Diff Detail

Event Timeline

morehouse created this revision.Oct 7 2021, 12:32 PM
morehouse requested review of this revision.Oct 7 2021, 12:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2021, 12:32 PM
morehouse added a project: Restricted Project.Oct 7 2021, 12:33 PM
eugenis accepted this revision.Oct 7 2021, 2:18 PM

LGTM

This also needs the -mrelax-relocations=no flag to work correctly, right?

This revision is now accepted and ready to land.Oct 7 2021, 2:18 PM
morehouse updated this revision to Diff 378017.Oct 7 2021, 2:50 PM
  • Clarify that -mrelax-relocations=no is required.
morehouse updated this revision to Diff 378019.Oct 7 2021, 2:51 PM
  • Fix diffbase.

This also needs the -mrelax-relocations=no flag to work correctly, right?

Yes, updated the feature description to state this.

This revision was automatically updated to reflect the committed changes.