[clang] [llvm] [MTE] Add an attribute to opt-in memory tagging of global variables while using fsanitize=memtag-globals (#166380) (PR #182028)

Florian Mayer via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 19 13:19:24 PST 2026


================
@@ -3667,6 +3667,19 @@ full list of supported sanitizer flags.
   }];
 }
 
+def ForceMemtagDocs : Documentation {
+  let Category = DocCatVariable;
+  let Content = [{
+Use the ``force_memtag`` attribute on a global variable declaration that also
+has the attribute section. If the memory tag sanitizer is active, will force
+the global variable to be MTE tagged. Global variables under sections are not
+tagged by default, so you need to explicitly opt-in using this attribute.
+Please note that, unfortunately, in non-trivial cases where memory layout
----------------
fmayer wrote:

I would drop the "unfortunately" 

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


More information about the cfe-commits mailing list