ojhunt wrote:

> No, ptrauth is not a feature, it is an extension and should be reported as 
> such. The real bug here is that you're missing an extension warning when 
> __ptrauth is used: https://godbolt.org/z/4Mb8f4W94
> 
> That code needs to issue an extension warning.

That means all code targeting arm64e/armv8.3 would produce this warning. 
Pointer authentication is platform ABI, so this warning would be present in 
_every_ build (if nothing else due to system headers) and as a result would be 
disabled anyway, rendering it moot.

Then because `-pedantic-errors` now breaks the platform ABI, using that flag 
would be required to be a compile time error.

I understand that the semantics of `__has_extension` might better match the 
mental model of the `__ptrauth` qualifier on platforms that do not support 
pointer auth, but on platforms where it is part of the abi it is not an 
extension, it's a core part of the platform and can *never* be ignored.

The ODR violation argument doesn't really help: by virtue of breaking the 
ability to detect support for the qualifier code cannot match the ABI without 
requiring an external check followed by a macro define that they can test on 
instead, but that is not an option for the ABI definitions as a system headers 
can't rely on that, so -pedantic-errors breaks the ABI and causes ODR 
violations.

i.e by requiring the ptrauth qualifier be an extension:

* All code on these platforms will produce a "you're using an extension" 
warning, so either it gets a separate warning from the standard extension 
warning, which would then be disabled on all code (realistically it would be 
implicitly disabled for these targets), or the general "you are using an 
extension warning" would have to be disabled.
* When targeting platforms with pointer authentication attempting to use 
`-pedantic-errors` (or any other flag impacting the behavior of 
__has_extension) would be a hard error at compile time.

That would be the behavior in the llvm.org tree, every platform that supports 
pointer auth would in all likelihood patch this into a feature to avoid these 
problems: breaking code that uses -pedantic-errors isn't acceptable, and 
neither is producing warnings in all code targeting that platform, especially 
given those warnings would quite literally be a warning about the target: user 
chooses to target a platform that requires pointer authentication, code 
compiles and produces a warning that they are targeting a platform that uses 
pointer authentication. All code compiling with -Werror then also needs to add 
-Wno-<warning name> to disable the warning that they are compiling to the 
target they have chosen to target.

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

Reply via email to