Skip to content

Commit 9159f87

Browse files
authored
Merge pull request #61322 from CodaFi/whats-in-a-name
Work Around _swiftStaticArrayMetadata Alias Breakage
2 parents 448c411 + ba3e67b commit 9159f87

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

lib/IRGen/GenConstant.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,11 @@ llvm::Constant *irgen::emitConstantObject(IRGenModule &IGM, ObjectInst *OI,
288288
IGM.swiftImmortalRefCount = var;
289289
}
290290
if (!IGM.swiftStaticArrayMetadata) {
291+
// HACK: This should be an alias to this symbol rather than a direct
292+
// reference.
291293
auto *var = new llvm::GlobalVariable(IGM.Module, IGM.TypeMetadataStructTy,
292294
/*constant*/ true, llvm::GlobalValue::ExternalLinkage,
293-
/*initializer*/ nullptr, "_swiftStaticArrayMetadata");
295+
/*initializer*/ nullptr, "$ss19__EmptyArrayStorageCN");
294296
IGM.swiftStaticArrayMetadata = var;
295297
}
296298
elts[0] = llvm::ConstantStruct::get(ObjectHeaderTy, {

stdlib/public/stubs/GlobalObjects.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ __asm__(" .globl __swiftImmortalRefCount\n");
8585
#error("unsupported pointer width")
8686
#endif
8787

88-
// Static arrays can only contain trivial elements. Therefore we can reuse
89-
// the metadata of the empty array buffer. The important thing is that its
90-
// deinit is a no-op and does not actually destroy any elements.
91-
__asm__(" .globl __swiftStaticArrayMetadata\n");
92-
__asm__(".set __swiftStaticArrayMetadata, _$ss19__EmptyArrayStorageCN\n");
93-
9488
#endif
9589

9690
SWIFT_RUNTIME_STDLIB_API

0 commit comments

Comments
 (0)