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

Marina Taylor via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 08:13:39 PDT 2026


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

Avoids the assert immediately below.

Fixes #45694

rdar://182744700

>From a0b4fc49bfa21864181f18b0e1d280baa851e039 Mon Sep 17 00:00:00 2001
From: Marina Taylor <marina_taylor at apple.com>
Date: Tue, 28 Jul 2026 16:06:22 +0100
Subject: [PATCH] [LTO] Handle GlobalIFunc in LTOModule::parseSymbols

Avoids the assert immediately below.

Fixes #45694

rdar://182744700
---
 llvm/lib/LTO/LTOModule.cpp |  2 +-
 llvm/test/LTO/X86/ifunc.ll | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/LTO/X86/ifunc.ll

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
+}



More information about the llvm-commits mailing list