[clang] [llvm] [CodeGen][AArch64][FMV] PAC the stub_helper's frame on arm64e (PR #84704)

Jon Roelofs via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 14:37:49 PDT 2024


jroelofs wrote:

> > Can the triple checks be generalized to checking about pauth-enabled subtarget feature? This way everything would work for ELF platforms eventually.

These are admittedly a bit of a hack, since we don't have a Function to look at the attributes on when we're in that part of the AsmPrinter. But that said, the ones in the AsmPrinter are all Mach-O-specific (they "manually" implement what the dynamic linker would do on an ELF platform), so generalizing them won't help ELF platforms.

> 
> @asl Since I'm not sure how particularly ifuncs should be handled, here are two answers for two different cases.
> 
> If we need just to check that pauth target feature is enabled, we can use `TM.getTargetFeatureString()` and see if it contains `+pauth`.
> 
> If the ifunc-related behavior is dependent on `-fptrauth-calls` (implicitly enabled on apple arm64e) and should not be enabled when, say, only `-fptrauth-returns` is used (in both cases the target feature string contains `+pauth`), on ELF we can add a check against (platform,version) tuple defining the ABI after #85236 is merged.

The change to add the default attributes should cover whether the resolver gets `-fptrauth-returns`.

For `-fptrauth-calls` on the other hand you will need some cooperation with the dynamic linker on ELF targets, since on those platforms you'll need to coordinate with the implementation of `.type global_ifunc, at gnu_indirect_function` to decide whether the resolver should sign the returned pointer and with what key.

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


More information about the cfe-commits mailing list