[llvm] [llvm][docs] MemTagSanitizer is only supported on AArch64 Android (PR #120545)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 02:06:39 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: David Spickett (DavidSpickett)

<details>
<summary>Changes</summary>

```
$ ./bin/clang /tmp/test.c -o /tmp/test.o -target aarch64-linux -march=armv8+memtag -fsanitize=memtag-stack
clang: error: unsupported option '-fsanitize=memtag*' for target 'aarch64-unknown-linux'
```
But this works:
```
$ ./bin/clang /tmp/test.c -o /tmp/test.o -target aarch64-linux-android -march=armv8+memtag -fsanitize=memtag-stack
```

Due to this check in Clang:
https://github.com/llvm/llvm-project/blob/2210da3b823ccf21fc634c858827c9f12c864b51/clang/lib/Driver/ToolChains/CommonArgs.cpp#L1651

Likely because the required notes and dynamic loader support only exist for Android.

You can get around this, sort of, by not linking the file. However this means you have to provide your own way of loading it, so it doesn't change the statement that this feature is Android only.

https://github.com/llvm/llvm-project/issues/64692 also confirms that the intent is to only support Android at this time.

---
Full diff: https://github.com/llvm/llvm-project/pull/120545.diff


1 Files Affected:

- (modified) llvm/docs/MemTagSanitizer.rst (+2-2) 


``````````diff
diff --git a/llvm/docs/MemTagSanitizer.rst b/llvm/docs/MemTagSanitizer.rst
index 62efbfb041cbd0..44d261bec028f9 100644
--- a/llvm/docs/MemTagSanitizer.rst
+++ b/llvm/docs/MemTagSanitizer.rst
@@ -29,9 +29,9 @@ Usage
 =====
 
 Compile and link your program with ``-fsanitize=memtag`` flag. This
-will only work when targeting AArch64 with MemTag extension. One
+will only work when targeting AArch64 Android with MemTag extension. One
 possible way to achieve that is to add ``-target
-aarch64-linux -march=armv8+memtag`` to compilation flags.
+aarch64-linux-android -march=armv8+memtag`` to compilation flags.
 
 Implementation
 ==============

``````````

</details>


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


More information about the llvm-commits mailing list