[PATCH] D127933: [clang] Don't emit IFUNC when targeting Fuchsia

Alex Brachet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 16 08:38:59 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf4f6adc451a2: [clang] Don't emit IFUNC when targeting Fuchsia (authored by abrachet).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127933/new/

https://reviews.llvm.org/D127933

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/test/CodeGen/attr-target-mv-va-args.c


Index: clang/test/CodeGen/attr-target-mv-va-args.c
===================================================================
--- clang/test/CodeGen/attr-target-mv-va-args.c
+++ 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, ...)
Index: clang/include/clang/Basic/TargetInfo.h
===================================================================
--- clang/include/clang/Basic/TargetInfo.h
+++ 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127933.437554.patch
Type: text/x-patch
Size: 3499 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220616/6fffd474/attachment.bin>


More information about the cfe-commits mailing list