[PATCH] D118948: [MTE] Add -fsanitize=memtag* and friends.

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 8 22:34:56 PST 2022

MaskRay added inline comments.

Comment at: lld/ELF/Driver.cpp:690
+    if (config->memtagStack || config->memtagHeap)
+      error("When using --memtag-stack or --memtag-heap, a --memtag-mode value "
+            "is required.");
lld uses the diagnostic format specified by https://llvm.org/docs/CodingStandards.html#error-and-warning-messages

Please see other `error` and `warn` messages. No capitalization. No trailing perioid.

Comment at: lld/ELF/Options.td:728
+// remap the stack as PROT_MTE.
+defm memtag_stack: B<"memtag-stack",
+    "Instruct the dynamic loader to prepare for MTE stack instrumentation", "">;
`B`/`Eq` is for legacy options which accept single-dash forms. Newer options should use `BB` and `EEq`.

Comment at: lld/ELF/SyntheticSections.h:1195
+      : SyntheticSection(llvm::ELF::SHF_ALLOC, llvm::ELF::SHT_NOTE,
+                         /* alignment */ 4, ".note.android.memtag") {}
+  void writeTo(uint8_t *buf) override;
MaskRay wrote:
> `/*alignment=*/4`
no space after `/*`

Comment at: lld/test/ELF/aarch64-memtag-android-abi.s:3
+# Old versions of Android (Android 11 & 12) have very strict parsing logic on
+# the layout of the ELF note. This test serves as a "hey, you're going to break
In lld and llvm binary utilities, we use `##` for non-RUN-non-CHECK comments.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list