tmatheson-arm wrote:

Thanks @AtariDreams for pointing that out. They do both seem to be "8.5 without 
BTI". I had a look at what current versions of clang/llvm do in this regard:

Current builds of clang set `__ARM_FEATURE_BTI` for these processors:
```
$ clang-19 ~/hello.c --target=aarch64 -march=armv8.4-a -E -dM -o - | rg 
__ARM_FEATURE_BTI

$ clang-19 ~/hello.c --target=aarch64 -march=armv8.5-a -E -dM -o - | rg 
__ARM_FEATURE_BTI
#define __ARM_FEATURE_BTI 1

$ clang-19 ~/hello.c --target=aarch64 -mcpu=apple-a14 -E -dM -o - | rg 
__ARM_FEATURE_BTI
#define __ARM_FEATURE_BTI 1

$ clang-19 ~/hello.c --target=aarch64 -mcpu=apple-m1 -E -dM -o - | rg 
__ARM_FEATURE_BTI
#define __ARM_FEATURE_BTI 1
```

They will also disassemble BTI instructions (rather than outputting "hint"):
```
$ clang-19 ~/hello.c --target=aarch64 -march=armv8.4-a -S -o - 
-mbranch-protection=pac-ret+bti | rg '(bti|hint)'
        hint    #34
$ clang-19 ~/hello.c --target=aarch64 -march=armv8.5-a -S -o - 
-mbranch-protection=pac-ret+bti | rg '(bti|hint)'
        bti     c
$ clang-19 ~/hello.c --target=aarch64 -mcpu=apple-a14 -S -o - 
-mbranch-protection=pac-ret+bti | rg '(bti|hint)'
        bti     c
$ clang-19 ~/hello.c --target=aarch64 -mcpu=apple-m1 -S -o - 
-mbranch-protection=pac-ret+bti | rg '(bti|hint)'
        bti     c
```

I don't think either of those is correct. Unfortunately in the backend we can't 
model negative features, so the best thing to do might be to model them as 
`armv8.4-a` and manually add all of the `8.5-a` `SubtargetFeature`s except for 
BTI. I have updated the PR to do that.

https://github.com/llvm/llvm-project/pull/92600
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to