[clang] [PAC][clang] Fix ptrauth module flags behavior (PR #204226)

Anatoly Trosinenko via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 3 08:11:18 PDT 2026


https://github.com/atrosinenko requested changes to this pull request.

Oh, I just realized that we have to check that the backend understands the new-style module flags. Previously, it was technically possible to use them like `if (M.getModuleFlag("...")) { ... }` without actually checking the value to be non-zero (or to be exactly `1`)! This may possibly apply to LLD as well.

Thankfully, the backend (at least the mainline one) seems to check the actual values everywhere. Though, such behavior is only seems to be explicitly tested for the ``ptrauth-elf-got"` flag. Furthermore, the `"aarch64-elf-pauthabi-(platform|version)"`flags are frequently tested for "present vs. absent" (validation that if one of these two flags is set, both should be) - for such tests, zero value seems to be equivalent to the "absent" case (is it?).

Considering auto-upgrading the old modules, we probably have nothing better than keep treating an absent flag as having the value zero: IIRC the module is not required to contain a target triple, so we cannot decide whether the missing flag should be set to zero or kept absent. If so, I would explicitly mention such behavior in a comment somewhere. But note that this makes use of the fortunate behavior of the mainline backend and might not hold for some downstream users.

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


More information about the cfe-commits mailing list