[llvm-branch-commits] [llvm] release/23.x: [LTO] Handle GlobalIFunc in LTOModule::parseSymbols (#212515) (PR #213063)

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jul 30 23:58:14 PDT 2026


https://github.com/tru updated https://github.com/llvm/llvm-project/pull/213063

>From b7d8db9ddee73288463108b46aa29871fa95a482 Mon Sep 17 00:00:00 2001
From: Marina Taylor <marina_taylor at apple.com>
Date: Wed, 29 Jul 2026 15:04:19 +0100
Subject: [PATCH] [LTO] Handle GlobalIFunc in LTOModule::parseSymbols (#212515)

Avoids the assert immediately below.

Fixes #45694

rdar://182744700
(cherry picked from commit a463071dc427777a2a2bfc155c6680d7ff220994)
---
 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-branch-commits mailing list