[clang] [lld] [lld][ELF][clang][MTE] Add -z memtag-{mode, heap, stack} (PR #188205)

Elia Geretto via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 24 03:12:47 PDT 2026


EliaGeretto wrote:

@MaskRay @fmayer @pcc please review this PR, it supersedes:
- #187055 (single commit, lld + clang)
- #188028 (split 1, lld part)
- #188038 (split 2, clang part)

I am aware we have switched PRs quite a few times and lost the review history as a consequence. To try to ease your review, I'll provide a quick summary. This PR is basically the same as #187055 with a few white lines removed, as requested by @MaskRay. The diff is the following:

```diff
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index a6914616b888..f7f880ae9bc7 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -632,7 +632,6 @@ static ZicfissPolicy getZZicfiss(Ctx &ctx, opt::InputArgList &args) {
 
 static int getZMemtagMode(Ctx &ctx, opt::InputArgList &args) {
   auto ret = ELF::NT_MEMTAG_LEVEL_NONE;
-
   for (auto *arg : args.filtered(OPT_z)) {
     std::pair<StringRef, StringRef> kv = StringRef(arg->getValue()).split('=');
     if (kv.first == "memtag-mode") {
@@ -647,7 +646,6 @@ static int getZMemtagMode(Ctx &ctx, opt::InputArgList &args) {
         ErrAlways(ctx) << "unknown -z memtag-mode= value: " << kv.second;
     }
   }
-
   return ret;
 }
 
@@ -879,7 +877,6 @@ static int getMemtagMode(Ctx &ctx, opt::InputArgList &args) {
       Warn(ctx) << "-z memtag-mode is none, leaving "
                    "--android-memtag-note a no-op";
   }
-
   return memtagMode;
 }
 
```

Unfortunately, I could not reopen #187055 because I had modified the branch to create the split PRs and GitHub does not like that. The situation in #187055 was that @fmayer had approved the changes and that @MaskRay had requested the whitespace changes, but given a general LGTM to the code.

Thank you for your patience.

https://github.com/llvm/llvm-project/pull/188205


More information about the cfe-commits mailing list