[PATCH] D128958: Add assembler plumbing for sanitize_memtag

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 13:31:07 PDT 2022


hctim added inline comments.


================
Comment at: llvm/lib/MC/ELFObjectWriter.cpp:1087
 
+  MCSectionELF *MemtagRelocs = nullptr;
+  for (const MCSymbol &Sym : Asm.symbols()) {
----------------
MaskRay wrote:
> The chunk of code doesn't belong here. See `finalizeCGProfile`
I've moved it into a member function, but unlike `finalizeCGProfile`, we're not writing out a section here, we're only adding a set of relocations (and a special section to hold them). Our section has no bytes, just a set of relocations that reference it.

I don't see any other reasonable places to add this "add some relocations" pass (apart from in the ELFWriter c'tor).


================
Comment at: llvm/test/CodeGen/AArch64/global-tagging.ll:6
+
+; RUN: obj2yaml %t.o > %t.yaml
+; RUN: FileCheck %s --input-file=%t.yaml --check-prefix=CHECK-YAML
----------------
MaskRay wrote:
> Check `D107949` how I add yaml2obj/obj2yaml/llvm-readobj/llvm-objdump. You can use that as the first patch, and llvm-mc support as the second.
`yaml2obj/obj2yaml/llvm-readelf/llvm-objdump` here aren't actually being updated (I've removed an ELF note reservation from previous patchsets), they're just being used to check that the `.memtag` directive forces a relocation. I don't think testing each tool is necessary.


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