[PATCH] D128958: Add assembler plumbing for sanitize_memtag

Florian Mayer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 14:20:42 PST 2022


fmayer added inline comments.


================
Comment at: llvm/lib/MC/ELFObjectWriter.cpp:622
+      assert(MemtagRelocs != nullptr &&
+             "Tagged globals are only supported on AArch64");
+      Asm.registerSection(*MemtagRelocs);
----------------
Is the story here that on non-AArch64, this function gets run, but there will be no SymE.isMemtag()?


================
Comment at: llvm/lib/MC/ELFObjectWriter.cpp:1334-1341
+  // For memory-tagged symbols, ensure that the relocation uses the symbol. For
+  // tagged symbols, we emit an empty relocation (R_AARCH64_NONE) in a special
+  // section (SHT_AARCH64_MEMTAG_GLOBALS_STATIC) to indicate to the linker that
+  // this global needs to be tagged. In addition, the linker needs to know
+  // whether to emit a special addend when relocating `end` symbols, and this
+  // can only be determined by the attributes of the symbol itself.
+  if (Sym->isMemtag())
----------------
move this after the assert for `Sym`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128958/new/

https://reviews.llvm.org/D128958



More information about the llvm-commits mailing list