[llvm-branch-commits] Add pointer field protection feature. (PR #133538)
Peter Collingbourne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed May 14 22:25:30 PDT 2025
================
@@ -7756,6 +7756,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.addOptInFlag(CmdArgs, options::OPT_funique_source_file_names,
options::OPT_fno_unique_source_file_names);
+ if (!IsCudaDevice)
----------------
pcc wrote:
With CUDA the driver creates two compilation jobs, one for the host and one for the device. Since it is an ABI requirement that all C++ translation units are built with the same `-fexperimental-pointer-field-protection` flags, the flag must be passed when compiling the CUDA translation units as well, so that the host side is built correctly. And since GPUs don't support PFP, we need to exclude the flag from the CUDA device job. It looks like the same ends up happening for PAuth ABI because the flags are copied in `Clang::AddAArch64TargetArgs`, which means that they are ignored for the CUDA device which will have a different architecture.
If someone did end up implementing PFP for GPUs, I think we would create a separate flag to enable PFP for the device.
https://github.com/llvm/llvm-project/pull/133538
More information about the llvm-branch-commits
mailing list