Skip to content

Commit 8c668ba

Browse files
committed
[Runtime] Rename the segment for protocol conformance records.
The format of protocol conformance records will be changing in Swift 5, so rename the segment (from, e.g., __swift2_proto to __swift5_proto) to allow Swift < 5 and Swift 5+ runtimes to coexist.
1 parent 5307f5d commit 8c668ba

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,13 +2385,13 @@ llvm::Constant *IRGenModule::emitProtocolConformances() {
23852385
StringRef sectionName;
23862386
switch (TargetInfo.OutputObjectFormat) {
23872387
case llvm::Triple::MachO:
2388-
sectionName = "__TEXT, __swift2_proto, regular, no_dead_strip";
2388+
sectionName = "__TEXT, __swift5_proto, regular, no_dead_strip";
23892389
break;
23902390
case llvm::Triple::ELF:
2391-
sectionName = "swift2_protocol_conformances";
2391+
sectionName = "swift5_protocol_conformances";
23922392
break;
23932393
case llvm::Triple::COFF:
2394-
sectionName = ".sw2prtc$B";
2394+
sectionName = ".sw5prtc$B";
23952395
break;
23962396
default:
23972397
llvm_unreachable("Don't know how to emit protocol conformances for "

stdlib/public/runtime/ImageInspectionCOFF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void swift::initializeProtocolConformanceLookup() {
4141
const swift::MetadataSections *sections = registered;
4242
while (true) {
4343
const swift::MetadataSections::Range &conformances =
44-
sections->swift2_protocol_conformances;
44+
sections->swift5_protocol_conformances;
4545
if (conformances.length)
4646
addImageProtocolConformanceBlockCallback(reinterpret_cast<void *>(conformances.start),
4747
conformances.length);
@@ -74,7 +74,7 @@ void swift_addNewDSOImage(const void *addr) {
7474

7575
record(sections);
7676

77-
const auto &protocol_conformances = sections->swift2_protocol_conformances;
77+
const auto &protocol_conformances = sections->swift5_protocol_conformances;
7878
const void *conformances =
7979
reinterpret_cast<void *>(protocol_conformances.start);
8080
if (protocol_conformances.length)

stdlib/public/runtime/ImageInspectionCOFF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct MetadataSections {
4545
size_t length;
4646
};
4747

48-
Range swift2_protocol_conformances;
48+
Range swift5_protocol_conformances;
4949
Range swift2_type_metadata;
5050
Range swift3_typeref;
5151
Range swift3_reflstr;

stdlib/public/runtime/ImageInspectionELF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void swift::initializeProtocolConformanceLookup() {
4646
const swift::MetadataSections *sections = registered;
4747
while (true) {
4848
const swift::MetadataSections::Range &conformances =
49-
sections->swift2_protocol_conformances;
49+
sections->swift5_protocol_conformances;
5050
if (conformances.length)
5151
addImageProtocolConformanceBlockCallback(reinterpret_cast<void *>(conformances.start),
5252
conformances.length);
@@ -83,7 +83,7 @@ void swift_addNewDSOImage(const void *addr) {
8383

8484
record(sections);
8585

86-
const auto &protocol_conformances = sections->swift2_protocol_conformances;
86+
const auto &protocol_conformances = sections->swift5_protocol_conformances;
8787
const void *conformances =
8888
reinterpret_cast<void *>(protocol_conformances.start);
8989
if (protocol_conformances.length)

stdlib/public/runtime/ImageInspectionELF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct MetadataSections {
4545
size_t length;
4646
};
4747

48-
Range swift2_protocol_conformances;
48+
Range swift5_protocol_conformances;
4949
Range swift2_type_metadata;
5050
Range swift3_typeref;
5151
Range swift3_reflstr;

stdlib/public/runtime/ImageInspectionMachO.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ using namespace swift;
3131
namespace {
3232
/// The Mach-O section name for the section containing protocol conformances.
3333
/// This lives within SEG_TEXT.
34-
constexpr const char ProtocolConformancesSection[] = "__swift2_proto";
34+
constexpr const char ProtocolConformancesSection[] = "__swift5_proto";
3535
/// The Mach-O section name for the section containing type references.
3636
/// This lives within SEG_TEXT.
3737
constexpr const char TypeMetadataRecordSection[] = "__swift2_types";
@@ -46,7 +46,7 @@ void addImageCallback(const mach_header *mh, intptr_t vmaddr_slide) {
4646
using mach_header_platform = mach_header;
4747
#endif
4848

49-
// Look for a __swift2_proto section.
49+
// Look for a __swift5_proto section.
5050
unsigned long size;
5151
const uint8_t *section =
5252
getsectiondata(reinterpret_cast<const mach_header_platform *>(mh),

stdlib/public/runtime/SwiftRT-ELF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
__attribute__((__visibility__("hidden"))) extern const char __stop_##name;
2525

2626
extern "C" {
27-
DECLARE_SWIFT_SECTION(swift2_protocol_conformances)
27+
DECLARE_SWIFT_SECTION(swift5_protocol_conformances)
2828
DECLARE_SWIFT_SECTION(swift2_type_metadata)
2929

3030
DECLARE_SWIFT_SECTION(swift3_typeref)
@@ -52,7 +52,7 @@ static void swift_image_constructor() {
5252
nullptr,
5353
nullptr,
5454

55-
SWIFT_SECTION_RANGE(swift2_protocol_conformances),
55+
SWIFT_SECTION_RANGE(swift5_protocol_conformances),
5656
SWIFT_SECTION_RANGE(swift2_type_metadata),
5757

5858
SWIFT_SECTION_RANGE(swift3_typeref),

0 commit comments

Comments
 (0)