Skip to content

Commit 8af9b14

Browse files
grynspanxedin
authored andcommitted
Only touch the MetadataSections::swift5_runtime_attributes field in newer structures
1 parent 43904e5 commit 8af9b14

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

stdlib/public/runtime/ImageInspectionCommon.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ void swift_addNewDSOImage(swift::MetadataSections *sections) {
129129
swift::addImageAccessibleFunctionsBlockCallback(
130130
baseAddress, functions, accessible_funcs_section.length);
131131

132-
const auto &runtime_attribs_section = sections->swift5_runtime_attributes;
133-
const void *functions =
134-
reinterpret_cast<void *>(runtime_attribs_section.start);
135-
if (runtime_attribs_section.length)
136-
swift::addImageRuntimeAttributesBlockCallback(
137-
baseAddress, functions, runtime_attribs_section.length);
132+
if (sections->version >= 3) {
133+
const auto &runtime_attribs_section = sections->swift5_runtime_attributes;
134+
const void *functions =
135+
reinterpret_cast<void *>(runtime_attribs_section.start);
136+
if (runtime_attribs_section.length)
137+
swift::addImageRuntimeAttributesBlockCallback(
138+
baseAddress, functions, runtime_attribs_section.length);
139+
}
138140

139141
// Register this section for future enumeration by clients. This should occur
140142
// after this function has done all other relevant work to avoid a race

0 commit comments

Comments
 (0)