[llvm] [LTO] Handle GlobalIFunc in LTOModule::parseSymbols (PR #212515)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 08:14:42 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lto

Author: Marina Taylor (citymarina)

<details>
<summary>Changes</summary>

Avoids the assert immediately below.

Fixes #<!-- -->45694

rdar://182744700

---
Full diff: https://github.com/llvm/llvm-project/pull/212515.diff


2 Files Affected:

- (modified) llvm/lib/LTO/LTOModule.cpp (+1-1) 
- (added) llvm/test/LTO/X86/ifunc.ll (+18) 


``````````diff
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index e821abb6f65bc..c7c44d09b593c 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -611,7 +611,7 @@ void LTOModule::parseSymbols() {
       continue;
     }
 
-    if (getTargetTriple().isOSBinFormatXCOFF() && isa<GlobalIFunc>(GV)) {
+    if (isa<GlobalIFunc>(GV)) {
       addDefinedFunctionSymbol(Sym);
       continue;
     }
diff --git a/llvm/test/LTO/X86/ifunc.ll b/llvm/test/LTO/X86/ifunc.ll
new file mode 100644
index 0000000000000..b0076e1f410e9
--- /dev/null
+++ b/llvm/test/LTO/X86/ifunc.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s >%t1
+; RUN: llvm-lto -o %t2 %t1
+
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+ at f2 = dso_local alias void (), void ()* @f
+ at f = dso_local ifunc void (), bitcast (i8* ()* @f_ifunc to void ()*)
+
+define internal i8* @f_ifunc() {
+entry:
+  ret i8* bitcast (void ()* @f_impl to i8*)
+}
+
+define internal void @f_impl() {
+entry:
+  ret void
+}

``````````

</details>


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


More information about the llvm-commits mailing list