[scudo] Mark ARM64 as supported platform

Authored by vitalybuka on Sun, Apr 25, 12:21 AM.


[scudo] Mark ARM64 as supported platform


vitalybukaSun, Apr 25, 3:47 PM
rG51b4a7ef52aa: [sanitizer] Use COMPILER_RT_EMULATOR with gtests

Event Timeline

DavidSpickett added a subscriber: DavidSpickett.EditedTue, May 4, 3:00 AM

@vitalybuka This has broken our aarch64 bot: https://reviews.llvm.org/rG98a7563261ffae7466bbc49c684fd38c4b54ee7e

(apologies for the reporting delay)

In file included from /home/tcwg-buildslave/worker/clang-cmake-aarch64-lld/llvm/compiler-rt/lib/scudo/standalone/combined.h:17:
/home/tcwg-buildslave/worker/clang-cmake-aarch64-lld/llvm/compiler-rt/lib/scudo/standalone/memtag.h:128:1: error: unknown architectural extension: memtag
        .arch_extension memtag
<inline asm>:2:25: note: instantiated into assembly here
        .arch_extension memtag
In file included from /home/tcwg-buildslave/worker/clang-cmake-aarch64-lld/llvm/compiler-rt/lib/scudo/standalone/wrappers_c.cpp:14:
In file included from /home/tcwg-buildslave/worker/clang-cmake-aarch64-lld/llvm/compiler-rt/lib/scudo/standalone/allocator_config.h:12:
In file included from /home/tcwg-buildslave/worker/clang-cmake-aarch64-lld/llvm/compiler-rt/lib/scudo/standalone/combined.h:17:
/home/tcwg-buildslave/worker/clang-cmake-aarch64-lld/llvm/compiler-rt/lib/scudo/standalone/memtag.h:129:1: error: expected writable system register or pstate
        msr tco, %0
<inline asm>:3:13: note: instantiated into assembly here
        msr tco

I presume this is because we are doing a native build on v8.2 (I think) hardware, so v8.5-a extensions won't be available even just for compiling into a binary. Unless -march=armv8.5-a is used.

There is a preprocessor def we could use __ARM_FEATURE_MEMORY_TAGGING (https://developer.arm.com/documentation/101028/0010/Memory-tagging-intrinsics) but I'm just looking at this now, so perhaps some form of conditional include/compile is already being done.

My mistake, you can use .arch_extension regardless of the compiler flags. What's going on is that memtag was added as an alias only in clang 12.x where previously mte was the only thing accepted.


Our clang-cmake-aarch64-full bot uses gcc-9, and gcc has always called MTE memtag so it works fine there.

https://compiler-rt.llvm.org/ doesn't give a minimum clang version but implies that you'd first build clang from source then use that to build compiler-rt?

Point being I can update this bot to use 12.x, but I'm not sure if you want this code to be able to compile on earlier versions of clang? We'd need to #ifdef between .arch_extension mte and .arch_extension memtag which probably isn't worth it in the end.

I've updated the relevant bots to use the Clang 12 release and this issue is now fixed. (bots are still red for other reasons)