[clang] [llvm] [PowerPC] Support -fpatchable-function-entry (PR #92997)
    Maryam Moghadas via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu May 23 14:36:21 PDT 2024
    
    
  
maryammo wrote:
In `PPCTargetMachine::PPCABI computeTargetABI` it specifies the ABI  with this 
```
switch (TT.getArch()) {
 case Triple::ppc64le:
  return PPCTargetMachine::PPC_ABI_ELFv2;
 case Triple::ppc64:
  if (TT.isPPC64ELFv2ABI())
   return PPCTargetMachine::PPC_ABI_ELFv2;
  else
   return PPCTargetMachine::PPC_ABI_ELFv1;
 default:
  return PPCTargetMachine::PPC_ABI_UNKNOWN;
 }
```
`isPPC64ELFv2ABI()`  is defined as 
```
/// Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
 bool isPPC64ELFv2ABI() const {
  return (getArch() == Triple::ppc64 &&
      ((getOS() == Triple::FreeBSD &&
       (getOSMajorVersion() >= 13 || getOSVersion().empty())) ||
       getOS() == Triple::OpenBSD || isMusl()));
 }
```
So PPC64 uses ELFv2 for Triple::OpenBSD. We probably want to  diagnose this OS for PC64, since with ELFv2 we might emit separate local  and global entry points which means only certain values can be passed to -fpatchable-function-entry option. 
https://github.com/llvm/llvm-project/pull/92997
    
    
More information about the llvm-commits
mailing list