[PATCH] D133392: [MTE] Add AArch64GlobalsTagging Pass

Mitch Phillips via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 18:05:54 PDT 2022


hctim created this revision.
hctim added reviewers: fmayer, eugenis.
Herald added subscribers: hiraditya, kristof.beyls, mgorny.
Herald added a project: All.
hctim requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Adds the IR pass to tag global variables. You can see the official ABI
proposal at https://github.com/ARM-software/abi-aa/pull/166.

This pass very simply goes over the taggable global variables, re-sizes
and re-aligns them so that they're matched up to the tag granule size
(16 bytes), and marks them as tagged. This allows the backend to create
relocations and put them into a special section.

Global merge must be suppressed for tagged globals, as each global
variable must have a unique tag. This can possibly be relaxed in future;
globals that are identical in size, alignment, and content can
possibly be merged. The major problem comes from tail- or head-merging.

In addition, make sure that tagged globals in object files have
referenced symtab entries for relocations. This is necessary for the
linker to know where a tag should come from, as there's some special
dynamic relocation logic that applies
(https://github.com/ARM-software/abi-aa/blob/64458f8608b69536880501caced7c95a10a49d24/memtagabielf64/memtagabielf64.rst#extended-semantics-of-r-aarch64-relative)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133392

Files:
  clang/test/CodeGen/memtag-globals-asm.cpp
  llvm/lib/CodeGen/GlobalMerge.cpp
  llvm/lib/MC/ELFObjectWriter.cpp
  llvm/lib/Target/AArch64/AArch64.h
  llvm/lib/Target/AArch64/AArch64GlobalsTagging.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/AArch64/CMakeLists.txt
  llvm/test/CodeGen/AArch64/O0-pipeline.ll
  llvm/test/CodeGen/AArch64/O3-pipeline.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133392.458338.patch
Type: text/x-patch
Size: 22557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220907/04ef65b0/attachment-0001.bin>


More information about the cfe-commits mailing list