@@ -585,8 +585,7 @@ void IRGenModule::emitRuntimeRegistration() {
585585 if (SwiftProtocols.empty () && ProtocolConformances.empty () &&
586586 RuntimeResolvableTypes.empty () &&
587587 (!ObjCInterop || (ObjCProtocols.empty () && ObjCClasses.empty () &&
588- ObjCCategoryDecls.empty ())) &&
589- FieldDescriptors.empty ())
588+ ObjCCategoryDecls.empty ())))
590589 return ;
591590
592591 // Find the entry point.
@@ -748,10 +747,6 @@ void IRGenModule::emitRuntimeRegistration() {
748747 }
749748 }
750749
751- if (!FieldDescriptors.empty ()) {
752- emitFieldDescriptors ();
753- }
754-
755750 RegIGF.Builder .CreateRetVoid ();
756751}
757752
@@ -3831,58 +3826,6 @@ llvm::Constant *IRGenModule::emitTypeMetadataRecords() {
38313826 return var;
38323827}
38333828
3834- llvm::Constant *IRGenModule::emitFieldDescriptors () {
3835- std::string sectionName;
3836- switch (TargetInfo.OutputObjectFormat ) {
3837- case llvm::Triple::MachO:
3838- sectionName = " __TEXT, __swift5_fieldmd, regular, no_dead_strip" ;
3839- break ;
3840- case llvm::Triple::ELF:
3841- case llvm::Triple::Wasm:
3842- sectionName = " swift5_fieldmd" ;
3843- break ;
3844- case llvm::Triple::XCOFF:
3845- case llvm::Triple::COFF:
3846- sectionName = " .sw5flmd$B" ;
3847- break ;
3848- case llvm::Triple::GOFF:
3849- case llvm::Triple::UnknownObjectFormat:
3850- llvm_unreachable (" Don't know how to emit field records table for "
3851- " the selected object format." );
3852- }
3853-
3854- // Do nothing if the list is empty.
3855- if (FieldDescriptors.empty ())
3856- return nullptr ;
3857-
3858- // Define the global variable for the field record list.
3859- // We have to do this before defining the initializer since the entries will
3860- // contain offsets relative to themselves.
3861- auto arrayTy =
3862- llvm::ArrayType::get (FieldDescriptorPtrTy, FieldDescriptors.size ());
3863-
3864- // FIXME: This needs to be a linker-local symbol in order for Darwin ld to
3865- // resolve relocations relative to it.
3866- auto var = new llvm::GlobalVariable (
3867- Module, arrayTy,
3868- /* isConstant*/ true , llvm::GlobalValue::PrivateLinkage,
3869- /* initializer*/ nullptr , " \x01 l_type_metadata_table" );
3870-
3871- SmallVector<llvm::Constant *, 8 > elts;
3872- for (auto *descriptor : FieldDescriptors)
3873- elts.push_back (
3874- llvm::ConstantExpr::getBitCast (descriptor, FieldDescriptorPtrTy));
3875-
3876- var->setInitializer (llvm::ConstantArray::get (arrayTy, elts));
3877- var->setSection (sectionName);
3878- var->setAlignment (llvm::MaybeAlign (4 ));
3879-
3880- disableAddressSanitizer (*this , var);
3881-
3882- addUsedGlobal (var);
3883- return var;
3884- }
3885-
38863829// / Fetch a global reference to a reference to the given Objective-C class.
38873830// / The result is of type ObjCClassPtrTy->getPointerTo().
38883831Address IRGenModule::getAddrOfObjCClassRef (ClassDecl *theClass) {
0 commit comments