mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Rename swift sections from swift4 to swift5
rdar://38465220
This commit is contained in:
@@ -148,14 +148,14 @@ public:
|
|||||||
|
|
||||||
// The docs say "not all sections may be present." We'll succeed if ANY of
|
// The docs say "not all sections may be present." We'll succeed if ANY of
|
||||||
// them are present. Not sure if that's the right thing to do.
|
// them are present. Not sure if that's the right thing to do.
|
||||||
auto FieldMd = findSection<FieldSection>(Header, "__swift4_fieldmd");
|
auto FieldMd = findSection<FieldSection>(Header, "__swift5_fieldmd");
|
||||||
auto AssocTyMd =
|
auto AssocTyMd =
|
||||||
findSection<AssociatedTypeSection>(Header, "__swift4_assocty");
|
findSection<AssociatedTypeSection>(Header, "__swift5_assocty");
|
||||||
auto BuiltinTyMd =
|
auto BuiltinTyMd =
|
||||||
findSection<BuiltinTypeSection>(Header, "__swift4_builtin");
|
findSection<BuiltinTypeSection>(Header, "__swift5_builtin");
|
||||||
auto CaptureMd = findSection<CaptureSection>(Header, "__swift4_capture");
|
auto CaptureMd = findSection<CaptureSection>(Header, "__swift5_capture");
|
||||||
auto TyperefMd = findSection<GenericSection>(Header, "__swift4_typeref");
|
auto TyperefMd = findSection<GenericSection>(Header, "__swift5_typeref");
|
||||||
auto ReflStrMd = findSection<GenericSection>(Header, "__swift4_reflstr");
|
auto ReflStrMd = findSection<GenericSection>(Header, "__swift5_reflstr");
|
||||||
|
|
||||||
bool success = FieldMd.second || AssocTyMd.second || BuiltinTyMd.second ||
|
bool success = FieldMd.second || AssocTyMd.second || BuiltinTyMd.second ||
|
||||||
CaptureMd.second || TyperefMd.second || ReflStrMd.second;
|
CaptureMd.second || TyperefMd.second || ReflStrMd.second;
|
||||||
|
|||||||
@@ -2751,10 +2751,10 @@ llvm::Constant *IRGenModule::emitSwiftProtocols() {
|
|||||||
StringRef sectionName;
|
StringRef sectionName;
|
||||||
switch (TargetInfo.OutputObjectFormat) {
|
switch (TargetInfo.OutputObjectFormat) {
|
||||||
case llvm::Triple::MachO:
|
case llvm::Triple::MachO:
|
||||||
sectionName = "__TEXT, __swift4_protos, regular, no_dead_strip";
|
sectionName = "__TEXT, __swift5_protos, regular, no_dead_strip";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::ELF:
|
case llvm::Triple::ELF:
|
||||||
sectionName = "swift4_protocols";
|
sectionName = "swift5_protocols";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::COFF:
|
case llvm::Triple::COFF:
|
||||||
sectionName = ".sw5prt$B";
|
sectionName = ".sw5prt$B";
|
||||||
@@ -2941,10 +2941,10 @@ llvm::Constant *IRGenModule::emitProtocolConformances() {
|
|||||||
StringRef sectionName;
|
StringRef sectionName;
|
||||||
switch (TargetInfo.OutputObjectFormat) {
|
switch (TargetInfo.OutputObjectFormat) {
|
||||||
case llvm::Triple::MachO:
|
case llvm::Triple::MachO:
|
||||||
sectionName = "__TEXT, __swift4_proto, regular, no_dead_strip";
|
sectionName = "__TEXT, __swift5_proto, regular, no_dead_strip";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::ELF:
|
case llvm::Triple::ELF:
|
||||||
sectionName = "swift4_protocol_conformances";
|
sectionName = "swift5_protocol_conformances";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::COFF:
|
case llvm::Triple::COFF:
|
||||||
sectionName = ".sw5prtc$B";
|
sectionName = ".sw5prtc$B";
|
||||||
@@ -2968,10 +2968,10 @@ llvm::Constant *IRGenModule::emitTypeMetadataRecords() {
|
|||||||
std::string sectionName;
|
std::string sectionName;
|
||||||
switch (TargetInfo.OutputObjectFormat) {
|
switch (TargetInfo.OutputObjectFormat) {
|
||||||
case llvm::Triple::MachO:
|
case llvm::Triple::MachO:
|
||||||
sectionName = "__TEXT, __swift4_types, regular, no_dead_strip";
|
sectionName = "__TEXT, __swift5_types, regular, no_dead_strip";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::ELF:
|
case llvm::Triple::ELF:
|
||||||
sectionName = "swift4_type_metadata";
|
sectionName = "swift5_type_metadata";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::COFF:
|
case llvm::Triple::COFF:
|
||||||
sectionName = ".sw5tymd$B";
|
sectionName = ".sw5tymd$B";
|
||||||
@@ -3035,13 +3035,13 @@ llvm::Constant *IRGenModule::emitFieldDescriptors() {
|
|||||||
std::string sectionName;
|
std::string sectionName;
|
||||||
switch (TargetInfo.OutputObjectFormat) {
|
switch (TargetInfo.OutputObjectFormat) {
|
||||||
case llvm::Triple::MachO:
|
case llvm::Triple::MachO:
|
||||||
sectionName = "__TEXT, __swift4_fieldmd, regular, no_dead_strip";
|
sectionName = "__TEXT, __swift5_fieldmd, regular, no_dead_strip";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::ELF:
|
case llvm::Triple::ELF:
|
||||||
sectionName = "swift4_fieldmd";
|
sectionName = "swift5_fieldmd";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::COFF:
|
case llvm::Triple::COFF:
|
||||||
sectionName = ".swift4_fieldmd";
|
sectionName = ".swift5_fieldmd";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("Don't know how to emit field records table for "
|
llvm_unreachable("Don't know how to emit field records table for "
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ protected:
|
|||||||
|
|
||||||
// Others, such as capture descriptors, do not have a name.
|
// Others, such as capture descriptors, do not have a name.
|
||||||
} else {
|
} else {
|
||||||
var = B.finishAndCreateGlobal("\x01l__swift4_reflection_descriptor",
|
var = B.finishAndCreateGlobal("\x01l__swift5_reflection_descriptor",
|
||||||
Alignment(4), /*isConstant*/ true,
|
Alignment(4), /*isConstant*/ true,
|
||||||
llvm::GlobalValue::PrivateLinkage);
|
llvm::GlobalValue::PrivateLinkage);
|
||||||
}
|
}
|
||||||
@@ -766,12 +766,12 @@ static std::string getReflectionSectionName(IRGenModule &IGM,
|
|||||||
OS << ".sw5" << FourCC << "$B";
|
OS << ".sw5" << FourCC << "$B";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::ELF:
|
case llvm::Triple::ELF:
|
||||||
OS << "swift4_" << LongName;
|
OS << "swift5_" << LongName;
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::MachO:
|
case llvm::Triple::MachO:
|
||||||
assert(LongName.size() <= 7 &&
|
assert(LongName.size() <= 7 &&
|
||||||
"Mach-O section name length must be <= 16 characters");
|
"Mach-O section name length must be <= 16 characters");
|
||||||
OS << "__TEXT,__swift4_" << LongName << ", regular, no_dead_strip";
|
OS << "__TEXT,__swift5_" << LongName << ", regular, no_dead_strip";
|
||||||
break;
|
break;
|
||||||
case llvm::Triple::Wasm:
|
case llvm::Triple::Wasm:
|
||||||
llvm_unreachable("web assembly object format is not supported.");
|
llvm_unreachable("web assembly object format is not supported.");
|
||||||
|
|||||||
@@ -107,12 +107,12 @@ internal func getSectionInfo(_ name: String,
|
|||||||
///
|
///
|
||||||
/// An image of interest must have the following sections in the __DATA
|
/// An image of interest must have the following sections in the __DATA
|
||||||
/// segment:
|
/// segment:
|
||||||
/// - __swift4_fieldmd
|
/// - __swift5_fieldmd
|
||||||
/// - __swift4_assocty
|
/// - __swift5_assocty
|
||||||
/// - __swift4_builtin
|
/// - __swift5_builtin
|
||||||
/// - __swift4_capture
|
/// - __swift5_capture
|
||||||
/// - __swift4_typeref
|
/// - __swift5_typeref
|
||||||
/// - __swift4_reflstr (optional, may have been stripped out)
|
/// - __swift5_reflstr (optional, may have been stripped out)
|
||||||
///
|
///
|
||||||
/// - Parameter i: The index of the loaded image as reported by Dyld.
|
/// - Parameter i: The index of the loaded image as reported by Dyld.
|
||||||
/// - Returns: A `ReflectionInfo` containing the locations of all of the
|
/// - Returns: A `ReflectionInfo` containing the locations of all of the
|
||||||
@@ -123,12 +123,12 @@ internal func getReflectionInfoForImage(atIndex i: UInt32) -> ReflectionInfo? {
|
|||||||
to: UnsafePointer<MachHeader>.self)
|
to: UnsafePointer<MachHeader>.self)
|
||||||
|
|
||||||
let imageName = _dyld_get_image_name(i)!
|
let imageName = _dyld_get_image_name(i)!
|
||||||
let fieldmd = getSectionInfo("__swift4_fieldmd", header)
|
let fieldmd = getSectionInfo("__swift5_fieldmd", header)
|
||||||
let assocty = getSectionInfo("__swift4_assocty", header)
|
let assocty = getSectionInfo("__swift5_assocty", header)
|
||||||
let builtin = getSectionInfo("__swift4_builtin", header)
|
let builtin = getSectionInfo("__swift5_builtin", header)
|
||||||
let capture = getSectionInfo("__swift4_capture", header)
|
let capture = getSectionInfo("__swift5_capture", header)
|
||||||
let typeref = getSectionInfo("__swift4_typeref", header)
|
let typeref = getSectionInfo("__swift5_typeref", header)
|
||||||
let reflstr = getSectionInfo("__swift4_reflstr", header)
|
let reflstr = getSectionInfo("__swift5_reflstr", header)
|
||||||
return ReflectionInfo(imageName: String(validatingUTF8: imageName)!,
|
return ReflectionInfo(imageName: String(validatingUTF8: imageName)!,
|
||||||
fieldmd: fieldmd,
|
fieldmd: fieldmd,
|
||||||
assocty: assocty,
|
assocty: assocty,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void swift::initializeProtocolLookup() {
|
|||||||
const swift::MetadataSections *sections = registered;
|
const swift::MetadataSections *sections = registered;
|
||||||
while (true) {
|
while (true) {
|
||||||
const swift::MetadataSections::Range &protocols =
|
const swift::MetadataSections::Range &protocols =
|
||||||
sections->swift4_protocols;
|
sections->swift5_protocols;
|
||||||
if (protocols.length)
|
if (protocols.length)
|
||||||
addImageProtocolsBlockCallback(reinterpret_cast<void *>(protocols.start),
|
addImageProtocolsBlockCallback(reinterpret_cast<void *>(protocols.start),
|
||||||
protocols.length);
|
protocols.length);
|
||||||
@@ -56,7 +56,7 @@ void swift::initializeProtocolConformanceLookup() {
|
|||||||
const swift::MetadataSections *sections = registered;
|
const swift::MetadataSections *sections = registered;
|
||||||
while (true) {
|
while (true) {
|
||||||
const swift::MetadataSections::Range &conformances =
|
const swift::MetadataSections::Range &conformances =
|
||||||
sections->swift4_protocol_conformances;
|
sections->swift5_protocol_conformances;
|
||||||
if (conformances.length)
|
if (conformances.length)
|
||||||
addImageProtocolConformanceBlockCallback(reinterpret_cast<void *>(conformances.start),
|
addImageProtocolConformanceBlockCallback(reinterpret_cast<void *>(conformances.start),
|
||||||
conformances.length);
|
conformances.length);
|
||||||
@@ -71,7 +71,7 @@ void swift::initializeTypeMetadataRecordLookup() {
|
|||||||
const swift::MetadataSections *sections = registered;
|
const swift::MetadataSections *sections = registered;
|
||||||
while (true) {
|
while (true) {
|
||||||
const swift::MetadataSections::Range &type_metadata =
|
const swift::MetadataSections::Range &type_metadata =
|
||||||
sections->swift4_type_metadata;
|
sections->swift5_type_metadata;
|
||||||
if (type_metadata.length)
|
if (type_metadata.length)
|
||||||
addImageTypeMetadataRecordBlockCallback(reinterpret_cast<void *>(type_metadata.start),
|
addImageTypeMetadataRecordBlockCallback(reinterpret_cast<void *>(type_metadata.start),
|
||||||
type_metadata.length);
|
type_metadata.length);
|
||||||
@@ -85,7 +85,7 @@ void swift::initializeTypeMetadataRecordLookup() {
|
|||||||
void swift::initializeTypeFieldLookup() {
|
void swift::initializeTypeFieldLookup() {
|
||||||
const swift::MetadataSections *sections = registered;
|
const swift::MetadataSections *sections = registered;
|
||||||
while (true) {
|
while (true) {
|
||||||
const swift::MetadataSections::Range &fields = sections->swift4_fieldmd;
|
const swift::MetadataSections::Range &fields = sections->swift5_fieldmd;
|
||||||
if (fields.length)
|
if (fields.length)
|
||||||
addImageTypeFieldDescriptorBlockCallback(
|
addImageTypeFieldDescriptorBlockCallback(
|
||||||
reinterpret_cast<void *>(fields.start), fields.length);
|
reinterpret_cast<void *>(fields.start), fields.length);
|
||||||
@@ -103,20 +103,20 @@ void swift_addNewDSOImage(const void *addr) {
|
|||||||
|
|
||||||
record(sections);
|
record(sections);
|
||||||
|
|
||||||
const auto &protocols_section = sections->swift4_protocols;
|
const auto &protocols_section = sections->swift5_protocols;
|
||||||
const void *protocols =
|
const void *protocols =
|
||||||
reinterpret_cast<void *>(protocols_section.start);
|
reinterpret_cast<void *>(protocols_section.start);
|
||||||
if (protocols_section.length)
|
if (protocols_section.length)
|
||||||
addImageProtocolsBlockCallback(protocols, protocols_section.length);
|
addImageProtocolsBlockCallback(protocols, protocols_section.length);
|
||||||
|
|
||||||
const auto &protocol_conformances = sections->swift4_protocol_conformances;
|
const auto &protocol_conformances = sections->swift5_protocol_conformances;
|
||||||
const void *conformances =
|
const void *conformances =
|
||||||
reinterpret_cast<void *>(protocol_conformances.start);
|
reinterpret_cast<void *>(protocol_conformances.start);
|
||||||
if (protocol_conformances.length)
|
if (protocol_conformances.length)
|
||||||
addImageProtocolConformanceBlockCallback(conformances,
|
addImageProtocolConformanceBlockCallback(conformances,
|
||||||
protocol_conformances.length);
|
protocol_conformances.length);
|
||||||
|
|
||||||
const auto &type_metadata = sections->swift4_type_metadata;
|
const auto &type_metadata = sections->swift5_type_metadata;
|
||||||
const void *metadata = reinterpret_cast<void *>(type_metadata.start);
|
const void *metadata = reinterpret_cast<void *>(type_metadata.start);
|
||||||
if (type_metadata.length)
|
if (type_metadata.length)
|
||||||
addImageTypeMetadataRecordBlockCallback(metadata, type_metadata.length);
|
addImageTypeMetadataRecordBlockCallback(metadata, type_metadata.length);
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ struct MetadataSections {
|
|||||||
size_t length;
|
size_t length;
|
||||||
};
|
};
|
||||||
|
|
||||||
Range swift4_protocols;
|
Range swift5_protocols;
|
||||||
Range swift4_protocol_conformances;
|
Range swift5_protocol_conformances;
|
||||||
Range swift4_type_metadata;
|
Range swift5_type_metadata;
|
||||||
Range swift4_typeref;
|
Range swift5_typeref;
|
||||||
Range swift4_reflstr;
|
Range swift5_reflstr;
|
||||||
Range swift4_fieldmd;
|
Range swift5_fieldmd;
|
||||||
Range swift4_assocty;
|
Range swift5_assocty;
|
||||||
};
|
};
|
||||||
} // namespace swift
|
} // namespace swift
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ void swift::initializeProtocolLookup() {
|
|||||||
const swift::MetadataSections *sections = registered;
|
const swift::MetadataSections *sections = registered;
|
||||||
while (true) {
|
while (true) {
|
||||||
const swift::MetadataSections::Range &protocols =
|
const swift::MetadataSections::Range &protocols =
|
||||||
sections->swift4_protocols;
|
sections->swift5_protocols;
|
||||||
if (protocols.length)
|
if (protocols.length)
|
||||||
addImageProtocolsBlockCallback(reinterpret_cast<void *>(protocols.start),
|
addImageProtocolsBlockCallback(reinterpret_cast<void *>(protocols.start),
|
||||||
protocols.length);
|
protocols.length);
|
||||||
@@ -60,7 +60,7 @@ void swift::initializeProtocolConformanceLookup() {
|
|||||||
const swift::MetadataSections *sections = registered;
|
const swift::MetadataSections *sections = registered;
|
||||||
while (true) {
|
while (true) {
|
||||||
const swift::MetadataSections::Range &conformances =
|
const swift::MetadataSections::Range &conformances =
|
||||||
sections->swift4_protocol_conformances;
|
sections->swift5_protocol_conformances;
|
||||||
if (conformances.length)
|
if (conformances.length)
|
||||||
addImageProtocolConformanceBlockCallback(reinterpret_cast<void *>(conformances.start),
|
addImageProtocolConformanceBlockCallback(reinterpret_cast<void *>(conformances.start),
|
||||||
conformances.length);
|
conformances.length);
|
||||||
@@ -75,7 +75,7 @@ void swift::initializeTypeMetadataRecordLookup() {
|
|||||||
const swift::MetadataSections *sections = registered;
|
const swift::MetadataSections *sections = registered;
|
||||||
while (true) {
|
while (true) {
|
||||||
const swift::MetadataSections::Range &type_metadata =
|
const swift::MetadataSections::Range &type_metadata =
|
||||||
sections->swift4_type_metadata;
|
sections->swift5_type_metadata;
|
||||||
if (type_metadata.length)
|
if (type_metadata.length)
|
||||||
addImageTypeMetadataRecordBlockCallback(reinterpret_cast<void *>(type_metadata.start),
|
addImageTypeMetadataRecordBlockCallback(reinterpret_cast<void *>(type_metadata.start),
|
||||||
type_metadata.length);
|
type_metadata.length);
|
||||||
@@ -89,7 +89,7 @@ void swift::initializeTypeMetadataRecordLookup() {
|
|||||||
void swift::initializeTypeFieldLookup() {
|
void swift::initializeTypeFieldLookup() {
|
||||||
const swift::MetadataSections *sections = registered;
|
const swift::MetadataSections *sections = registered;
|
||||||
while (true) {
|
while (true) {
|
||||||
const swift::MetadataSections::Range &fields = sections->swift4_fieldmd;
|
const swift::MetadataSections::Range &fields = sections->swift5_fieldmd;
|
||||||
if (fields.length)
|
if (fields.length)
|
||||||
addImageTypeFieldDescriptorBlockCallback(
|
addImageTypeFieldDescriptorBlockCallback(
|
||||||
reinterpret_cast<void *>(fields.start), fields.length);
|
reinterpret_cast<void *>(fields.start), fields.length);
|
||||||
@@ -111,20 +111,20 @@ void swift_addNewDSOImage(const void *addr) {
|
|||||||
|
|
||||||
record(sections);
|
record(sections);
|
||||||
|
|
||||||
const auto &protocols_section = sections->swift4_protocols;
|
const auto &protocols_section = sections->swift5_protocols;
|
||||||
const void *protocols =
|
const void *protocols =
|
||||||
reinterpret_cast<void *>(protocols_section.start);
|
reinterpret_cast<void *>(protocols_section.start);
|
||||||
if (protocols_section.length)
|
if (protocols_section.length)
|
||||||
addImageProtocolsBlockCallback(protocols, protocols_section.length);
|
addImageProtocolsBlockCallback(protocols, protocols_section.length);
|
||||||
|
|
||||||
const auto &protocol_conformances = sections->swift4_protocol_conformances;
|
const auto &protocol_conformances = sections->swift5_protocol_conformances;
|
||||||
const void *conformances =
|
const void *conformances =
|
||||||
reinterpret_cast<void *>(protocol_conformances.start);
|
reinterpret_cast<void *>(protocol_conformances.start);
|
||||||
if (protocol_conformances.length)
|
if (protocol_conformances.length)
|
||||||
addImageProtocolConformanceBlockCallback(conformances,
|
addImageProtocolConformanceBlockCallback(conformances,
|
||||||
protocol_conformances.length);
|
protocol_conformances.length);
|
||||||
|
|
||||||
const auto &type_metadata = sections->swift4_type_metadata;
|
const auto &type_metadata = sections->swift5_type_metadata;
|
||||||
const void *metadata = reinterpret_cast<void *>(type_metadata.start);
|
const void *metadata = reinterpret_cast<void *>(type_metadata.start);
|
||||||
if (type_metadata.length)
|
if (type_metadata.length)
|
||||||
addImageTypeMetadataRecordBlockCallback(metadata, type_metadata.length);
|
addImageTypeMetadataRecordBlockCallback(metadata, type_metadata.length);
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ struct MetadataSections {
|
|||||||
size_t length;
|
size_t length;
|
||||||
};
|
};
|
||||||
|
|
||||||
Range swift4_protocols;
|
Range swift5_protocols;
|
||||||
Range swift4_protocol_conformances;
|
Range swift5_protocol_conformances;
|
||||||
Range swift4_type_metadata;
|
Range swift5_type_metadata;
|
||||||
Range swift4_typeref;
|
Range swift5_typeref;
|
||||||
Range swift4_reflstr;
|
Range swift5_reflstr;
|
||||||
Range swift4_fieldmd;
|
Range swift5_fieldmd;
|
||||||
Range swift4_assocty;
|
Range swift5_assocty;
|
||||||
};
|
};
|
||||||
} // namespace swift
|
} // namespace swift
|
||||||
|
|
||||||
|
|||||||
@@ -31,16 +31,16 @@ using namespace swift;
|
|||||||
namespace {
|
namespace {
|
||||||
/// The Mach-O section name for the section containing protocol descriptor
|
/// The Mach-O section name for the section containing protocol descriptor
|
||||||
/// references. This lives within SEG_TEXT.
|
/// references. This lives within SEG_TEXT.
|
||||||
constexpr const char ProtocolsSection[] = "__swift4_protos";
|
constexpr const char ProtocolsSection[] = "__swift5_protos";
|
||||||
/// The Mach-O section name for the section containing protocol conformances.
|
/// The Mach-O section name for the section containing protocol conformances.
|
||||||
/// This lives within SEG_TEXT.
|
/// This lives within SEG_TEXT.
|
||||||
constexpr const char ProtocolConformancesSection[] = "__swift4_proto";
|
constexpr const char ProtocolConformancesSection[] = "__swift5_proto";
|
||||||
/// The Mach-O section name for the section containing type references.
|
/// The Mach-O section name for the section containing type references.
|
||||||
/// This lives within SEG_TEXT.
|
/// This lives within SEG_TEXT.
|
||||||
constexpr const char TypeMetadataRecordSection[] = "__swift4_types";
|
constexpr const char TypeMetadataRecordSection[] = "__swift5_types";
|
||||||
/// The Mach-O section name for the section containing type field references.
|
/// The Mach-O section name for the section containing type field references.
|
||||||
/// This lives within SEG_TEXT.
|
/// This lives within SEG_TEXT.
|
||||||
constexpr const char TypeFieldRecordSection[] = "__swift4_fieldmd";
|
constexpr const char TypeFieldRecordSection[] = "__swift5_fieldmd";
|
||||||
|
|
||||||
#if __POINTER_WIDTH__ == 64
|
#if __POINTER_WIDTH__ == 64
|
||||||
using mach_header_platform = mach_header_64;
|
using mach_header_platform = mach_header_64;
|
||||||
@@ -57,7 +57,7 @@ void addImageCallback(const mach_header *mh, intptr_t vmaddr_slide) {
|
|||||||
assert(mh->magic == MH_MAGIC_64 && "loaded non-64-bit image?!");
|
assert(mh->magic == MH_MAGIC_64 && "loaded non-64-bit image?!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Look for a __swift4_proto section.
|
// Look for a __swift5_proto section.
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
const uint8_t *section =
|
const uint8_t *section =
|
||||||
getsectiondata(reinterpret_cast<const mach_header_platform *>(mh),
|
getsectiondata(reinterpret_cast<const mach_header_platform *>(mh),
|
||||||
|
|||||||
@@ -24,14 +24,14 @@
|
|||||||
__attribute__((__visibility__("hidden"))) extern const char __stop_##name;
|
__attribute__((__visibility__("hidden"))) extern const char __stop_##name;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
DECLARE_SWIFT_SECTION(swift4_protocols)
|
DECLARE_SWIFT_SECTION(swift5_protocols)
|
||||||
DECLARE_SWIFT_SECTION(swift4_protocol_conformances)
|
DECLARE_SWIFT_SECTION(swift5_protocol_conformances)
|
||||||
DECLARE_SWIFT_SECTION(swift4_type_metadata)
|
DECLARE_SWIFT_SECTION(swift5_type_metadata)
|
||||||
|
|
||||||
DECLARE_SWIFT_SECTION(swift4_typeref)
|
DECLARE_SWIFT_SECTION(swift5_typeref)
|
||||||
DECLARE_SWIFT_SECTION(swift4_reflstr)
|
DECLARE_SWIFT_SECTION(swift5_reflstr)
|
||||||
DECLARE_SWIFT_SECTION(swift4_fieldmd)
|
DECLARE_SWIFT_SECTION(swift5_fieldmd)
|
||||||
DECLARE_SWIFT_SECTION(swift4_assocty)
|
DECLARE_SWIFT_SECTION(swift5_assocty)
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef DECLARE_SWIFT_SECTION
|
#undef DECLARE_SWIFT_SECTION
|
||||||
@@ -53,14 +53,14 @@ static void swift_image_constructor() {
|
|||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
|
||||||
SWIFT_SECTION_RANGE(swift4_protocols),
|
SWIFT_SECTION_RANGE(swift5_protocols),
|
||||||
SWIFT_SECTION_RANGE(swift4_protocol_conformances),
|
SWIFT_SECTION_RANGE(swift5_protocol_conformances),
|
||||||
SWIFT_SECTION_RANGE(swift4_type_metadata),
|
SWIFT_SECTION_RANGE(swift5_type_metadata),
|
||||||
|
|
||||||
SWIFT_SECTION_RANGE(swift4_typeref),
|
SWIFT_SECTION_RANGE(swift5_typeref),
|
||||||
SWIFT_SECTION_RANGE(swift4_reflstr),
|
SWIFT_SECTION_RANGE(swift5_reflstr),
|
||||||
SWIFT_SECTION_RANGE(swift4_fieldmd),
|
SWIFT_SECTION_RANGE(swift5_fieldmd),
|
||||||
SWIFT_SECTION_RANGE(swift4_assocty),
|
SWIFT_SECTION_RANGE(swift5_assocty),
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef SWIFT_SECTION_RANGE
|
#undef SWIFT_SECTION_RANGE
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// -- partial_apply context metadata
|
// -- partial_apply context metadata
|
||||||
|
|
||||||
// CHECK: [[METADATA:@.*]] = private constant %swift.full_boxmetadata { void (%swift.refcounted*)* @objectdestroy, i8** null, %swift.type { i64 64 }, i32 16, i8* bitcast ({ i32, i32, i32, i32 }* @"\01l__swift4_reflection_descriptor" to i8*) }
|
// CHECK: [[METADATA:@.*]] = private constant %swift.full_boxmetadata { void (%swift.refcounted*)* @objectdestroy, i8** null, %swift.type { i64 64 }, i32 16, i8* bitcast ({ i32, i32, i32, i32 }* @"\01l__swift5_reflection_descriptor" to i8*) }
|
||||||
|
|
||||||
func a(i i: Int) -> (Int) -> Int {
|
func a(i i: Int) -> (Int) -> Int {
|
||||||
return { x in i }
|
return { x in i }
|
||||||
|
|||||||
@@ -2,51 +2,51 @@
|
|||||||
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -disable-reflection-names -emit-ir %s | %FileCheck %s --check-prefix=STRIP_REFLECTION_NAMES
|
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -disable-reflection-names -emit-ir %s | %FileCheck %s --check-prefix=STRIP_REFLECTION_NAMES
|
||||||
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -disable-reflection-metadata -emit-ir %s | %FileCheck %s --check-prefix=STRIP_REFLECTION_METADATA
|
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -disable-reflection-metadata -emit-ir %s | %FileCheck %s --check-prefix=STRIP_REFLECTION_METADATA
|
||||||
|
|
||||||
// STRIP_REFLECTION_NAMES_DAG: {{.*}}swift4_reflect
|
// STRIP_REFLECTION_NAMES_DAG: {{.*}}swift5_reflect
|
||||||
// STRIP_REFLECTION_NAMES_DAG: {{.*}}swift4_fieldmd
|
// STRIP_REFLECTION_NAMES_DAG: {{.*}}swift5_fieldmd
|
||||||
// STRIP_REFLECTION_NAMES_DAG: {{.*}}swift4_assocty
|
// STRIP_REFLECTION_NAMES_DAG: {{.*}}swift5_assocty
|
||||||
// STRIP_REFLECTION_NAMES-DAG: {{.*}}swift4_capture
|
// STRIP_REFLECTION_NAMES-DAG: {{.*}}swift5_capture
|
||||||
// STRIP_REFLECTION_NAMES-DAG: {{.*}}swift4_typeref
|
// STRIP_REFLECTION_NAMES-DAG: {{.*}}swift5_typeref
|
||||||
// STRIP_REFLECTION_NAMES-NOT: {{.*}}swift4_reflstr
|
// STRIP_REFLECTION_NAMES-NOT: {{.*}}swift5_reflstr
|
||||||
// STRIP_REFLECTION_NAMES-NOT: {{.*}}swift4_builtin
|
// STRIP_REFLECTION_NAMES-NOT: {{.*}}swift5_builtin
|
||||||
|
|
||||||
// STRIP_REFLECTION_NAMES-DAG: @"$S19reflection_metadata10MyProtocol_pMF" = internal constant {{.*}}swift4_fieldmd
|
// STRIP_REFLECTION_NAMES-DAG: @"$S19reflection_metadata10MyProtocol_pMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
|
|
||||||
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift4_reflect
|
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift5_reflect
|
||||||
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift4_fieldmd
|
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift5_fieldmd
|
||||||
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift4_assocty
|
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift5_assocty
|
||||||
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift4_capture
|
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift5_capture
|
||||||
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift4_typeref
|
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift5_typeref
|
||||||
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift4_reflstr
|
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift5_reflstr
|
||||||
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift4_builtin
|
// STRIP_REFLECTION_METADATA-NOT: {{.*}}swift5_builtin
|
||||||
|
|
||||||
// CHECK-DAG: @__swift_reflection_version = linkonce_odr hidden constant i16 {{[0-9]+}}
|
// CHECK-DAG: @__swift_reflection_version = linkonce_odr hidden constant i16 {{[0-9]+}}
|
||||||
// CHECK-DAG: private constant [2 x i8] c"i\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [2 x i8] c"i\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [3 x i8] c"ms\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [3 x i8] c"ms\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [3 x i8] c"me\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [3 x i8] c"me\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [3 x i8] c"mc\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [3 x i8] c"mc\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [2 x i8] c"C\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [2 x i8] c"C\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [2 x i8] c"S\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [2 x i8] c"S\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [2 x i8] c"E\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [2 x i8] c"E\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [2 x i8] c"I\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [2 x i8] c"I\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [2 x i8] c"t\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [2 x i8] c"t\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [4 x i8] c"mgs\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [4 x i8] c"mgs\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [4 x i8] c"mge\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [4 x i8] c"mge\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [4 x i8] c"mgc\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [4 x i8] c"mgc\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [3 x i8] c"GC\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [3 x i8] c"GC\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [3 x i8] c"GS\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [3 x i8] c"GS\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
// CHECK-DAG: private constant [3 x i8] c"GE\00", section "{{[^"]*}}swift4_reflstr{{[^"]*}}"
|
// CHECK-DAG: private constant [3 x i8] c"GE\00", section "{{[^"]*}}swift5_reflstr{{[^"]*}}"
|
||||||
|
|
||||||
// CHECK-DAG: @"\01l__swift4_reflection_descriptor" = private constant { {{.*}} } { i32 1, i32 1, i32 2, {{.*}} }
|
// CHECK-DAG: @"\01l__swift5_reflection_descriptor" = private constant { {{.*}} } { i32 1, i32 1, i32 2, {{.*}} }
|
||||||
|
|
||||||
// CHECK-DAG: @"$S19reflection_metadata10MyProtocol_pMF" = internal constant {{.*}}swift4_fieldmd
|
// CHECK-DAG: @"$S19reflection_metadata10MyProtocol_pMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
// CHECK-DAG: @"$S19reflection_metadata7MyClassCMF" = internal constant {{.*}}swift4_fieldmd
|
// CHECK-DAG: @"$S19reflection_metadata7MyClassCMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
// CHECK-DAG: @"$S19reflection_metadata11ConformanceVAA10MyProtocolAAMA" = internal constant {{.*}}swift4_assocty
|
// CHECK-DAG: @"$S19reflection_metadata11ConformanceVAA10MyProtocolAAMA" = internal constant {{.*}}swift5_assocty
|
||||||
// CHECK-DAG: @"$S19reflection_metadata8MyStructVMF" = internal constant {{.*}}swift4_fieldmd
|
// CHECK-DAG: @"$S19reflection_metadata8MyStructVMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
// CHECK-DAG: @"$S19reflection_metadata6MyEnumOMF" = internal constant {{.*}}swift4_fieldmd
|
// CHECK-DAG: @"$S19reflection_metadata6MyEnumOMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
// CHECK-DAG: @"$S19reflection_metadata14MyGenericClassCMF" = internal constant {{.*}}swift4_fieldmd
|
// CHECK-DAG: @"$S19reflection_metadata14MyGenericClassCMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
// CHECK-DAG: @"$S19reflection_metadata15MyGenericStructVMF" = internal constant {{.*}}swift4_fieldmd
|
// CHECK-DAG: @"$S19reflection_metadata15MyGenericStructVMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
// CHECK-DAG: @"$S19reflection_metadata13MyGenericEnumOMF" = internal constant {{.*}}swift4_fieldmd
|
// CHECK-DAG: @"$S19reflection_metadata13MyGenericEnumOMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
|
|
||||||
public protocol MyProtocol {
|
public protocol MyProtocol {
|
||||||
associatedtype Inner
|
associatedtype Inner
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import c_layout
|
|||||||
|
|
||||||
// CHECK-DAG: @__swift_reflection_version = linkonce_odr hidden constant i16 {{[0-9]+}}
|
// CHECK-DAG: @__swift_reflection_version = linkonce_odr hidden constant i16 {{[0-9]+}}
|
||||||
|
|
||||||
// CHECK-DAG: @"$S28reflection_metadata_imported15HasImportedTypeVMF" = internal constant {{.*}}swift4_fieldmd
|
// CHECK-DAG: @"$S28reflection_metadata_imported15HasImportedTypeVMF" = internal constant {{.*}}swift5_fieldmd
|
||||||
// CHECK-DAG: @"$SSo1AVMB" = linkonce_odr hidden constant {{.*}}swift4_builtin
|
// CHECK-DAG: @"$SSo1AVMB" = linkonce_odr hidden constant {{.*}}swift5_builtin
|
||||||
// CHECK-DAG: @"$SSo11CrappyColorVMB" = linkonce_odr hidden constant {{.*}}swift4_builtin
|
// CHECK-DAG: @"$SSo11CrappyColorVMB" = linkonce_odr hidden constant {{.*}}swift5_builtin
|
||||||
// CHECK-DAG: @"$SSo11CrappyColorVs16RawRepresentableSCMA" = linkonce_odr hidden constant {{.*}}swift4_assocty
|
// CHECK-DAG: @"$SSo11CrappyColorVs16RawRepresentableSCMA" = linkonce_odr hidden constant {{.*}}swift5_assocty
|
||||||
|
|
||||||
struct HasImportedType {
|
struct HasImportedType {
|
||||||
let a: A
|
let a: A
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public func f(s : S) -> (() -> ()) {
|
|||||||
return { gg = s }
|
return { gg = s }
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-DAG: @"\01l__swift4_reflection_descriptor" = private constant {{.*}}, section ".sw5cptr$B"
|
// CHECK-DAG: @"\01l__swift5_reflection_descriptor" = private constant {{.*}}, section ".sw5cptr$B"
|
||||||
// CHECK-DAG: @"{{.*}}" = {{.*}} c"Sq", {{.*}} section ".sw5tyrf$B"
|
// CHECK-DAG: @"{{.*}}" = {{.*}} c"Sq", {{.*}} section ".sw5tyrf$B"
|
||||||
// CHECK-DAG: @{{[0-9]+}} = {{.*}} c"none\00", section ".sw5rfst$B"
|
// CHECK-DAG: @{{[0-9]+}} = {{.*}} c"none\00", section ".sw5rfst$B"
|
||||||
// CHECK-DAG: @{{[0-9]+}} = {{.*}} c"some\00", section ".sw5rfst$B"
|
// CHECK-DAG: @{{[0-9]+}} = {{.*}} c"some\00", section ".sw5rfst$B"
|
||||||
|
|||||||
@@ -122,17 +122,17 @@ findReflectionSection(const ObjectFile *objectFile,
|
|||||||
|
|
||||||
static ReflectionInfo findReflectionInfo(const ObjectFile *objectFile) {
|
static ReflectionInfo findReflectionInfo(const ObjectFile *objectFile) {
|
||||||
auto fieldSection = findReflectionSection<FieldSection>(
|
auto fieldSection = findReflectionSection<FieldSection>(
|
||||||
objectFile, {"__swift4_fieldmd", ".swift4_fieldmd", "swift4_fieldmd"});
|
objectFile, {"__swift5_fieldmd", ".swift5_fieldmd", "swift5_fieldmd"});
|
||||||
auto associatedTypeSection = findReflectionSection<AssociatedTypeSection>(
|
auto associatedTypeSection = findReflectionSection<AssociatedTypeSection>(
|
||||||
objectFile, {"__swift4_assocty", ".swift4_assocty", "swift4_assocty"});
|
objectFile, {"__swift5_assocty", ".swift5_assocty", "swift5_assocty"});
|
||||||
auto builtinTypeSection = findReflectionSection<BuiltinTypeSection>(
|
auto builtinTypeSection = findReflectionSection<BuiltinTypeSection>(
|
||||||
objectFile, {"__swift4_builtin", ".swift4_builtin", "swift4_builtin"});
|
objectFile, {"__swift5_builtin", ".swift5_builtin", "swift5_builtin"});
|
||||||
auto captureSection = findReflectionSection<CaptureSection>(
|
auto captureSection = findReflectionSection<CaptureSection>(
|
||||||
objectFile, {"__swift4_capture", ".swift4_capture", "swift4_capture"});
|
objectFile, {"__swift5_capture", ".swift5_capture", "swift5_capture"});
|
||||||
auto typeRefSection = findReflectionSection<GenericSection>(
|
auto typeRefSection = findReflectionSection<GenericSection>(
|
||||||
objectFile, {"__swift4_typeref", ".swift4_typeref", "swift4_typeref"});
|
objectFile, {"__swift5_typeref", ".swift5_typeref", "swift5_typeref"});
|
||||||
auto reflectionStringsSection = findReflectionSection<GenericSection>(
|
auto reflectionStringsSection = findReflectionSection<GenericSection>(
|
||||||
objectFile, {"__swift4_reflstr", ".swift4_reflstr", "swift4_reflstr"});
|
objectFile, {"__swift5_reflstr", ".swift5_reflstr", "swift5_reflstr"});
|
||||||
|
|
||||||
// The entire object file is mapped into this process's memory, so the
|
// The entire object file is mapped into this process's memory, so the
|
||||||
// local/remote mapping is identity.
|
// local/remote mapping is identity.
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ def compare_sizes_of_file(old_files, new_files, all_sections, list_categories,
|
|||||||
compare_sizes(old_sizes, new_sizes, "__objc_const", section_title,
|
compare_sizes(old_sizes, new_sizes, "__objc_const", section_title,
|
||||||
csv=csv)
|
csv=csv)
|
||||||
compare_sizes(old_sizes, new_sizes, "__data", section_title, csv=csv)
|
compare_sizes(old_sizes, new_sizes, "__data", section_title, csv=csv)
|
||||||
compare_sizes(old_sizes, new_sizes, "__swift4_proto", section_title,
|
compare_sizes(old_sizes, new_sizes, "__swift5_proto", section_title,
|
||||||
csv=csv)
|
csv=csv)
|
||||||
compare_sizes(old_sizes, new_sizes, "__common", section_title, csv=csv)
|
compare_sizes(old_sizes, new_sizes, "__common", section_title, csv=csv)
|
||||||
compare_sizes(old_sizes, new_sizes, "__bss", section_title, csv=csv)
|
compare_sizes(old_sizes, new_sizes, "__bss", section_title, csv=csv)
|
||||||
|
|||||||
Reference in New Issue
Block a user