@@ -705,47 +705,52 @@ class CaptureDescriptorBuilder : public ReflectionMetadataBuilder {
705
705
};
706
706
707
707
static std::string getReflectionSectionName (IRGenModule &IGM,
708
- std::string Base) {
708
+ StringRef LongName,
709
+ StringRef FourCC) {
709
710
SmallString<50 > SectionName;
710
711
llvm::raw_svector_ostream OS (SectionName);
711
712
switch (IGM.TargetInfo .OutputObjectFormat ) {
712
- case llvm::Triple::MachO:
713
- assert (Base.size () <= 7
714
- && " Mach-O section name length must be <= 16 characters" );
715
- OS << " __TEXT, __swift3_" << Base << " , regular, no_dead_strip" ;
716
- break ;
717
- case llvm::Triple::ELF:
718
- OS << " .swift3_" << Base;
719
- break ;
720
- default :
721
- llvm_unreachable (" Don't know how to emit field name table for "
722
- " the selected object format." );
713
+ case llvm::Triple::UnknownObjectFormat:
714
+ llvm_unreachable (" unknown object format" );
715
+ case llvm::Triple::COFF:
716
+ assert (FourCC.size () <= 4 &&
717
+ " COFF section name length must be <= 8 characters" );
718
+ OS << " .sw3" << FourCC;
719
+ break ;
720
+ case llvm::Triple::ELF:
721
+ OS << " .swift3_" << LongName;
722
+ break ;
723
+ case llvm::Triple::MachO:
724
+ assert (LongName.size () <= 7 &&
725
+ " Mach-O section name length must be <= 16 characters" );
726
+ OS << " __TEXT,__swift3_" << LongName << " , regular, no_dead_strip" ;
727
+ break ;
723
728
}
724
729
return OS.str ();
725
730
}
726
731
727
732
std::string IRGenModule::getFieldTypeMetadataSectionName () {
728
- return getReflectionSectionName (*this , " fieldmd" );
733
+ return getReflectionSectionName (*this , " fieldmd" , " flmd " );
729
734
}
730
735
731
736
std::string IRGenModule::getBuiltinTypeMetadataSectionName () {
732
- return getReflectionSectionName (*this , " builtin" );
737
+ return getReflectionSectionName (*this , " builtin" , " bltn " );
733
738
}
734
739
735
740
std::string IRGenModule::getAssociatedTypeMetadataSectionName () {
736
- return getReflectionSectionName (*this , " assocty" );
741
+ return getReflectionSectionName (*this , " assocty" , " asty " );
737
742
}
738
743
739
744
std::string IRGenModule::getCaptureDescriptorMetadataSectionName () {
740
- return getReflectionSectionName (*this , " capture" );
745
+ return getReflectionSectionName (*this , " capture" , " cptr " );
741
746
}
742
747
743
748
std::string IRGenModule::getReflectionStringsSectionName () {
744
- return getReflectionSectionName (*this , " reflstr" );
749
+ return getReflectionSectionName (*this , " reflstr" , " rfst " );
745
750
}
746
751
747
752
std::string IRGenModule::getReflectionTypeRefSectionName () {
748
- return getReflectionSectionName (*this , " typeref" );
753
+ return getReflectionSectionName (*this , " typeref" , " tyrf " );
749
754
}
750
755
751
756
llvm::Constant *IRGenModule::getAddrOfFieldName (StringRef Name) {
0 commit comments