[llvm] [WIP][CFI][LTO] Avoid duplicate symbols on aliased weak function (PR #150072)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 10:36:04 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>

Problem is that LowerTypeTests expects that only one
definition will be left by LTO for a symbol.

However, thanks to strong alias, weak non-prevaling
definition can be preserved.

So strong and weak function definition will be renamed to strong .cfi,
making them duplicate.

Fixes #<!-- -->150070.


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


1 Files Affected:

- (modified) llvm/lib/Transforms/IPO/LowerTypeTests.cpp (-1) 


``````````diff
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index 486205c8a3848..71f827dd87086 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1135,7 +1135,6 @@ void LowerTypeTestsModule::importFunction(
   } else {
     F->setName(Name + ".cfi");
     maybeReplaceComdat(F, Name);
-    F->setLinkage(GlobalValue::ExternalLinkage);
     FDecl = Function::Create(F->getFunctionType(), GlobalValue::ExternalLinkage,
                              F->getAddressSpace(), Name, &M);
     FDecl->setVisibility(Visibility);

``````````

</details>


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


More information about the llvm-commits mailing list