diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -1355,7 +1355,9 @@ bool supportsMultiVersioning() const { return getTriple().isX86(); } /// Identify whether this target supports IFuncs. - bool supportsIFunc() const { return getTriple().isOSBinFormatELF(); } + bool supportsIFunc() const { + return getTriple().isOSBinFormatELF() && !getTriple().isOSFuchsia(); + } // Validate the contents of the __builtin_cpu_supports(const char*) // argument. diff --git a/clang/test/CodeGen/attr-target-mv-va-args.c b/clang/test/CodeGen/attr-target-mv-va-args.c --- a/clang/test/CodeGen/attr-target-mv-va-args.c +++ b/clang/test/CodeGen/attr-target-mv-va-args.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX -// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefixes=NO-IFUNC,WINDOWS +// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s --check-prefixes=NO-IFUNC,FUCHSIA int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; } int __attribute__((target("arch=sandybridge"))) foo(int i, ...); int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;} @@ -27,19 +28,21 @@ // LINUX: ret i32 (i32, ...)* @foo // LINUX: declare i32 @foo.arch_sandybridge(i32 noundef, ...) -// WINDOWS: define dso_local i32 @foo.sse4.2(i32 noundef %i, ...) -// WINDOWS: ret i32 0 -// WINDOWS: define dso_local i32 @foo.arch_ivybridge(i32 noundef %i, ...) -// WINDOWS: ret i32 1 -// WINDOWS: define dso_local i32 @foo(i32 noundef %i, ...) -// WINDOWS: ret i32 2 -// WINDOWS: define dso_local i32 @bar() -// WINDOWS: call i32 (i32, ...) @foo.resolver(i32 noundef 1, i32 noundef 97, double -// WINDOWS: call i32 (i32, ...) @foo.resolver(i32 noundef 2, double noundef 2.2{{[0-9Ee+]+}}, i8* noundef getelementptr inbounds +// NO-IFUNC: define dso_local i32 @foo.sse4.2(i32 noundef %i, ...) +// NO-IFUNC: ret i32 0 +// NO-IFUNC: define dso_local i32 @foo.arch_ivybridge(i32 noundef %i, ...) +// NO-IFUNC: ret i32 1 +// NO-IFUNC: define dso_local i32 @foo(i32 noundef %i, ...) +// NO-IFUNC: ret i32 2 +// NO-IFUNC: define dso_local i32 @bar() +// NO-IFUNC: call i32 (i32, ...) @foo.resolver(i32 noundef 1, i32 noundef 97, double +// NO-IFUNC: call i32 (i32, ...) @foo.resolver(i32 noundef 2, double noundef 2.2{{[0-9Ee+]+}}, i8* noundef getelementptr inbounds // WINDOWS: define weak_odr dso_local i32 @foo.resolver(i32 %0, ...) comdat -// WINDOWS: musttail call i32 (i32, ...) @foo.arch_sandybridge -// WINDOWS: musttail call i32 (i32, ...) @foo.arch_ivybridge -// WINDOWS: musttail call i32 (i32, ...) @foo.sse4.2 -// WINDOWS: musttail call i32 (i32, ...) @foo +// FUCHSIA: define weak_odr i32 @foo.resolver(i32 %0, ...) comdat +// NO-IFUNC: musttail call i32 (i32, ...) @foo.arch_sandybridge +// NO-IFUNC: musttail call i32 (i32, ...) @foo.arch_ivybridge +// NO-IFUNC: musttail call i32 (i32, ...) @foo.sse4.2 +// NO-IFUNC: musttail call i32 (i32, ...) @foo // WINDOWS: declare dso_local i32 @foo.arch_sandybridge(i32 noundef, ...) +// FUCHSIA: declare i32 @foo.arch_sandybridge(i32 noundef, ...)