@@ -746,8 +746,8 @@ Syntax::
746
746
<global | constant> <Type> [<InitializerConstant>]
747
747
[, section "name"] [, partition "name"]
748
748
[, comdat [($name)]] [, align <Alignment>]
749
- [, no_sanitize ] [, no_sanitize_address ]
750
- [, no_sanitize_hwaddress ] [, sanitize_address_dyninit ]
749
+ [, no_sanitize_address ] [, no_sanitize_hwaddress ]
750
+ [, sanitize_address_dyninit ] [, sanitize_memtag ]
751
751
(, !name !N)*
752
752
753
753
For example, the following defines a global in a numbered address space
@@ -2327,19 +2327,31 @@ Attributes may be set to communicate additional information about a global varia
2327
2327
Unlike :ref:`function attributes <fnattrs>`, attributes on a global variable
2328
2328
are grouped into a single :ref:`attribute group <attrgrp>`.
2329
2329
2330
- ``no_sanitize``
2331
- This attribute indicates that the global variable should not have any
2332
- sanitizers applied to it, either because it was in the sanitizer ignore
2333
- list, or it was annotated with
2334
- `__attribute__((disable_sanitizer_instrumentation))`.
2335
2330
``no_sanitize_address``
2336
2331
This attribute indicates that the global variable should not have
2337
2332
AddressSanitizer instrumentation applied to it, because it was annotated
2338
- with `__attribute__((no_sanitize("address")))`.
2333
+ with `__attribute__((no_sanitize("address")))`,
2334
+ `__attribute__((disable_sanitizer_instrumentation))`, or included in the
2335
+ `-fsanitize-ignorelist` file.
2339
2336
``no_sanitize_hwaddress``
2340
2337
This attribute indicates that the global variable should not have
2341
2338
HWAddressSanitizer instrumentation applied to it, because it was annotated
2342
- with `__attribute__((no_sanitize("hwaddress")))`.
2339
+ with `__attribute__((no_sanitize("hwaddress")))`,
2340
+ `__attribute__((disable_sanitizer_instrumentation))`, or included in the
2341
+ `-fsanitize-ignorelist` file.
2342
+ ``sanitize_memtag``
2343
+ This attribute indicates that the global variable should have AArch64 memory
2344
+ tags (MTE) instrumentation applied to it. This attribute causes the
2345
+ suppression of certain optimisations, like GlobalMerge, as well as ensuring
2346
+ extra directives are emitted in the assembly and extra bits of metadata are
2347
+ placed in the object file so that the linker can ensure the accesses are
2348
+ protected by MTE. This attribute is added by clang when
2349
+ `-fsanitize=memtag-globals` is provided, as long as the global is not marked
2350
+ with `__attribute__((no_sanitize("memtag")))`,
2351
+ `__attribute__((disable_sanitizer_instrumentation))`, or included in the
2352
+ `-fsanitize-ignorelist` file. The AArch64 Globals Tagging pass may remove
2353
+ this attribute when it's not possible to tag the global (e.g. it's a TLS
2354
+ variable).
2343
2355
``sanitize_address_dyninit``
2344
2356
This attribute indicates that the global variable, when instrumented with
2345
2357
AddressSanitizer, should be checked for ODR violations. This attribute is
0 commit comments