From 72b3a8d8e54d72a9a571f5643ca101e1c2bfb633 Mon Sep 17 00:00:00 2001 From: Aidan Hall Date: Fri, 12 Dec 2025 17:19:24 +0000 Subject: [PATCH] Create closure destructors with internal linkage This makes these symbols visible in backtraces, at the cost of binary size. The long-term goal is to generate these functions with LinkOnceODRLinkage, using the contents of the HeapLayout to produce a mangled name, so they can be deduplicated across modules. rdar://149084103 --- lib/IRGen/GenHeap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/IRGen/GenHeap.cpp b/lib/IRGen/GenHeap.cpp index 111077347f1c0..0425d87918d40 100644 --- a/lib/IRGen/GenHeap.cpp +++ b/lib/IRGen/GenHeap.cpp @@ -427,7 +427,7 @@ static llvm::Function *createDtorFn(IRGenModule &IGM, const HeapLayout &layout) { llvm::Function *fn = llvm::Function::Create(IGM.DeallocatingDtorTy, - llvm::Function::PrivateLinkage, + llvm::Function::InternalLinkage, "objectdestroy", &IGM.Module); auto attrs = IGM.constructInitialAttributes(); IGM.addSwiftSelfAttributes(attrs, 0);