Skip to content

Commit 7096092

Browse files
committed
Fix layering violation I introduced by putting _EmptyBoxStorage into the stubs library (#10373)
* Fix layering violation I introduced by putting _EmptyBoxStorage into the stubs library Should fix the linkage issue on linux
1 parent ab583fd commit 7096092

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

stdlib/public/SwiftShims/GlobalObjects.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,6 @@ struct _SwiftHashingSecretKey _swift_stdlib_Hashing_secretKey;
8888
SWIFT_RUNTIME_STDLIB_INTERFACE
8989
__swift_uint64_t _swift_stdlib_HashingDetail_fixedSeedOverride;
9090

91-
struct _SwiftEmptyBoxStorage {
92-
struct HeapObject header;
93-
};
94-
95-
SWIFT_RUNTIME_STDLIB_INTERFACE
96-
struct _SwiftEmptyBoxStorage _EmptyBoxStorage;
97-
9891
#ifdef __cplusplus
9992

10093
static_assert(std::is_pod<_SwiftEmptyArrayStorage>::value,

stdlib/public/runtime/HeapObject.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,24 @@ OpaqueValue *swift::swift_projectBox(HeapObject *o) {
228228
return metadata->project(o);
229229
}
230230

231+
namespace { // Begin anonymous namespace.
232+
233+
struct _SwiftEmptyBoxStorage {
234+
HeapObject header;
235+
};
236+
237+
swift::HeapLocalVariableMetadata _emptyBoxStorageMetadata;
238+
239+
/// The singleton empty box storage object.
240+
_SwiftEmptyBoxStorage _EmptyBoxStorage = {
241+
// HeapObject header;
242+
{
243+
&_emptyBoxStorageMetadata,
244+
}
245+
};
246+
247+
} // End anonymous namespace.
248+
231249
HeapObject *swift::swift_allocEmptyBox() {
232250
auto heapObject = reinterpret_cast<HeapObject*>(&_EmptyBoxStorage);
233251
SWIFT_RT_ENTRY_CALL(swift_retain)(heapObject);

stdlib/public/stubs/GlobalObjects.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,6 @@ void swift::_swift_instantiateInertHeapObject(void *address,
127127
::new (address) HeapObject{metadata};
128128
}
129129

130-
swift::HeapLocalVariableMetadata _emptyBoxStorageMetadata;
131-
132-
/// The signleton empty box storage object.
133-
swift::_SwiftEmptyBoxStorage swift::_EmptyBoxStorage = {
134-
// HeapObject header;
135-
{
136-
&_emptyBoxStorageMetadata,
137-
}
138-
};
139-
140-
141130
namespace llvm { namespace hashing { namespace detail {
142131
// An extern variable expected by LLVM's hashing templates. We don't link any
143132
// LLVM libs into the runtime, so define this here.

0 commit comments

Comments
 (0)