[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 llvm-commits llvm-commits at lists.llvm.org
Thu Feb 19 13:19:25 PST 2026


================
@@ -298,6 +298,12 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalObject *GO,
   // If the global is marked constant, we can put it into a mergable section,
   // a mergable string section, or general .data if it contains relocations.
   if (GVar->isConstant()) {
+    if (GVar->hasSanitizerMetadata()) {
+      auto Meta = GVar->getSanitizerMetadata();
----------------
fmayer wrote:

as above

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


More information about the llvm-commits mailing list