diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h index 9480e7b36dc2c..b9fbe2b02e22c 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -769,7 +769,7 @@ class Triple { bool isOSGlibc() const { return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD || getOS() == Triple::Hurd) && - !isAndroid() && !isMusl(); + !isAndroid() && !isMusl() && getEnvironment() != Triple::PAuthTest; } /// Tests whether the OS is AIX. diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp index 87256352faccd..8c5e90e1a6b06 100644 --- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp +++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -2438,11 +2438,9 @@ static bool targetSupportsIRelativeRelocation(const Triple &TT) { if (!TT.isOSBinFormatELF()) return false; - // musl doesn't support IFUNCs. - if (TT.isMusl()) - return false; - - return true; + // IFUNCs are supported on glibc, bionic, and some but not all of the BSDs. + return TT.isOSGlibc() || TT.isAndroid() || TT.isOSFreeBSD() || + TT.isOSDragonFly() || TT.isOSNetBSD(); } // Emit an ifunc resolver that returns a signed pointer to the specified target, diff --git a/llvm/test/CodeGen/AArch64/ptrauth-reloc.ll b/llvm/test/CodeGen/AArch64/ptrauth-reloc.ll index f2d080644e93e..b546fe4ed8279 100644 --- a/llvm/test/CodeGen/AArch64/ptrauth-reloc.ll +++ b/llvm/test/CodeGen/AArch64/ptrauth-reloc.ll @@ -4,13 +4,13 @@ ; RUN: llc < ok.ll -mtriple arm64e-apple-darwin \ ; RUN: | FileCheck %s --check-prefix=CHECK-MACHO -; RUN: llc < ok.ll -mtriple aarch64-elf -mattr=+pauth \ +; RUN: llc < ok.ll -mtriple aarch64-android -mattr=+pauth \ ; RUN: | FileCheck %s --check-prefix=CHECK-ELF ; RUN: llc < ok.ll -mtriple arm64e-apple-darwin \ ; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-MACHO -; RUN: llc < ok.ll -mtriple aarch64-elf -mattr=+pauth \ +; RUN: llc < ok.ll -mtriple aarch64-android -mattr=+pauth \ ; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ELF @@ -141,13 +141,13 @@ ; RUN: not llc < err-key.ll -mtriple arm64e-apple-darwin 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-KEY -; RUN: not llc < err-key.ll -mtriple aarch64-elf -mattr=+pauth 2>&1 \ +; RUN: not llc < err-key.ll -mtriple aarch64-android -mattr=+pauth 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-KEY ; RUN: not llc < err-key.ll -mtriple arm64e-apple-darwin \ ; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-KEY -; RUN: not llc < err-key.ll -mtriple aarch64-elf -mattr=+pauth \ +; RUN: not llc < err-key.ll -mtriple aarch64-android -mattr=+pauth \ ; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-KEY @@ -161,13 +161,13 @@ ; RUN: not llc < err-disc.ll -mtriple arm64e-apple-darwin 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC -; RUN: not llc < err-disc.ll -mtriple aarch64-elf -mattr=+pauth 2>&1 \ +; RUN: not llc < err-disc.ll -mtriple aarch64-android -mattr=+pauth 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC ; RUN: not llc < err-disc.ll -mtriple arm64e-apple-darwin \ ; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC -; RUN: not llc < err-disc.ll -mtriple aarch64-elf -mattr=+pauth \ +; RUN: not llc < err-disc.ll -mtriple aarch64-android -mattr=+pauth \ ; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC @@ -178,9 +178,9 @@ ;--- err-disc-elf.ll -; RUN: not llc < err-disc-elf.ll -mtriple aarch64-elf -mattr=+pauth 2>&1 \ +; RUN: not llc < err-disc-elf.ll -mtriple aarch64-android -mattr=+pauth 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC-ELF -; RUN: not llc < err-disc-elf.ll -mtriple aarch64-elf -mattr=+pauth \ +; RUN: not llc < err-disc-elf.ll -mtriple aarch64-android -mattr=+pauth \ ; RUN: -global-isel -verify-machineinstrs -global-isel-abort=1 2>&1 \ ; RUN: | FileCheck %s --check-prefix=CHECK-ERR-DISC-ELF